index of namespace default
 
 index of project tksdl
 
 index of module tksdl

Class tksdl.Joystick


SynopsisRepresents an SDL joystick device

  Base classes:
  Methods:
  Constants:

Method getAxis
Query current value of a joystick axis.
Signature
getAxis(intaxis)
 :int
Arguments
intaxis
Returns
int
Description

This is a wrapper for the SDL_JoystickGetAxis() native function.

 
 top of page
Method getBall
Query relative trackball motion
Signature
getBall(intball,
  Objectret 
  )  
 :boolean
Arguments
intballball axis
Objectret
Returns
booleanTrue if the values have been read successfully, false otherwise.
Description

This is a wrapper for the SDL_JoystickGetBall() native function.

 
 top of page
Method getButton
Query joystick button state
Signature
getButton(intbutton)
 :int
Arguments
intbuttonWhich button
Returns
int0=button up, !0=button down
Description

This is a wrapper for the SDL_JoystickGetButton() native function.

 
 top of page
Method getHat
Query the current state of a joystick hat
Signature
getHat(inthat)
 :int
Arguments
inthatWhich hat
Returns
intHat state
Description

This is a wrapper for the SDL_JoystickGetHat() native function.
The current state is returned as an unsigned byte is defined as an OR'd combination of one or more of the following: SDL_HAT_CENTERED, SDL_HAT_UP, SDL_HAT_RIGHT, SDL_HAT_DOWN, SDL_HAT_LEFT, SDL_HAT_RIGHTUP, SDL_HAT_RIGHTDOWN, SDL_HAT_LEFTUP, SDL_HAT_LEFTDOWN

 
 top of page
Method getIndex
Get the instance ID of an opened joystick (SDL_JoystickInstanceID())
Signature
getIndex():int
Returns
int

 
 top of page
Method getName
Query joystick device name
Signature
getName():String
Returns
String

 
 top of page
Method getNumAxes
Query number of joystick axes
Signature
getNumAxes():int
Returns
int

 
 top of page
Method getNumBalls
Query number of trackballs
Signature
getNumBalls():int
Returns
int

 
 top of page
Method getNumButtons
Query number of buttons
Signature
getNumButtons():int
Returns
int

 
 top of page
Method getNumHats
Query number of hats
Signature
getNumHats():int
Returns
int

 
 top of page
Constant SDL_HAT_CENTERED (int)
Constant SDL_HAT_DOWN (int)
Constant SDL_HAT_LEFT (int)
Constant SDL_HAT_LEFTDOWN (int)
Constant SDL_HAT_LEFTUP (int)
Constant SDL_HAT_RIGHT (int)
Constant SDL_HAT_RIGHTDOWN (int)
Constant SDL_HAT_RIGHTUP (int)
Constant SDL_HAT_UP (int)

 

Project Modules:tksdl 
Project Classes:AudioDevice , AudioSample , Cursor , FPS , Joystick , Key , Mouse , SamplePlayer , SDL , Viewport 
Project Functions:MIDINoteToFrequency 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:42:00