Author Topic: Mouse Controller  (Read 1105 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Mouse Controller
« on: May 31, 2025 »
The program opens all the yabasic keys (5 are used)
for easy operation, momentary and continuous.
D-pad to move the mouse. Delete to hold and release.

Code: [Select]
open window 640,512

restore word
read wrd
dim ltr$(wrd)
for a=1 to wrd
read ltr$(a)
next a

dim xb(10)
dim yb(10)
for a=1 to 10
xb(a)=a*60-40
yb(a)=100
next a

x=320
y=255

keys=16
dim go(keys)
dim g(keys)

key=16
dim go1(key)

off=1
blox=1

repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

for a=1 to keys
if and(c,2^(a-1))<>0 go(a)=1
if go(a)=1 g(a)=g(a)+1
if g(a)>2 g(a)=2
if g(a)=2 go(a)=0
if and(c,2^(a-1))=0 g(a)=0
next a

for a=1 to key
if and(c,2^(a-1))<>0 go1(a)=1
if and(c,2^(a-1))=0 go1(a)=0
next a

if go(15)=1 off=off+1
if off>2 off=1

if go(4)=1 blox=blox+1
if blox>10 blox=1

setrgb 1,256,256,256
line x,y to x+10,y
line x,y to x+15,y+15
line x,y to x,y+10

if x<0 x=640
if x>640 x=0
if y<0 y=510
if y>510 y=0

for a=1 to 10
rectangle xb(a),yb(a) to xb(a)+50,yb(a)+50
text xb(a)+20,yb(a)+30,ltr$(a)
next a

if go1(8)=1 x=x-1
if go1(6)=1 x=x+1
if go1(5)=1 y=y-1
if go1(7)=1 y=y+1

if off=2 then
for a=1 to 10
if x>xb(a) and x<xb(a)+50 and y>yb(a) and y<yb(a)+50 then
if go1(6)=1 xb(a)=xb(a)+1
if go1(8)=1 xb(a)=xb(a)-1
if go1(7)=1 yb(a)=yb(a)+1
if go1(5)=1 yb(a)=yb(a)-1
endif
next a
endif

if off=2 then
for a=1 to 10
if x>xb(a) and x<xb(a)+50 and y>yb(a) and y<yb(a)+50 then
setrgb 1,0,256,0
rectangle xb(a),yb(a) to xb(a)+50,yb(a)+50
endif
next a
endif


until (1=0)

label word
data 10
data "S"
data "H"
data "R"
data "I"
data "N"
data "K"
data "A"
data "B"
data "L"
data "E"

Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.