WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global balx , baly , balz
balx = WindowWidth / 2
baly = WindowHeight / 2
balz = 10
nomainwin
timer 100 , [tmr]
open "Joy-Test" for graphics as #m
print #m , "trapclose [quit]"
wait
[tmr]
readjoystick 1
dx = 0
if Joy1x > 256 * 256 * 2 / 3 then
dx = 10
end if
if Joy1x < 256 * 256 / 3 then
dx = -10
end if
if balx + dx < 0 then dx = 0
if balx + dx > WindowWidth then dx = 0
dy = 0
if Joy1y > 256 * 256 * 2 / 3 then
dy = 10
end if
if Joy1y < 256 * 256 / 3 then
dy = -10
end if
if baly + dy < 0 then dy = 0
if baly + dy > WindowHeight then dy = 0
dz = 0
if Joy1z > 256 * 256 * 2 / 3 then
dz = 10
end if
if Joy1z < 256 * 256 / 3 then
dz = -10
end if
if balz + dz < 20 then dz = 0
if balz + dz > 200 then dz = 0
balx = balx + dx
baly = baly + dy
balz = balz + dz
#m , "cls"
if Joy1button1 then
#m , "color red"
#m , "backcolor red"
else
#m , "color black"
#m , "backcolor black"
end if
if Joy1button2 then
#m , "goto " ; balx - balz _
; " " ; baly - balz
#m , "down"
#m , "boxfilled " ; balx + balz _
; " " ; baly + balz
else
#m , "goto " ; balx ; " " ; baly
#m , "down"
#m , "size " ; balz / 10
#m , "circle " ; balz
end if
#m , "up"
#m , "flush"
wait
[quit]
close #m
end