I searched around the forum, but didn't find an answer to my "problem".
I am using Purebasics Joystick-functions like in the example from the docs:
Code: Select all
NbJoysticks = InitJoystick()
If NbJoysticks = 0
MessageRequester("Error", "No joysticks are availables.", 0)
End
EndIf
If OpenWindow(0, 100, 100, 300, 260, "PureBasic - Joystick Demo")
x = WindowWidth(0)/2
y = WindowHeight(0)/2-20
Repeat
Repeat
Event = WindowEvent()
If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
Until Event = 0
Delay(20) ; a little delay (20 milli seconds -> 50 fps)
If ExamineJoystick(0)
x+JoystickAxisX(0)
y+JoystickAxisY(0)
If JoystickButton(0, 1)
Debug "button 1"
EndIf
If JoystickButton(0, 2)
Debug "button 2"
EndIf
If StartDrawing(WindowOutput(0)) ; Set the drawing output to our window
FrontColor(RGB(255,0,0)) ; Use the RED colour
Box(x, y, 10, 10) ; Draw a little box
StopDrawing() ;
EndIf
EndIf
Until Quit = 1
EndIf
End
How do you people handle this? I would need button_down and button_up instead of button_pushed, like the Canvas-events for mouse clicks.
I am thinking about a timeout handler like 500 msec, but that won't help with permanent fire. It may also break a game.
Any ideas welcome and very much appreciated
