Name
sdl.GetButton -- query state of specified button
Synopsis
state = sdl.GetButton(port, button)
Function
If the device at the specified port is a joystick, button must be the index of the desired button (starting from 0). The number of joystick buttons can be found out by calling sdl.GetNumButtons().

If the device at the specified port is a game controller, button must be one of the following predefined constants:

 
#SDL_BUTTON_A
#SDL_BUTTON_B
#SDL_BUTTON_X
#SDL_BUTTON_Y
#SDL_BUTTON_BACK
#SDL_BUTTON_GUIDE
#SDL_BUTTON_START
#SDL_BUTTON_LEFTSTICK
#SDL_BUTTON_RIGHTSTICK
#SDL_BUTTON_LEFTSHOULDER
#SDL_BUTTON_RIGHTSHOULDER
#SDL_BUTTON_DPAD_UP
#SDL_BUTTON_DPAD_DOWN
#SDL_BUTTON_DPAD_LEFT
#SDL_BUTTON_DPAD_RIGHT

Inputs
port
game port to query
button
button to query
Results
state
state of the specified button (1 for pressed state, 0 non-pressed state)

Show TOC