Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Joystick (http://www.chiefdelphi.com/forums/showthread.php?t=16518)

cammie825 15-01-2003 10:40

Joystick
 
I had a question about the abilities of our joysticks. Is there a way to program the buttons or triggers so that when you continuously hold the trigger the action is performed, and when the trigger is released the action stops?

D.Viddy 15-01-2003 10:48

Of course
 
It's going to look something like this (note: I use the underscores for indention purposes only, do not include them in your code):

'If port1 trigger is pressed then
If p1_sw_trig = 1 then
_____'Perform Action Here
endif

Or if you wanted it so when you pressed a joy button it would turn an action on, and when you pressed it again, it would do another action then:

'Declare this variable at top of code
action_on VAR byte

'If port1 trigger is pressed then
If p1_sw_trig = 1 then
_____'Switch from on to off
_____toggle action_on
endif

'If alternate action is specified then
If action_on = 1 then
____'Do action here
else
____'Do another action here
end if


All times are GMT -5. The time now is 13:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi