Hang if JoystickButton() request state of NON existing button

Everything else that doesn't fall into one of the other categories.
plouf
Posts: 295
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Hang if JoystickButton() request state of NON existing button

Post by plouf »

if i use JoystickButton() and request state of joystick's existing button works as expected
but if i ask state of non existing button (for example the 3rd button in a 2 button joystick) debugger call and hangs

however there is no native way to find how many button joystick has !?
Christos
plouf
Posts: 295
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: Hang if JoystickButton() request state of NON existing button

Post by plouf »

in the meantime the following code can return the numbers of buttons in joypad
note have to use it ONLY if Initjoystick() returns that the joypad is connnected

Code: Select all

   
    ! var v_buttons1;
    ! v_buttons1 = spider.joystick.gamepads[0].buttons.length;
    Debug buttons1
Christos
Post Reply