Skip to content

Commit 9a9fa27

Browse files
committed
Clean up docs.
1 parent d5f8663 commit 9a9fa27

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

docs/sdl/joystick.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ tcod.sdl.joystick - SDL Joystick Support
22
========================================
33

44
.. automodule:: tcod.sdl.joystick
5+
:members:
6+
:exclude-members:
7+
Power
8+
9+
.. autoclass:: tcod.sdl.joystick.Power
510
:members:
611
:member-order: bysource

tcod/sdl/joystick.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

tcod/sdl/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class FlashOperation(enum.IntEnum):
8787
CANCEL = 0
8888
"""Stop flashing."""
8989
BRIEFLY = 1
90-
"""Flash breifly."""
90+
"""Flash briefly."""
9191
UNTIL_FOCUSED = 2
9292
"""Flash until focus is gained."""
9393

0 commit comments

Comments
 (0)