I´ve made some code that accepts pads and a keyboard using TCA´s user control dll. I´ve set it to use pad number 1 as the input device. When I run the code it just exits back to dektop without any error messages. I can´t see what´s diferent to the example. Can anyone shed some light?
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
global player_control1 as integer
player_control1=3
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#>=joyMaxX# then joyMaxY#=ty#
if ty#<=joyMinX# then joyMinY#=ty#
cls 0
text 0,0,str$(tx#)+" "+str$(ty#)
text 0,32,str$(joyMinX#)+" "+str$(joyMaxX#)
sync
until spacekey()
do
cls
remstart
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,0):tx#=peekF(addr,4)
if tm#<=joyMinX#
text 0,0,"Left"
else
if tm#>=joyMax#
text 0,0,"Right"
endif
endif
remend
if rightkey1()=1 then text 0,0,"Right"
if leftkey1()=1 then text 0,0,"Left"
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
tx#=0.0
select player_control1
case 1 : gosub option1r1 : endcase
case 2 : gosub option2r1 : endcase
case 3 : gosub option3r1 : endcase
case 4 : gosub option4r1 : endcase
endselect
option1r1:
if rightkey()=1 then out=1
return
option2r1:
if inkey$()="d" then out=1
return
option3r1:
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,0) : tx#=peekF(addr,4)
if tm#>=joyMaxX# then out=1
return
option4r1:
x=userControl_getJoystickPos(1,addr,4)
tm#=peekF(addr,1) : tx#=peekF(addr,4)
if tm#>=joyMaxX# then out=1
return
endfunction out
function leftkey1()
out=0
tm#=0
tx#=0.0
select player_control1
case 1 : gosub option1l1 : endcase
case 2 : gosub option2l1 : endcase
case 3 : gosub option3l1 : endcase
case 4 : gosub option4l1 : endcase
endselect
option1l1:
if leftkey()=1 then out=1
return
option2l1:
if inkey$()="a" then out=1
return
option3l1:
x=userControl_getJoystickPos(0,addr,4)
tm#=peekF(addr,0) : tx#=peekF(addr,4)
if tm#<=joyMinX# then out=1
return
option4l1:
x=userControl_getJoystickPos(1,addr,4)
tm#=peekF(addr,1) : tx#=peekF(addr,4)
if tm#<=joyMinX# then out=1
return
endfunction out
A bargain at 900000€ second hand
Libera tu mente y te liberaras.