Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/improve _sdl2 stubs #3300

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions buildconfig/stubs/pygame/_sdl2/controller.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Controller:
def as_joystick(self) -> JoystickType: ...
def get_axis(self, axis: int) -> int: ...
def get_button(self, button: int) -> bool: ...
def get_mapping(self) -> dict: ...
def set_mapping(self, mapping: dict) -> int: ...
def rumble(self, ___) -> bool: ...
def stop_rumble(
def get_mapping(self) -> dict[str, str]: ...
def set_mapping(self, mapping: dict[str, str]) -> int: ...
def rumble(
self, low_frequency: float, high_frequency: float, duration: int
) -> bool: ...
def stop_rumble(self) -> None: ...
8 changes: 4 additions & 4 deletions buildconfig/stubs/pygame/_sdl2/touch.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Union
from typing import Union, Optional

def get_num_devices() -> int: ...
def get_device(index: int) -> int: ...
def get_num_fingers(device_id: int) -> int: ...
def get_finger(touchid: int, index: int) -> dict[str, Union[int, float]]: ...
def get_device(index: int, /) -> int: ...
def get_num_fingers(device_id: int, /) -> int: ...
def get_finger(touchid: int, index: int) -> Optional[dict[str, Union[int, float]]]: ...
5 changes: 3 additions & 2 deletions docs/reST/ref/touch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@
.. function:: get_finger

| :sl:`get information about an active finger`
| :sg:`get_finger(touchid, index) -> int`
| :sg:`get_finger(touchid, index) -> dict | None`

:param int touchid: The touch device id.
:param int index: The index of the finger to return
information about, between 0 and the
:func:`number of active fingers <pygame._sdl2.touch.get_num_fingers()>`.

Return a dict for the finger ``index`` active on ``touchid``.
Return a dict for the finger ``index`` active on ``touchid``, or ``None`` if the
object does not exist.
The dict contains these keys:

::
Expand Down
2 changes: 1 addition & 1 deletion src_c/doc/touch_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#define DOC_SDL2_TOUCH_GETNUMDEVICES "get_num_devices() -> int\nget the number of touch devices"
#define DOC_SDL2_TOUCH_GETDEVICE "get_device(index) -> touchid\nget the a touch device id for a given index"
#define DOC_SDL2_TOUCH_GETNUMFINGERS "get_num_fingers(touchid) -> int\nthe number of active fingers for a given touch device"
#define DOC_SDL2_TOUCH_GETFINGER "get_finger(touchid, index) -> int\nget information about an active finger"
#define DOC_SDL2_TOUCH_GETFINGER "get_finger(touchid, index) -> dict | None\nget information about an active finger"
Loading