Hi guys.
I´ve found time in my busy schedule of studying and looking at the forums to play around with DBPro.
I´ve finally got my head around TCA´s user control dll and as a side effect I´ve changed the example to display up and down aswell as well as left and right.
The code´s vitually the same as TCA´s example but I´ve remed out a bit of code that seams to do nothing (It´s always the same when you do a bit of DIY, there´s always bits left over).
Just thought that it might make more sense to people now that it uses those declared bits of memory. Thanks for the dll TCA!
REM Project: User control
REM Created: 07/09/2004 17:55:47
REM
REM ***** Main Source File *****
REM
global addr as integer
addr=make memory(1024)
global joyMinX# as float
joyMinX#=0.0
global joyMaxX# as float
joyMaxX#=0.0
global joyMinY# as float
joyMinY#=0.0
global joyMaxY# as float
joyMaxY#=0.0
print userControl_getJoystickParam(0,0x00050001)
rem calibrate the joypad
print "Calibrating. Whirl joystick around and then press a button"
repeat
x=userControl_getJoystickPos(0,addr,4)
tx#=peekF(addr,0):ty#=peekF(addr,4)
if tx#>=joyMaxX# then joyMaxX#=tx#
if tx#<=joyMinX# then joyMinX#=tx#
if ty#>=joyMaxY# then joyMaxY#=ty#
if ty#<=joyMinY# then joyMinY#=ty#
cls 0
text 0,0,str$(tx#)+" "+str$(ty#)
text 0,32,str$(joyMinX#)+" "+str$(joyMaxX#)
text 0,64,str$(joyMinY#)+" "+str$(joyMaxY#)
sync
until spacekey()
do
cls
if rightkey1()=1 then text 0,0,"Right"
if leftkey1()=1 then text 0,0,"Left"
if upkey1()=1 then text 0,0,"Up"
if downkey1()=1 then text 0,0,"Down"
x=userControl_getJoystickButton(0,addr,16)
for x=0 to 15
t=peekB(addr,x)
text 0+(x*12),64,chr$(t+48)
next x
sync
loop
function rightkey1()
out=0
tm#=0
rem txory#=0
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,0)
rem : tx#=peekF(addr,4)
if tm#>=joyMaxX# then out=1
endfunction out
function leftkey1()
out=0
tm#=0
rem txory#=0
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,0)
rem : tx#=peekF(addr,4)
if tm#<=joyMinX# then out=1
endfunction out
function upkey1()
out=0
tm#=0
rem txory#=0
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,4)
rem : tx#=peekF(addr,4)
if tm#>=joyMaxY# then out=1
endfunction out
function downkey1()
out=0
tm#=0
rem txory#=0
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,4)
rem : txory#=peekF(addr,4)
if tm#<=joyMinY# then out=1
endfunction out
A bargain at 900000€ second hand
Libera tu mente y te liberaras.