Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Joystick-position/FreeBASIC/joystick-position.basic
Normal file
30
Task/Joystick-position/FreeBASIC/joystick-position.basic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
Screen 12
|
||||
|
||||
Dim As Single x, y
|
||||
Dim As Integer buttons, result
|
||||
|
||||
Const JoystickID = 0
|
||||
|
||||
'This line checks to see if the joystick is ok.
|
||||
If Getjoystick(JoystickID, buttons, x, y) Then
|
||||
Print "Joystick doesn't exist or joystick error."
|
||||
Print !"\nPress any key to continue."
|
||||
Sleep
|
||||
End
|
||||
End If
|
||||
|
||||
Do
|
||||
result = Getjoystick(JoystickID, buttons, x, y)
|
||||
|
||||
Locate 1,1
|
||||
Print ; "result:"; result; " x:"; x; " y:"; y; " Buttons:"; buttons, "", "", ""
|
||||
|
||||
'This tests to see which buttons from 1 to 27 are pressed.
|
||||
For a As Integer = 0 To 26
|
||||
If (buttons And (1 Shl a)) Then
|
||||
Print "Button "; a; " pressed. "
|
||||
Else
|
||||
Print "Button "; a; " not pressed."
|
||||
End If
|
||||
Next a
|
||||
Loop
|
||||
Loading…
Add table
Add a link
Reference in a new issue