@@ -59,15 +59,20 @@ class Joystick:
5959 def __init__ (self , device_index : int ):
6060 tcod .sdl .sys .init (tcod .sdl .sys .Subsystem .JOYSTICK )
6161 self .sdl_joystick_p : Final = _check_p (ffi .gc (lib .SDL_JoystickOpen (device_index ), lib .SDL_JoystickClose ))
62- self .axes : Final = _check (lib .SDL_JoystickNumAxes (self .sdl_joystick_p ))
63- self .balls : Final = _check (lib .SDL_JoystickNumBalls (self .sdl_joystick_p ))
64- self .buttons : Final = _check (lib .SDL_JoystickNumButtons (self .sdl_joystick_p ))
65- self .hats : Final = _check (lib .SDL_JoystickNumHats (self .sdl_joystick_p ))
66- self .name : Final = str (ffi .string (lib .SDL_JoystickName (self .sdl_joystick_p )), encoding = "utf-8" )
62+ """The CFFI pointer to an SDL_Joystick struct."""
63+ self .axes : Final [int ] = _check (lib .SDL_JoystickNumAxes (self .sdl_joystick_p ))
64+ """The total number of axes."""
65+ self .balls : Final [int ] = _check (lib .SDL_JoystickNumBalls (self .sdl_joystick_p ))
66+ """The total number of trackballs."""
67+ self .buttons : Final [int ] = _check (lib .SDL_JoystickNumButtons (self .sdl_joystick_p ))
68+ """The total number of buttons."""
69+ self .hats : Final [int ] = _check (lib .SDL_JoystickNumHats (self .sdl_joystick_p ))
70+ """The total number of hats."""
71+ self .name : Final [str ] = str (ffi .string (lib .SDL_JoystickName (self .sdl_joystick_p )), encoding = "utf-8" )
6772 """The name of this joystick."""
68- self .guid : Final = self ._get_guid ()
73+ self .guid : Final [ str ] = self ._get_guid ()
6974 """The GUID of this joystick."""
70- self .id : Final = _check (lib .SDL_JoystickInstanceID (self .sdl_joystick_p ))
75+ self .id : Final [ int ] = _check (lib .SDL_JoystickInstanceID (self .sdl_joystick_p ))
7176 """The instance ID of this joystick. This is not the same as the device ID."""
7277
7378 def _get_guid (self ) -> str :
0 commit comments