kraken-engine 1.0.0__cp314-cp314-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kraken-engine might be problematic. Click here for more details.
- kraken_engine-1.0.0.dist-info/METADATA +51 -0
- kraken_engine-1.0.0.dist-info/RECORD +24 -0
- kraken_engine-1.0.0.dist-info/WHEEL +6 -0
- kraken_engine-1.0.0.dist-info/licenses/LICENSE +21 -0
- pykraken/__init__.py +1 -0
- pykraken/__init__.pyi +406 -0
- pykraken/__pyinstaller/hook-pykraken.py +8 -0
- pykraken/_core/__init__.pyi +3576 -0
- pykraken/_core/color.pyi +113 -0
- pykraken/_core/draw.pyi +95 -0
- pykraken/_core/ease.pyi +285 -0
- pykraken/_core/event.pyi +15 -0
- pykraken/_core/gamepad.pyi +105 -0
- pykraken/_core/input.pyi +78 -0
- pykraken/_core/key.pyi +73 -0
- pykraken/_core/line.pyi +10 -0
- pykraken/_core/math.pyi +173 -0
- pykraken/_core/mouse.pyi +85 -0
- pykraken/_core/rect.pyi +93 -0
- pykraken/_core/renderer.pyi +63 -0
- pykraken/_core/time.pyi +75 -0
- pykraken/_core/transform.pyi +141 -0
- pykraken/_core/window.pyi +113 -0
- pykraken/_core.cpython-314-darwin.so +0 -0
|
@@ -0,0 +1,3576 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import collections.abc
|
|
3
|
+
import enum
|
|
4
|
+
import typing
|
|
5
|
+
from . import color
|
|
6
|
+
from . import draw
|
|
7
|
+
from . import ease
|
|
8
|
+
from . import event
|
|
9
|
+
from . import gamepad
|
|
10
|
+
from . import input
|
|
11
|
+
from . import key
|
|
12
|
+
from . import line
|
|
13
|
+
from . import math
|
|
14
|
+
from . import mouse
|
|
15
|
+
from . import rect
|
|
16
|
+
from . import renderer
|
|
17
|
+
from . import time
|
|
18
|
+
from . import transform
|
|
19
|
+
from . import window
|
|
20
|
+
__all__: list[str] = ['AUDIO_DEVICE_ADDED', 'AUDIO_DEVICE_FORMAT_CHANGED', 'AUDIO_DEVICE_REMOVED', 'Anchor', 'Animation', 'AnimationController', 'Audio', 'AudioStream', 'BOTTOM_LEFT', 'BOTTOM_MID', 'BOTTOM_RIGHT', 'CAMERA_ADDED', 'CAMERA_APPROVED', 'CAMERA_DENIED', 'CAMERA_REMOVED', 'CENTER', 'C_BACK', 'C_DPAD_DOWN', 'C_DPAD_LEFT', 'C_DPAD_RIGHT', 'C_DPAD_UP', 'C_EAST', 'C_GUIDE', 'C_LSHOULDER', 'C_LSTICK', 'C_LTRIGGER', 'C_LX', 'C_LY', 'C_NORTH', 'C_PS3', 'C_PS4', 'C_PS5', 'C_RSHOULDER', 'C_RSTICK', 'C_RTRIGGER', 'C_RX', 'C_RY', 'C_SOUTH', 'C_STANDARD', 'C_START', 'C_SWITCH_JOYCON_LEFT', 'C_SWITCH_JOYCON_PAIR', 'C_SWITCH_JOYCON_RIGHT', 'C_SWITCH_PRO', 'C_WEST', 'C_XBOX_360', 'C_XBOX_ONE', 'Camera', 'Circle', 'Color', 'DROP_BEGIN', 'DROP_COMPLETE', 'DROP_FILE', 'DROP_POSITION', 'DROP_TEXT', 'EasingAnimation', 'Event', 'EventType', 'Font', 'Frame', 'GAMEPAD_ADDED', 'GAMEPAD_AXIS_MOTION', 'GAMEPAD_BUTTON_DOWN', 'GAMEPAD_BUTTON_UP', 'GAMEPAD_REMOVED', 'GAMEPAD_TOUCHPAD_DOWN', 'GAMEPAD_TOUCHPAD_MOTION', 'GAMEPAD_TOUCHPAD_UP', 'GamepadAxis', 'GamepadButton', 'GamepadType', 'InputAction', 'KEYBOARD_ADDED', 'KEYBOARD_REMOVED', 'KEY_DOWN', 'KEY_UP', 'K_0', 'K_1', 'K_2', 'K_3', 'K_4', 'K_5', 'K_6', 'K_7', 'K_8', 'K_9', 'K_AGAIN', 'K_AMPERSAND', 'K_ASTERISK', 'K_AT', 'K_BACKSLASH', 'K_BACKSPACE', 'K_CAPS', 'K_CARET', 'K_COLON', 'K_COMMA', 'K_COPY', 'K_CUT', 'K_DBLQUOTE', 'K_DEL', 'K_DOLLAR', 'K_DOWN', 'K_END', 'K_EQ', 'K_ESC', 'K_EXCLAIM', 'K_F1', 'K_F10', 'K_F11', 'K_F12', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6', 'K_F7', 'K_F8', 'K_F9', 'K_FIND', 'K_GRAVE', 'K_GT', 'K_HASH', 'K_HOME', 'K_INS', 'K_KP_0', 'K_KP_1', 'K_KP_2', 'K_KP_3', 'K_KP_4', 'K_KP_5', 'K_KP_6', 'K_KP_7', 'K_KP_8', 'K_KP_9', 'K_KP_DIV', 'K_KP_ENTER', 'K_KP_MINUS', 'K_KP_MULT', 'K_KP_PERIOD', 'K_KP_PLUS', 'K_LALT', 'K_LBRACE', 'K_LBRACKET', 'K_LCTRL', 'K_LEFT', 'K_LGUI', 'K_LPAREN', 'K_LSHIFT', 'K_LT', 'K_MINUS', 'K_MUTE', 'K_NUMLOCK', 'K_PASTE', 'K_PAUSE', 'K_PERCENT', 'K_PERIOD', 'K_PGDOWN', 'K_PGUP', 'K_PIPE', 'K_PLUS', 'K_PRTSCR', 'K_QUESTION', 'K_RALT', 'K_RBRACE', 'K_RBRACKET', 'K_RCTRL', 'K_RETURN', 'K_RGUI', 'K_RIGHT', 'K_RPAREN', 'K_RSHIFT', 'K_SCRLK', 'K_SEMICOLON', 'K_SGLQUOTE', 'K_SLASH', 'K_SPACE', 'K_TAB', 'K_TILDE', 'K_UNDERSCORE', 'K_UNDO', 'K_UP', 'K_VOLDOWN', 'K_VOLUP', 'K_a', 'K_b', 'K_c', 'K_d', 'K_e', 'K_f', 'K_g', 'K_h', 'K_i', 'K_j', 'K_k', 'K_l', 'K_m', 'K_n', 'K_o', 'K_p', 'K_q', 'K_r', 'K_s', 'K_t', 'K_u', 'K_v', 'K_w', 'K_x', 'K_y', 'K_z', 'Keycode', 'Layer', 'Line', 'MID_LEFT', 'MID_RIGHT', 'MOUSE_ADDED', 'MOUSE_BUTTON_DOWN', 'MOUSE_BUTTON_UP', 'MOUSE_MOTION', 'MOUSE_REMOVED', 'MOUSE_WHEEL', 'M_LEFT', 'M_MIDDLE', 'M_RIGHT', 'M_SIDE1', 'M_SIDE2', 'Mask', 'MouseButton', 'PEN_AXIS', 'PEN_BUTTON_DOWN', 'PEN_BUTTON_UP', 'PEN_DOWN', 'PEN_MOTION', 'PEN_PROXIMITY_IN', 'PEN_PROXIMITY_OUT', 'PEN_UP', 'P_DISTANCE', 'P_PRESSURE', 'P_ROTATION', 'P_SLIDER', 'P_TANGENTIAL_PRESSURE', 'P_TILT_X', 'P_TILT_Y', 'PenAxis', 'PixelArray', 'PolarCoordinate', 'Polygon', 'QUIT', 'Rect', 'S_0', 'S_1', 'S_2', 'S_3', 'S_4', 'S_5', 'S_6', 'S_7', 'S_8', 'S_9', 'S_AGAIN', 'S_APOSTROPHE', 'S_BACKSLASH', 'S_BACKSPACE', 'S_CAPS', 'S_COMMA', 'S_COPY', 'S_CUT', 'S_DEL', 'S_DOWN', 'S_END', 'S_EQ', 'S_ESC', 'S_F1', 'S_F10', 'S_F11', 'S_F12', 'S_F2', 'S_F3', 'S_F4', 'S_F5', 'S_F6', 'S_F7', 'S_F8', 'S_F9', 'S_FIND', 'S_GRAVE', 'S_HOME', 'S_INS', 'S_KP_0', 'S_KP_1', 'S_KP_2', 'S_KP_3', 'S_KP_4', 'S_KP_5', 'S_KP_6', 'S_KP_7', 'S_KP_8', 'S_KP_9', 'S_KP_DIV', 'S_KP_ENTER', 'S_KP_MINUS', 'S_KP_MULT', 'S_KP_PERIOD', 'S_KP_PLUS', 'S_LALT', 'S_LBRACKET', 'S_LCTRL', 'S_LEFT', 'S_LGUI', 'S_LSHIFT', 'S_MINUS', 'S_MUTE', 'S_NUMLOCK', 'S_PASTE', 'S_PAUSE', 'S_PERIOD', 'S_PGDOWN', 'S_PGUP', 'S_PRTSCR', 'S_RALT', 'S_RBRACKET', 'S_RCTRL', 'S_RETURN', 'S_RGUI', 'S_RIGHT', 'S_RSHIFT', 'S_SCRLK', 'S_SEMICOLON', 'S_SLASH', 'S_SPACE', 'S_TAB', 'S_UNDO', 'S_UP', 'S_VOLDOWN', 'S_VOLUP', 'S_a', 'S_b', 'S_c', 'S_d', 'S_e', 'S_f', 'S_g', 'S_h', 'S_i', 'S_j', 'S_k', 'S_l', 'S_m', 'S_n', 'S_o', 'S_p', 'S_q', 'S_r', 'S_s', 'S_t', 'S_u', 'S_v', 'S_w', 'S_x', 'S_y', 'S_z', 'Scancode', 'TEXT_EDITING', 'TEXT_INPUT', 'TOP_LEFT', 'TOP_MID', 'TOP_RIGHT', 'Texture', 'Tile', 'TileMap', 'Timer', 'Vec2', 'WINDOW_ENTER_FULLSCREEN', 'WINDOW_EXPOSED', 'WINDOW_FOCUS_GAINED', 'WINDOW_FOCUS_LOST', 'WINDOW_HIDDEN', 'WINDOW_LEAVE_FULLSCREEN', 'WINDOW_MAXIMIZED', 'WINDOW_MINIMIZED', 'WINDOW_MOUSE_ENTER', 'WINDOW_MOUSE_LEAVE', 'WINDOW_MOVED', 'WINDOW_OCCLUDED', 'WINDOW_RESIZED', 'WINDOW_RESTORED', 'WINDOW_SHOWN', 'color', 'draw', 'ease', 'event', 'gamepad', 'init', 'input', 'key', 'line', 'math', 'mouse', 'quit', 'rect', 'renderer', 'time', 'transform', 'window']
|
|
21
|
+
class Anchor(enum.IntEnum):
|
|
22
|
+
BOTTOM_LEFT: typing.ClassVar[Anchor] # value = <Anchor.BOTTOM_LEFT: 6>
|
|
23
|
+
BOTTOM_MID: typing.ClassVar[Anchor] # value = <Anchor.BOTTOM_MID: 7>
|
|
24
|
+
BOTTOM_RIGHT: typing.ClassVar[Anchor] # value = <Anchor.BOTTOM_RIGHT: 8>
|
|
25
|
+
CENTER: typing.ClassVar[Anchor] # value = <Anchor.CENTER: 4>
|
|
26
|
+
MID_LEFT: typing.ClassVar[Anchor] # value = <Anchor.MID_LEFT: 3>
|
|
27
|
+
MID_RIGHT: typing.ClassVar[Anchor] # value = <Anchor.MID_RIGHT: 5>
|
|
28
|
+
TOP_LEFT: typing.ClassVar[Anchor] # value = <Anchor.TOP_LEFT: 0>
|
|
29
|
+
TOP_MID: typing.ClassVar[Anchor] # value = <Anchor.TOP_MID: 1>
|
|
30
|
+
TOP_RIGHT: typing.ClassVar[Anchor] # value = <Anchor.TOP_RIGHT: 2>
|
|
31
|
+
@classmethod
|
|
32
|
+
def __new__(cls, value):
|
|
33
|
+
...
|
|
34
|
+
def __format__(self, format_spec):
|
|
35
|
+
"""
|
|
36
|
+
Convert to a string according to format_spec.
|
|
37
|
+
"""
|
|
38
|
+
class Animation:
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
A complete animation sequence with frames and playback settings.
|
|
42
|
+
|
|
43
|
+
Contains a sequence of frames and the frames per second (FPS) rate for playback timing.
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
@property
|
|
47
|
+
def fps(self) -> int:
|
|
48
|
+
"""
|
|
49
|
+
The frames per second rate for animation playback.
|
|
50
|
+
"""
|
|
51
|
+
@property
|
|
52
|
+
def frames(self) -> list[Frame]:
|
|
53
|
+
"""
|
|
54
|
+
The list of frames in the animation sequence.
|
|
55
|
+
"""
|
|
56
|
+
class AnimationController:
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
Manages and controls sprite animations with multiple animation sequences.
|
|
60
|
+
|
|
61
|
+
The AnimationController handles loading animations from sprite sheets or image folders,
|
|
62
|
+
managing playback state, and providing frame-by-frame animation control.
|
|
63
|
+
|
|
64
|
+
"""
|
|
65
|
+
def __init__(self) -> None:
|
|
66
|
+
...
|
|
67
|
+
def is_finished(self) -> bool:
|
|
68
|
+
"""
|
|
69
|
+
Check if the animation completed a full loop during the last update.
|
|
70
|
+
|
|
71
|
+
Returns True if the animation looped back to the beginning during the most recent
|
|
72
|
+
frame update. This method is const and can be called multiple times per frame
|
|
73
|
+
with consistent results.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
bool: True if the animation completed a loop during the last update.
|
|
77
|
+
"""
|
|
78
|
+
def load_folder(self, name: str, dir_path: str, fps: typing.SupportsInt) -> None:
|
|
79
|
+
"""
|
|
80
|
+
Load animation frames from a directory of image files.
|
|
81
|
+
|
|
82
|
+
Loads all valid image files from the specified directory as animation frames.
|
|
83
|
+
Supported formats include PNG, JPG, JPEG, BMP, TGA, and GIF.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
name (str): Unique identifier for the animation.
|
|
87
|
+
dir_path (str): Path to the directory containing image files.
|
|
88
|
+
fps (int): Frames per second for playback timing.
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
RuntimeError: If no valid image files are found in the directory.
|
|
92
|
+
"""
|
|
93
|
+
def load_sprite_sheet(self, name: str, file_path: str, frame_size: Vec2, fps: typing.SupportsInt) -> None:
|
|
94
|
+
"""
|
|
95
|
+
Load animation frames from a sprite sheet texture.
|
|
96
|
+
|
|
97
|
+
Divides the sprite sheet into equal-sized frames based on the specified frame size.
|
|
98
|
+
The frames are read left-to-right, top-to-bottom.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
name (str): Unique identifier for the animation.
|
|
102
|
+
file_path (str): Path to the sprite sheet image file.
|
|
103
|
+
frame_size (Vec2): Size of each frame as (width, height).
|
|
104
|
+
fps (int): Frames per second for playback timing.
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
RuntimeError: If sprite sheet dimensions are not divisible by frame dimensions,
|
|
108
|
+
or no frames are found.
|
|
109
|
+
"""
|
|
110
|
+
def pause(self) -> None:
|
|
111
|
+
"""
|
|
112
|
+
Pause the animation playback.
|
|
113
|
+
|
|
114
|
+
Stops animation frame advancement while preserving the current frame position.
|
|
115
|
+
"""
|
|
116
|
+
def remove(self, name: str) -> None:
|
|
117
|
+
"""
|
|
118
|
+
Remove an animation from the controller.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
name (str): The name of the animation to remove.
|
|
122
|
+
|
|
123
|
+
Note:
|
|
124
|
+
If the removed animation is currently active, the controller will be left
|
|
125
|
+
without a current animation.
|
|
126
|
+
"""
|
|
127
|
+
def resume(self) -> None:
|
|
128
|
+
"""
|
|
129
|
+
Resume paused animation playback.
|
|
130
|
+
|
|
131
|
+
Resumes animation frame advancement if the playback speed is greater than 0.
|
|
132
|
+
Does nothing if the animation is already playing or playback speed is 0.
|
|
133
|
+
"""
|
|
134
|
+
def rewind(self) -> None:
|
|
135
|
+
"""
|
|
136
|
+
Reset the animation to the beginning.
|
|
137
|
+
|
|
138
|
+
Sets the animation back to frame 0 and resets loop detection state.
|
|
139
|
+
"""
|
|
140
|
+
def set(self, name: str, rewind: bool = False) -> None:
|
|
141
|
+
"""
|
|
142
|
+
Set the current active animation by name.
|
|
143
|
+
|
|
144
|
+
Switches to the specified animation and resets playback to the beginning.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
name (str): The name of the animation to activate.
|
|
148
|
+
rewind (bool): Whether to rewind the animation to the start.
|
|
149
|
+
|
|
150
|
+
Raises:
|
|
151
|
+
ValueError: If the specified animation name is not found.
|
|
152
|
+
"""
|
|
153
|
+
@property
|
|
154
|
+
def current_animation_name(self) -> str:
|
|
155
|
+
"""
|
|
156
|
+
The name of the currently active animation.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
str: The name of the current animation, or empty string if none is set.
|
|
160
|
+
"""
|
|
161
|
+
@property
|
|
162
|
+
def current_frame(self) -> Frame:
|
|
163
|
+
"""
|
|
164
|
+
The current animation frame being displayed.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Frame: The current frame with texture and rectangle data.
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
RuntimeError: If no animation is currently set or the animation has no frames.
|
|
171
|
+
"""
|
|
172
|
+
@property
|
|
173
|
+
def playback_speed(self) -> float:
|
|
174
|
+
"""
|
|
175
|
+
The playback speed multiplier for animation timing.
|
|
176
|
+
|
|
177
|
+
A value of 1.0 represents normal speed, 2.0 is double speed, 0.5 is half speed.
|
|
178
|
+
Setting to 0 will pause the animation.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
float: The current playback speed multiplier.
|
|
182
|
+
"""
|
|
183
|
+
@playback_speed.setter
|
|
184
|
+
def playback_speed(self, arg1: typing.SupportsFloat) -> None:
|
|
185
|
+
...
|
|
186
|
+
class Audio:
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
A decoded audio object that supports multiple simultaneous playbacks.
|
|
190
|
+
|
|
191
|
+
Audio objects decode the entire file into memory for low-latency playback. They support
|
|
192
|
+
multiple concurrent playbacks of the same sound. Use this for short sound effects that may need to overlap.
|
|
193
|
+
|
|
194
|
+
"""
|
|
195
|
+
def __init__(self, file_path: str, volume: typing.SupportsFloat = 1.0) -> None:
|
|
196
|
+
"""
|
|
197
|
+
Create an Audio object from a file path with optional volume.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
file_path (str): Path to the audio file to load.
|
|
201
|
+
volume (float, optional): Initial volume level (0.0 to 1.0+). Defaults to 1.0.
|
|
202
|
+
|
|
203
|
+
Raises:
|
|
204
|
+
RuntimeError: If the audio file cannot be loaded or decoded.
|
|
205
|
+
"""
|
|
206
|
+
def play(self, fade_in_ms: typing.SupportsInt = 0, loop: bool = False) -> None:
|
|
207
|
+
"""
|
|
208
|
+
Play the audio with optional fade-in time and loop setting.
|
|
209
|
+
|
|
210
|
+
Creates a new voice for playback, allowing multiple simultaneous plays of the same audio.
|
|
211
|
+
Each play instance is independent and can have different fade and loop settings.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
fade_in_ms (int, optional): Fade-in duration in milliseconds. Defaults to 0.
|
|
215
|
+
loop (bool, optional): Whether to loop the audio continuously. Defaults to False.
|
|
216
|
+
|
|
217
|
+
Raises:
|
|
218
|
+
RuntimeError: If audio playback initialization fails.
|
|
219
|
+
"""
|
|
220
|
+
def stop(self, fade_out_ms: typing.SupportsInt = 0) -> None:
|
|
221
|
+
"""
|
|
222
|
+
Stop all active playbacks of this audio.
|
|
223
|
+
|
|
224
|
+
Stops all currently playing voices associated with this Audio object. If a fade-out
|
|
225
|
+
time is specified, all voices will fade out over that duration before stopping.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
fade_out_ms (int, optional): Fade-out duration in milliseconds. Defaults to 0.
|
|
229
|
+
"""
|
|
230
|
+
@property
|
|
231
|
+
def volume(self) -> float:
|
|
232
|
+
"""
|
|
233
|
+
The volume level for new and existing playbacks.
|
|
234
|
+
|
|
235
|
+
Setting this property affects all currently playing voices and sets the default
|
|
236
|
+
volume for future playbacks. Volume can exceed 1.0 for amplification.
|
|
237
|
+
|
|
238
|
+
Type:
|
|
239
|
+
float: Volume level (0.0 = silent, 1.0 = original volume, >1.0 = amplified).
|
|
240
|
+
"""
|
|
241
|
+
@volume.setter
|
|
242
|
+
def volume(self, arg1: typing.SupportsFloat) -> None:
|
|
243
|
+
...
|
|
244
|
+
class AudioStream:
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
A streaming audio object for single-instance playback of large audio files.
|
|
248
|
+
|
|
249
|
+
AudioStream objects stream audio data from disk during playback, using minimal memory.
|
|
250
|
+
They support only one playback instance at a time, making them ideal for background
|
|
251
|
+
music, long audio tracks, or when memory usage is a concern.
|
|
252
|
+
|
|
253
|
+
"""
|
|
254
|
+
def __init__(self, file_path: str, volume: typing.SupportsFloat = 1.0) -> None:
|
|
255
|
+
"""
|
|
256
|
+
Create an AudioStream object from a file path with optional volume.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
file_path (str): Path to the audio file to stream.
|
|
260
|
+
volume (float, optional): Initial volume level (0.0 to 1.0+). Defaults to 1.0.
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
RuntimeError: If the audio file cannot be opened for streaming.
|
|
264
|
+
"""
|
|
265
|
+
def pause(self) -> None:
|
|
266
|
+
"""
|
|
267
|
+
Pause the audio stream playback.
|
|
268
|
+
|
|
269
|
+
The stream position is preserved and can be resumed with resume().
|
|
270
|
+
"""
|
|
271
|
+
def play(self, fade_in_ms: typing.SupportsInt = 0, loop: bool = False) -> None:
|
|
272
|
+
"""
|
|
273
|
+
Play the audio stream with optional fade-in time and loop setting.
|
|
274
|
+
|
|
275
|
+
Rewinds the stream to the beginning and starts playback. If the stream is already
|
|
276
|
+
playing, it will restart from the beginning.
|
|
277
|
+
|
|
278
|
+
Args:
|
|
279
|
+
fade_in_ms (int, optional): Fade-in duration in milliseconds. Defaults to 0.
|
|
280
|
+
loop (bool, optional): Whether to loop the audio continuously. Defaults to False.
|
|
281
|
+
"""
|
|
282
|
+
def resume(self) -> None:
|
|
283
|
+
"""
|
|
284
|
+
Resume paused audio stream playback.
|
|
285
|
+
|
|
286
|
+
Continues playback from the current stream position.
|
|
287
|
+
"""
|
|
288
|
+
def rewind(self) -> None:
|
|
289
|
+
"""
|
|
290
|
+
Rewind the audio stream to the beginning.
|
|
291
|
+
|
|
292
|
+
Sets the playback position back to the start of the audio file. Does not affect
|
|
293
|
+
the current play state (playing/paused).
|
|
294
|
+
"""
|
|
295
|
+
def set_looping(self, loop: bool) -> None:
|
|
296
|
+
"""
|
|
297
|
+
Set whether the audio stream loops continuously.
|
|
298
|
+
|
|
299
|
+
Args:
|
|
300
|
+
loop (bool): True to enable looping, False to disable.
|
|
301
|
+
"""
|
|
302
|
+
def stop(self, fade_out_ms: typing.SupportsInt = 0) -> None:
|
|
303
|
+
"""
|
|
304
|
+
Stop the audio stream playback.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
fade_out_ms (int, optional): Fade-out duration in milliseconds. If 0, stops immediately.
|
|
308
|
+
If > 0, fades out over the specified duration. Defaults to 0.
|
|
309
|
+
"""
|
|
310
|
+
@property
|
|
311
|
+
def volume(self) -> float:
|
|
312
|
+
"""
|
|
313
|
+
The volume level of the audio stream.
|
|
314
|
+
|
|
315
|
+
Volume can exceed 1.0 for amplification.
|
|
316
|
+
|
|
317
|
+
Type:
|
|
318
|
+
float: Volume level (0.0 = silent, 1.0 = original volume, >1.0 = amplified).
|
|
319
|
+
"""
|
|
320
|
+
@volume.setter
|
|
321
|
+
def volume(self, arg1: typing.SupportsFloat) -> None:
|
|
322
|
+
...
|
|
323
|
+
class Camera:
|
|
324
|
+
"""
|
|
325
|
+
|
|
326
|
+
Represents a 2D camera used for rendering.
|
|
327
|
+
|
|
328
|
+
Controls the viewport's translation, allowing you to move the view of the world.
|
|
329
|
+
|
|
330
|
+
"""
|
|
331
|
+
@typing.overload
|
|
332
|
+
def __init__(self) -> None:
|
|
333
|
+
"""
|
|
334
|
+
Create a camera at the default position (0, 0).
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
Camera: A new camera instance.
|
|
338
|
+
"""
|
|
339
|
+
@typing.overload
|
|
340
|
+
def __init__(self, pos: Vec2) -> None:
|
|
341
|
+
"""
|
|
342
|
+
Create a camera at the given position.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
pos (Vec2): The camera's initial position.
|
|
346
|
+
"""
|
|
347
|
+
@typing.overload
|
|
348
|
+
def __init__(self, x: typing.SupportsFloat, y: typing.SupportsFloat) -> None:
|
|
349
|
+
"""
|
|
350
|
+
Create a camera at the given position.
|
|
351
|
+
|
|
352
|
+
Args:
|
|
353
|
+
x (float): The x-coordinate of the camera's initial position.
|
|
354
|
+
y (float): The y-coordinate of the camera's initial position.
|
|
355
|
+
"""
|
|
356
|
+
def set(self) -> None:
|
|
357
|
+
"""
|
|
358
|
+
Set this camera as the active one for rendering.
|
|
359
|
+
|
|
360
|
+
Only one camera can be active at a time.
|
|
361
|
+
"""
|
|
362
|
+
@property
|
|
363
|
+
def pos(self) -> Vec2:
|
|
364
|
+
"""
|
|
365
|
+
Get or set the camera's position.
|
|
366
|
+
|
|
367
|
+
Returns:
|
|
368
|
+
Vec2: The camera's current position.
|
|
369
|
+
|
|
370
|
+
You can also assign a Vec2 or a (x, y) sequence to set the position.
|
|
371
|
+
"""
|
|
372
|
+
@pos.setter
|
|
373
|
+
def pos(self, arg1: Vec2) -> None:
|
|
374
|
+
...
|
|
375
|
+
class Circle:
|
|
376
|
+
"""
|
|
377
|
+
|
|
378
|
+
Represents a circle shape with position and radius.
|
|
379
|
+
|
|
380
|
+
Supports collision detection with points, rectangles, other circles, and lines.
|
|
381
|
+
|
|
382
|
+
"""
|
|
383
|
+
__hash__: typing.ClassVar[None] = None
|
|
384
|
+
def __eq__(self, other: Circle) -> bool:
|
|
385
|
+
"""
|
|
386
|
+
Check if two circles are equal.
|
|
387
|
+
"""
|
|
388
|
+
def __getitem__(self, index: typing.SupportsInt) -> float:
|
|
389
|
+
"""
|
|
390
|
+
Get component by index: 0 = x, 1 = y, 2 = radius.
|
|
391
|
+
"""
|
|
392
|
+
@typing.overload
|
|
393
|
+
def __init__(self, pos: Vec2, radius: typing.SupportsFloat) -> None:
|
|
394
|
+
"""
|
|
395
|
+
Create a circle at a given position and radius.
|
|
396
|
+
|
|
397
|
+
Args:
|
|
398
|
+
pos (Vec2): Center position of the circle.
|
|
399
|
+
radius (float): Radius of the circle.
|
|
400
|
+
"""
|
|
401
|
+
@typing.overload
|
|
402
|
+
def __init__(self, arg0: collections.abc.Sequence) -> None:
|
|
403
|
+
"""
|
|
404
|
+
Create a circle from a nested sequence: ([x, y], radius).
|
|
405
|
+
"""
|
|
406
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
407
|
+
"""
|
|
408
|
+
Return an iterator over (x, y, radius).
|
|
409
|
+
"""
|
|
410
|
+
def __len__(self) -> int:
|
|
411
|
+
"""
|
|
412
|
+
Always returns 3 for (x, y, radius).
|
|
413
|
+
"""
|
|
414
|
+
def __ne__(self, other: Circle) -> bool:
|
|
415
|
+
"""
|
|
416
|
+
Check if two circles are not equal.
|
|
417
|
+
"""
|
|
418
|
+
def as_rect(self) -> Rect:
|
|
419
|
+
"""
|
|
420
|
+
Return the smallest rectangle that fully contains the circle.
|
|
421
|
+
"""
|
|
422
|
+
def collide_circle(self, circle: Circle) -> bool:
|
|
423
|
+
"""
|
|
424
|
+
Check collision with another circle.
|
|
425
|
+
|
|
426
|
+
Args:
|
|
427
|
+
circle (Circle): The circle to test.
|
|
428
|
+
"""
|
|
429
|
+
def collide_line(self, line: Line) -> bool:
|
|
430
|
+
"""
|
|
431
|
+
Check collision with a line.
|
|
432
|
+
|
|
433
|
+
Args:
|
|
434
|
+
line (Line): The line to test.
|
|
435
|
+
"""
|
|
436
|
+
def collide_point(self, point: Vec2) -> bool:
|
|
437
|
+
"""
|
|
438
|
+
Check if a point lies inside the circle.
|
|
439
|
+
|
|
440
|
+
Args:
|
|
441
|
+
point (Vec2): The point to test.
|
|
442
|
+
"""
|
|
443
|
+
def collide_rect(self, rect: Rect) -> bool:
|
|
444
|
+
"""
|
|
445
|
+
Check collision with a rectangle.
|
|
446
|
+
|
|
447
|
+
Args:
|
|
448
|
+
rect (Rect): The rectangle to test.
|
|
449
|
+
"""
|
|
450
|
+
def contains(self, shape: typing.Any) -> bool:
|
|
451
|
+
"""
|
|
452
|
+
Check if the circle fully contains the given shape.
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
shape (Vec2, Circle, or Rect): The shape to test.
|
|
456
|
+
"""
|
|
457
|
+
def copy(self) -> Circle:
|
|
458
|
+
"""
|
|
459
|
+
Return a copy of the circle.
|
|
460
|
+
"""
|
|
461
|
+
@property
|
|
462
|
+
def area(self) -> float:
|
|
463
|
+
"""
|
|
464
|
+
Return the area of the circle.
|
|
465
|
+
"""
|
|
466
|
+
@property
|
|
467
|
+
def circumference(self) -> float:
|
|
468
|
+
"""
|
|
469
|
+
Return the circumference of the circle.
|
|
470
|
+
"""
|
|
471
|
+
@property
|
|
472
|
+
def pos(self) -> Vec2:
|
|
473
|
+
"""
|
|
474
|
+
The center position of the circle as a Vec2.
|
|
475
|
+
"""
|
|
476
|
+
@pos.setter
|
|
477
|
+
def pos(self, arg0: Vec2) -> None:
|
|
478
|
+
...
|
|
479
|
+
@property
|
|
480
|
+
def radius(self) -> float:
|
|
481
|
+
"""
|
|
482
|
+
The radius of the circle.
|
|
483
|
+
"""
|
|
484
|
+
@radius.setter
|
|
485
|
+
def radius(self, arg0: typing.SupportsFloat) -> None:
|
|
486
|
+
...
|
|
487
|
+
class Color:
|
|
488
|
+
"""
|
|
489
|
+
|
|
490
|
+
Represents an RGBA color.
|
|
491
|
+
|
|
492
|
+
Each channel (r, g, b, a) is an 8-bit unsigned integer.
|
|
493
|
+
|
|
494
|
+
"""
|
|
495
|
+
__hash__: typing.ClassVar[None] = None
|
|
496
|
+
def __eq__(self, other: Color) -> bool:
|
|
497
|
+
"""
|
|
498
|
+
Check if two Color objects are equal (all RGBA components match).
|
|
499
|
+
|
|
500
|
+
Args:
|
|
501
|
+
other (Color): The color to compare with.
|
|
502
|
+
|
|
503
|
+
Returns:
|
|
504
|
+
bool: True if colors are identical, False otherwise.
|
|
505
|
+
"""
|
|
506
|
+
def __getitem__(self, index: typing.SupportsInt) -> int:
|
|
507
|
+
"""
|
|
508
|
+
Access color channels by index.
|
|
509
|
+
|
|
510
|
+
Args:
|
|
511
|
+
index (int): Channel index (0=r, 1=g, 2=b, 3=a).
|
|
512
|
+
|
|
513
|
+
Returns:
|
|
514
|
+
int: Channel value (0-255).
|
|
515
|
+
|
|
516
|
+
Raises:
|
|
517
|
+
IndexError: If index is not in range [0, 3].
|
|
518
|
+
"""
|
|
519
|
+
@typing.overload
|
|
520
|
+
def __init__(self) -> None:
|
|
521
|
+
"""
|
|
522
|
+
Create a Color with default values (0, 0, 0, 255).
|
|
523
|
+
"""
|
|
524
|
+
@typing.overload
|
|
525
|
+
def __init__(self, r: typing.SupportsInt, g: typing.SupportsInt, b: typing.SupportsInt, a: typing.SupportsInt = 255) -> None:
|
|
526
|
+
"""
|
|
527
|
+
Create a Color from RGBA components.
|
|
528
|
+
|
|
529
|
+
Args:
|
|
530
|
+
r (int): Red value [0-255].
|
|
531
|
+
g (int): Green value [0-255].
|
|
532
|
+
b (int): Blue value [0-255].
|
|
533
|
+
a (int, optional): Alpha value [0-255]. Defaults to 255.
|
|
534
|
+
"""
|
|
535
|
+
@typing.overload
|
|
536
|
+
def __init__(self, arg0: typing.Any) -> None:
|
|
537
|
+
"""
|
|
538
|
+
Create a Color from a hex string or a sequence of RGB(A) integers.
|
|
539
|
+
|
|
540
|
+
Examples:
|
|
541
|
+
Color("#ff00ff")
|
|
542
|
+
Color([255, 0, 255])
|
|
543
|
+
Color((255, 0, 255, 128))
|
|
544
|
+
"""
|
|
545
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
546
|
+
"""
|
|
547
|
+
Return an iterator over color channels.
|
|
548
|
+
|
|
549
|
+
Yields:
|
|
550
|
+
int: The r, g, b, a values in that order (0-255 each).
|
|
551
|
+
|
|
552
|
+
Example:
|
|
553
|
+
for channel in color:
|
|
554
|
+
print(channel) # Prints r, g, b, a values
|
|
555
|
+
"""
|
|
556
|
+
def __len__(self) -> int:
|
|
557
|
+
"""
|
|
558
|
+
Return the number of color channels.
|
|
559
|
+
|
|
560
|
+
Returns:
|
|
561
|
+
int: Always returns 4 (for r, g, b, a channels).
|
|
562
|
+
"""
|
|
563
|
+
def __ne__(self, other: Color) -> bool:
|
|
564
|
+
"""
|
|
565
|
+
Check if two Color objects are not equal.
|
|
566
|
+
|
|
567
|
+
Args:
|
|
568
|
+
other (Color): The color to compare with.
|
|
569
|
+
|
|
570
|
+
Returns:
|
|
571
|
+
bool: True if any component differs, False otherwise.
|
|
572
|
+
"""
|
|
573
|
+
def __repr__(self) -> str:
|
|
574
|
+
"""
|
|
575
|
+
Return a string suitable for debugging and recreation.
|
|
576
|
+
|
|
577
|
+
Returns:
|
|
578
|
+
str: String in format "Color(r, g, b, a)" that can recreate the object.
|
|
579
|
+
"""
|
|
580
|
+
def __setitem__(self, index: typing.SupportsInt, value: typing.SupportsInt) -> None:
|
|
581
|
+
"""
|
|
582
|
+
Set a color channel by index.
|
|
583
|
+
|
|
584
|
+
Args:
|
|
585
|
+
index (int): Channel index (0=r, 1=g, 2=b, 3=a).
|
|
586
|
+
value (int): New channel value (0-255).
|
|
587
|
+
|
|
588
|
+
Raises:
|
|
589
|
+
IndexError: If index is not in range [0, 3].
|
|
590
|
+
"""
|
|
591
|
+
def __str__(self) -> str:
|
|
592
|
+
"""
|
|
593
|
+
Return a human-readable string representation.
|
|
594
|
+
|
|
595
|
+
Returns:
|
|
596
|
+
str: String in format "(r, g, b, a)" with integer values.
|
|
597
|
+
"""
|
|
598
|
+
def copy(self) -> Color:
|
|
599
|
+
"""
|
|
600
|
+
Create a copy of the color.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
Color: A new Color object with the same RGBA values.
|
|
604
|
+
"""
|
|
605
|
+
@property
|
|
606
|
+
def a(self) -> int:
|
|
607
|
+
"""
|
|
608
|
+
Alpha (transparency) channel value.
|
|
609
|
+
|
|
610
|
+
Type: int
|
|
611
|
+
Range: 0-255 (8-bit unsigned integer)
|
|
612
|
+
Note: 0 = fully transparent, 255 = fully opaque
|
|
613
|
+
"""
|
|
614
|
+
@a.setter
|
|
615
|
+
def a(self, arg0: typing.SupportsInt) -> None:
|
|
616
|
+
...
|
|
617
|
+
@property
|
|
618
|
+
def b(self) -> int:
|
|
619
|
+
"""
|
|
620
|
+
Blue channel value.
|
|
621
|
+
|
|
622
|
+
Type: int
|
|
623
|
+
Range: 0-255 (8-bit unsigned integer)
|
|
624
|
+
"""
|
|
625
|
+
@b.setter
|
|
626
|
+
def b(self, arg0: typing.SupportsInt) -> None:
|
|
627
|
+
...
|
|
628
|
+
@property
|
|
629
|
+
def g(self) -> int:
|
|
630
|
+
"""
|
|
631
|
+
Green channel value.
|
|
632
|
+
|
|
633
|
+
Type: int
|
|
634
|
+
Range: 0-255 (8-bit unsigned integer)
|
|
635
|
+
"""
|
|
636
|
+
@g.setter
|
|
637
|
+
def g(self, arg0: typing.SupportsInt) -> None:
|
|
638
|
+
...
|
|
639
|
+
@property
|
|
640
|
+
def hex(self) -> str:
|
|
641
|
+
"""
|
|
642
|
+
Get or set the color as a hex string.
|
|
643
|
+
|
|
644
|
+
When getting, returns an 8-digit hex string in the format "#RRGGBBAA".
|
|
645
|
+
When setting, accepts various hex formats (see from_hex for details).
|
|
646
|
+
|
|
647
|
+
Example:
|
|
648
|
+
color.hex = "#FF00FF" # Set to magenta
|
|
649
|
+
print(color.hex) # Returns "#FF00FFFF"
|
|
650
|
+
"""
|
|
651
|
+
@hex.setter
|
|
652
|
+
def hex(self, arg1: str) -> None:
|
|
653
|
+
...
|
|
654
|
+
@property
|
|
655
|
+
def hsv(self) -> tuple[float, float, float, float]:
|
|
656
|
+
"""
|
|
657
|
+
Get or set the color as an HSV tuple.
|
|
658
|
+
|
|
659
|
+
When getting, returns a tuple of (hue, saturation, value, alpha).
|
|
660
|
+
When setting, accepts a tuple of 3 or 4 values.
|
|
661
|
+
|
|
662
|
+
Values:
|
|
663
|
+
hue (float): Hue angle in degrees (0-360)
|
|
664
|
+
saturation (float): Saturation level (0-1)
|
|
665
|
+
value (float): Brightness/value level (0-1)
|
|
666
|
+
alpha (float): Alpha transparency (0-1), optional
|
|
667
|
+
|
|
668
|
+
Example:
|
|
669
|
+
color.hsv = (120, 1.0, 1.0) # Pure green
|
|
670
|
+
color.hsv = (240, 0.5, 0.8, 0.9) # Light blue with transparency
|
|
671
|
+
h, s, v, a = color.hsv # Get HSV values
|
|
672
|
+
"""
|
|
673
|
+
@hsv.setter
|
|
674
|
+
def hsv(self, arg1: collections.abc.Sequence) -> None:
|
|
675
|
+
...
|
|
676
|
+
@property
|
|
677
|
+
def r(self) -> int:
|
|
678
|
+
"""
|
|
679
|
+
Red channel value.
|
|
680
|
+
|
|
681
|
+
Type: int
|
|
682
|
+
Range: 0-255 (8-bit unsigned integer)
|
|
683
|
+
"""
|
|
684
|
+
@r.setter
|
|
685
|
+
def r(self, arg0: typing.SupportsInt) -> None:
|
|
686
|
+
...
|
|
687
|
+
class EasingAnimation:
|
|
688
|
+
"""
|
|
689
|
+
|
|
690
|
+
A class for animating values over time using easing functions.
|
|
691
|
+
|
|
692
|
+
This class supports pausing, resuming, reversing, and checking progress.
|
|
693
|
+
|
|
694
|
+
"""
|
|
695
|
+
def __init__(self, start: Vec2, end: Vec2, duration: typing.SupportsFloat, ease_func: collections.abc.Callable[[typing.SupportsFloat], float]) -> None:
|
|
696
|
+
"""
|
|
697
|
+
Create an EasingAnimation.
|
|
698
|
+
|
|
699
|
+
Args:
|
|
700
|
+
start (Vec2): Starting position.
|
|
701
|
+
end (Vec2): Ending position.
|
|
702
|
+
duration (float): Time in seconds for full animation.
|
|
703
|
+
ease_func (Callable): Easing function that maps [0, 1] → [0, 1].
|
|
704
|
+
"""
|
|
705
|
+
def pause(self) -> None:
|
|
706
|
+
"""
|
|
707
|
+
Pause the animation's progression.
|
|
708
|
+
"""
|
|
709
|
+
def restart(self) -> None:
|
|
710
|
+
"""
|
|
711
|
+
Restart the animation from the beginning.
|
|
712
|
+
"""
|
|
713
|
+
def resume(self) -> None:
|
|
714
|
+
"""
|
|
715
|
+
Resume the animation from its current state.
|
|
716
|
+
"""
|
|
717
|
+
def reverse(self) -> None:
|
|
718
|
+
"""
|
|
719
|
+
Reverse the direction of the animation.
|
|
720
|
+
"""
|
|
721
|
+
def step(self) -> Vec2:
|
|
722
|
+
"""
|
|
723
|
+
Advance the animation get its current position.
|
|
724
|
+
|
|
725
|
+
Returns:
|
|
726
|
+
Vec2: Interpolated position.
|
|
727
|
+
"""
|
|
728
|
+
@property
|
|
729
|
+
def is_done(self) -> bool:
|
|
730
|
+
"""
|
|
731
|
+
Check whether the animation has finished.
|
|
732
|
+
"""
|
|
733
|
+
class Event:
|
|
734
|
+
"""
|
|
735
|
+
|
|
736
|
+
Represents a single input event such as keyboard, mouse, or gamepad activity.
|
|
737
|
+
|
|
738
|
+
Attributes:
|
|
739
|
+
type (int): Event type. Additional fields are accessed dynamically.
|
|
740
|
+
|
|
741
|
+
"""
|
|
742
|
+
def __getattr__(self, arg0: str) -> typing.Any:
|
|
743
|
+
"""
|
|
744
|
+
Dynamically access event attributes.
|
|
745
|
+
|
|
746
|
+
Examples:
|
|
747
|
+
event.key
|
|
748
|
+
event.button
|
|
749
|
+
event.pos
|
|
750
|
+
|
|
751
|
+
Raises:
|
|
752
|
+
AttributeError: If the requested attribute doesn't exist.
|
|
753
|
+
"""
|
|
754
|
+
@property
|
|
755
|
+
def type(self) -> int:
|
|
756
|
+
"""
|
|
757
|
+
The event type (e.g., KEY_DOWN, MOUSE_BUTTON_UP).
|
|
758
|
+
"""
|
|
759
|
+
class EventType(enum.IntEnum):
|
|
760
|
+
AUDIO_DEVICE_ADDED: typing.ClassVar[EventType] # value = <EventType.AUDIO_DEVICE_ADDED: 4352>
|
|
761
|
+
AUDIO_DEVICE_FORMAT_CHANGED: typing.ClassVar[EventType] # value = <EventType.AUDIO_DEVICE_FORMAT_CHANGED: 4354>
|
|
762
|
+
AUDIO_DEVICE_REMOVED: typing.ClassVar[EventType] # value = <EventType.AUDIO_DEVICE_REMOVED: 4353>
|
|
763
|
+
CAMERA_ADDED: typing.ClassVar[EventType] # value = <EventType.CAMERA_ADDED: 5120>
|
|
764
|
+
CAMERA_APPROVED: typing.ClassVar[EventType] # value = <EventType.CAMERA_APPROVED: 5122>
|
|
765
|
+
CAMERA_DENIED: typing.ClassVar[EventType] # value = <EventType.CAMERA_DENIED: 5123>
|
|
766
|
+
CAMERA_REMOVED: typing.ClassVar[EventType] # value = <EventType.CAMERA_REMOVED: 5121>
|
|
767
|
+
DROP_BEGIN: typing.ClassVar[EventType] # value = <EventType.DROP_BEGIN: 4098>
|
|
768
|
+
DROP_COMPLETE: typing.ClassVar[EventType] # value = <EventType.DROP_COMPLETE: 4099>
|
|
769
|
+
DROP_FILE: typing.ClassVar[EventType] # value = <EventType.DROP_FILE: 4096>
|
|
770
|
+
DROP_POSITION: typing.ClassVar[EventType] # value = <EventType.DROP_POSITION: 4100>
|
|
771
|
+
DROP_TEXT: typing.ClassVar[EventType] # value = <EventType.DROP_TEXT: 4097>
|
|
772
|
+
GAMEPAD_ADDED: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_ADDED: 1619>
|
|
773
|
+
GAMEPAD_AXIS_MOTION: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_AXIS_MOTION: 1616>
|
|
774
|
+
GAMEPAD_BUTTON_DOWN: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_BUTTON_DOWN: 1617>
|
|
775
|
+
GAMEPAD_BUTTON_UP: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_BUTTON_UP: 1618>
|
|
776
|
+
GAMEPAD_REMOVED: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_REMOVED: 1620>
|
|
777
|
+
GAMEPAD_TOUCHPAD_DOWN: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_TOUCHPAD_DOWN: 1622>
|
|
778
|
+
GAMEPAD_TOUCHPAD_MOTION: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_TOUCHPAD_MOTION: 1623>
|
|
779
|
+
GAMEPAD_TOUCHPAD_UP: typing.ClassVar[EventType] # value = <EventType.GAMEPAD_TOUCHPAD_UP: 1624>
|
|
780
|
+
KEYBOARD_ADDED: typing.ClassVar[EventType] # value = <EventType.KEYBOARD_ADDED: 773>
|
|
781
|
+
KEYBOARD_REMOVED: typing.ClassVar[EventType] # value = <EventType.KEYBOARD_REMOVED: 774>
|
|
782
|
+
KEY_DOWN: typing.ClassVar[EventType] # value = <EventType.KEY_DOWN: 768>
|
|
783
|
+
KEY_UP: typing.ClassVar[EventType] # value = <EventType.KEY_UP: 769>
|
|
784
|
+
MOUSE_ADDED: typing.ClassVar[EventType] # value = <EventType.MOUSE_ADDED: 1028>
|
|
785
|
+
MOUSE_BUTTON_DOWN: typing.ClassVar[EventType] # value = <EventType.MOUSE_BUTTON_DOWN: 1025>
|
|
786
|
+
MOUSE_BUTTON_UP: typing.ClassVar[EventType] # value = <EventType.MOUSE_BUTTON_UP: 1026>
|
|
787
|
+
MOUSE_MOTION: typing.ClassVar[EventType] # value = <EventType.MOUSE_MOTION: 1024>
|
|
788
|
+
MOUSE_REMOVED: typing.ClassVar[EventType] # value = <EventType.MOUSE_REMOVED: 1029>
|
|
789
|
+
MOUSE_WHEEL: typing.ClassVar[EventType] # value = <EventType.MOUSE_WHEEL: 1027>
|
|
790
|
+
PEN_AXIS: typing.ClassVar[EventType] # value = <EventType.PEN_AXIS: 4871>
|
|
791
|
+
PEN_BUTTON_DOWN: typing.ClassVar[EventType] # value = <EventType.PEN_BUTTON_DOWN: 4868>
|
|
792
|
+
PEN_BUTTON_UP: typing.ClassVar[EventType] # value = <EventType.PEN_BUTTON_UP: 4869>
|
|
793
|
+
PEN_DOWN: typing.ClassVar[EventType] # value = <EventType.PEN_DOWN: 4866>
|
|
794
|
+
PEN_MOTION: typing.ClassVar[EventType] # value = <EventType.PEN_MOTION: 4870>
|
|
795
|
+
PEN_PROXIMITY_IN: typing.ClassVar[EventType] # value = <EventType.PEN_PROXIMITY_IN: 4864>
|
|
796
|
+
PEN_PROXIMITY_OUT: typing.ClassVar[EventType] # value = <EventType.PEN_PROXIMITY_OUT: 4865>
|
|
797
|
+
PEN_UP: typing.ClassVar[EventType] # value = <EventType.PEN_UP: 4867>
|
|
798
|
+
QUIT: typing.ClassVar[EventType] # value = <EventType.QUIT: 256>
|
|
799
|
+
TEXT_EDITING: typing.ClassVar[EventType] # value = <EventType.TEXT_EDITING: 770>
|
|
800
|
+
TEXT_INPUT: typing.ClassVar[EventType] # value = <EventType.TEXT_INPUT: 771>
|
|
801
|
+
WINDOW_ENTER_FULLSCREEN: typing.ClassVar[EventType] # value = <EventType.WINDOW_ENTER_FULLSCREEN: 535>
|
|
802
|
+
WINDOW_EXPOSED: typing.ClassVar[EventType] # value = <EventType.WINDOW_EXPOSED: 516>
|
|
803
|
+
WINDOW_FOCUS_GAINED: typing.ClassVar[EventType] # value = <EventType.WINDOW_FOCUS_GAINED: 526>
|
|
804
|
+
WINDOW_FOCUS_LOST: typing.ClassVar[EventType] # value = <EventType.WINDOW_FOCUS_LOST: 527>
|
|
805
|
+
WINDOW_HIDDEN: typing.ClassVar[EventType] # value = <EventType.WINDOW_HIDDEN: 515>
|
|
806
|
+
WINDOW_LEAVE_FULLSCREEN: typing.ClassVar[EventType] # value = <EventType.WINDOW_LEAVE_FULLSCREEN: 536>
|
|
807
|
+
WINDOW_MAXIMIZED: typing.ClassVar[EventType] # value = <EventType.WINDOW_MAXIMIZED: 522>
|
|
808
|
+
WINDOW_MINIMIZED: typing.ClassVar[EventType] # value = <EventType.WINDOW_MINIMIZED: 521>
|
|
809
|
+
WINDOW_MOUSE_ENTER: typing.ClassVar[EventType] # value = <EventType.WINDOW_MOUSE_ENTER: 524>
|
|
810
|
+
WINDOW_MOUSE_LEAVE: typing.ClassVar[EventType] # value = <EventType.WINDOW_MOUSE_LEAVE: 525>
|
|
811
|
+
WINDOW_MOVED: typing.ClassVar[EventType] # value = <EventType.WINDOW_MOVED: 517>
|
|
812
|
+
WINDOW_OCCLUDED: typing.ClassVar[EventType] # value = <EventType.WINDOW_OCCLUDED: 534>
|
|
813
|
+
WINDOW_RESIZED: typing.ClassVar[EventType] # value = <EventType.WINDOW_RESIZED: 518>
|
|
814
|
+
WINDOW_RESTORED: typing.ClassVar[EventType] # value = <EventType.WINDOW_RESTORED: 523>
|
|
815
|
+
WINDOW_SHOWN: typing.ClassVar[EventType] # value = <EventType.WINDOW_SHOWN: 514>
|
|
816
|
+
@classmethod
|
|
817
|
+
def __new__(cls, value):
|
|
818
|
+
...
|
|
819
|
+
def __format__(self, format_spec):
|
|
820
|
+
"""
|
|
821
|
+
Convert to a string according to format_spec.
|
|
822
|
+
"""
|
|
823
|
+
class Font:
|
|
824
|
+
"""
|
|
825
|
+
|
|
826
|
+
A font object for rendering text to the active renderer.
|
|
827
|
+
|
|
828
|
+
This class wraps an SDL_ttf font and an internal text object for efficient
|
|
829
|
+
rendering. You can load fonts from a file path or use one of the built-in
|
|
830
|
+
typefaces:
|
|
831
|
+
|
|
832
|
+
- "kraken-clean": A clean sans-serif font bundled with the engine.
|
|
833
|
+
- "kraken-retro": A pixel/retro font bundled with the engine. Point size is
|
|
834
|
+
rounded to the nearest multiple of 8 for crisp rendering.
|
|
835
|
+
|
|
836
|
+
Note:
|
|
837
|
+
A window/renderer must be created before using fonts. Typically you should
|
|
838
|
+
call kn.window.create(...) first, which initializes the font engine.
|
|
839
|
+
|
|
840
|
+
"""
|
|
841
|
+
def __init__(self, arg0: str, arg1: typing.SupportsInt) -> None:
|
|
842
|
+
"""
|
|
843
|
+
Create a Font.
|
|
844
|
+
|
|
845
|
+
Args:
|
|
846
|
+
file_dir (str): Path to a .ttf font file, or one of the built-in names
|
|
847
|
+
"kraken-clean" or "kraken-retro".
|
|
848
|
+
pt_size (int): The point size. Values below 8 are clamped to 8. For
|
|
849
|
+
"kraken-retro", the size is rounded to the nearest multiple
|
|
850
|
+
of 8 to preserve pixel alignment.
|
|
851
|
+
|
|
852
|
+
Raises:
|
|
853
|
+
RuntimeError: If the font fails to load.
|
|
854
|
+
"""
|
|
855
|
+
def draw(self, text: str, pos: typing.Any = None, color: typing.Any = None, wrap_width: typing.SupportsInt = 0) -> None:
|
|
856
|
+
"""
|
|
857
|
+
Draw text to the renderer.
|
|
858
|
+
|
|
859
|
+
Args:
|
|
860
|
+
text (str): The text to render.
|
|
861
|
+
pos (Vec2 | None, optional): The position in pixels. Defaults to (0, 0).
|
|
862
|
+
color (Color | None, optional): Text color. Defaults to white.
|
|
863
|
+
wrap_width (int, optional): Wrap the text at this pixel width. Set to 0 for
|
|
864
|
+
no wrapping. Defaults to 0.
|
|
865
|
+
|
|
866
|
+
Returns:
|
|
867
|
+
None
|
|
868
|
+
"""
|
|
869
|
+
def set_bold(self, on: bool) -> None:
|
|
870
|
+
"""
|
|
871
|
+
Enable or disable bold text style.
|
|
872
|
+
|
|
873
|
+
Args:
|
|
874
|
+
on (bool): True to enable bold, False to disable.
|
|
875
|
+
|
|
876
|
+
Returns:
|
|
877
|
+
None
|
|
878
|
+
"""
|
|
879
|
+
def set_italic(self, on: bool) -> None:
|
|
880
|
+
"""
|
|
881
|
+
Enable or disable italic text style.
|
|
882
|
+
|
|
883
|
+
Args:
|
|
884
|
+
on (bool): True to enable italic, False to disable.
|
|
885
|
+
|
|
886
|
+
Returns:
|
|
887
|
+
None
|
|
888
|
+
"""
|
|
889
|
+
def set_pt_size(self, pt: typing.SupportsInt) -> None:
|
|
890
|
+
"""
|
|
891
|
+
Set the font point size.
|
|
892
|
+
|
|
893
|
+
Args:
|
|
894
|
+
pt (int): The new point size. Values below 8 are clamped to 8.
|
|
895
|
+
|
|
896
|
+
Returns:
|
|
897
|
+
None
|
|
898
|
+
"""
|
|
899
|
+
def set_strikethrough(self, on: bool) -> None:
|
|
900
|
+
"""
|
|
901
|
+
Enable or disable strikethrough text style.
|
|
902
|
+
|
|
903
|
+
Args:
|
|
904
|
+
on (bool): True to enable strikethrough, False to disable.
|
|
905
|
+
|
|
906
|
+
Returns:
|
|
907
|
+
None
|
|
908
|
+
"""
|
|
909
|
+
def set_underline(self, on: bool) -> None:
|
|
910
|
+
"""
|
|
911
|
+
Enable or disable underline text style.
|
|
912
|
+
|
|
913
|
+
Args:
|
|
914
|
+
on (bool): True to enable underline, False to disable.
|
|
915
|
+
|
|
916
|
+
Returns:
|
|
917
|
+
None
|
|
918
|
+
"""
|
|
919
|
+
class Frame:
|
|
920
|
+
"""
|
|
921
|
+
|
|
922
|
+
A single animation frame containing texture and rectangle data.
|
|
923
|
+
|
|
924
|
+
Represents one frame of an animation with its associated texture and the rectangle
|
|
925
|
+
defining which portion of the texture to display.
|
|
926
|
+
|
|
927
|
+
"""
|
|
928
|
+
@property
|
|
929
|
+
def src(self) -> Rect:
|
|
930
|
+
"""
|
|
931
|
+
The rectangle defining the frame bounds within the texture.
|
|
932
|
+
"""
|
|
933
|
+
@property
|
|
934
|
+
def tex(self) -> Texture:
|
|
935
|
+
"""
|
|
936
|
+
The texture containing the frame image.
|
|
937
|
+
"""
|
|
938
|
+
class GamepadAxis(enum.IntEnum):
|
|
939
|
+
C_LTRIGGER: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_LTRIGGER: 4>
|
|
940
|
+
C_LX: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_LX: 0>
|
|
941
|
+
C_LY: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_LY: 1>
|
|
942
|
+
C_RTRIGGER: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_RTRIGGER: 5>
|
|
943
|
+
C_RX: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_RX: 2>
|
|
944
|
+
C_RY: typing.ClassVar[GamepadAxis] # value = <GamepadAxis.C_RY: 3>
|
|
945
|
+
@classmethod
|
|
946
|
+
def __new__(cls, value):
|
|
947
|
+
...
|
|
948
|
+
def __format__(self, format_spec):
|
|
949
|
+
"""
|
|
950
|
+
Convert to a string according to format_spec.
|
|
951
|
+
"""
|
|
952
|
+
class GamepadButton(enum.IntEnum):
|
|
953
|
+
C_BACK: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_BACK: 4>
|
|
954
|
+
C_DPAD_DOWN: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_DPAD_DOWN: 12>
|
|
955
|
+
C_DPAD_LEFT: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_DPAD_LEFT: 13>
|
|
956
|
+
C_DPAD_RIGHT: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_DPAD_RIGHT: 14>
|
|
957
|
+
C_DPAD_UP: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_DPAD_UP: 11>
|
|
958
|
+
C_EAST: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_EAST: 1>
|
|
959
|
+
C_GUIDE: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_GUIDE: 5>
|
|
960
|
+
C_LSHOULDER: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_LSHOULDER: 9>
|
|
961
|
+
C_LSTICK: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_LSTICK: 7>
|
|
962
|
+
C_NORTH: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_NORTH: 3>
|
|
963
|
+
C_RSHOULDER: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_RSHOULDER: 10>
|
|
964
|
+
C_RSTICK: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_RSTICK: 8>
|
|
965
|
+
C_SOUTH: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_SOUTH: 0>
|
|
966
|
+
C_START: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_START: 6>
|
|
967
|
+
C_WEST: typing.ClassVar[GamepadButton] # value = <GamepadButton.C_WEST: 2>
|
|
968
|
+
@classmethod
|
|
969
|
+
def __new__(cls, value):
|
|
970
|
+
...
|
|
971
|
+
def __format__(self, format_spec):
|
|
972
|
+
"""
|
|
973
|
+
Convert to a string according to format_spec.
|
|
974
|
+
"""
|
|
975
|
+
class GamepadType(enum.IntEnum):
|
|
976
|
+
C_PS3: typing.ClassVar[GamepadType] # value = <GamepadType.C_PS3: 4>
|
|
977
|
+
C_PS4: typing.ClassVar[GamepadType] # value = <GamepadType.C_PS4: 5>
|
|
978
|
+
C_PS5: typing.ClassVar[GamepadType] # value = <GamepadType.C_PS5: 6>
|
|
979
|
+
C_STANDARD: typing.ClassVar[GamepadType] # value = <GamepadType.C_STANDARD: 1>
|
|
980
|
+
C_SWITCH_JOYCON_LEFT: typing.ClassVar[GamepadType] # value = <GamepadType.C_SWITCH_JOYCON_LEFT: 8>
|
|
981
|
+
C_SWITCH_JOYCON_PAIR: typing.ClassVar[GamepadType] # value = <GamepadType.C_SWITCH_JOYCON_PAIR: 10>
|
|
982
|
+
C_SWITCH_JOYCON_RIGHT: typing.ClassVar[GamepadType] # value = <GamepadType.C_SWITCH_JOYCON_RIGHT: 9>
|
|
983
|
+
C_SWITCH_PRO: typing.ClassVar[GamepadType] # value = <GamepadType.C_SWITCH_PRO: 7>
|
|
984
|
+
C_XBOX_360: typing.ClassVar[GamepadType] # value = <GamepadType.C_XBOX_360: 2>
|
|
985
|
+
C_XBOX_ONE: typing.ClassVar[GamepadType] # value = <GamepadType.C_XBOX_ONE: 3>
|
|
986
|
+
@classmethod
|
|
987
|
+
def __new__(cls, value):
|
|
988
|
+
...
|
|
989
|
+
def __format__(self, format_spec):
|
|
990
|
+
"""
|
|
991
|
+
Convert to a string according to format_spec.
|
|
992
|
+
"""
|
|
993
|
+
class InputAction:
|
|
994
|
+
"""
|
|
995
|
+
|
|
996
|
+
Represents a single input trigger such as a key, mouse button, or gamepad control.
|
|
997
|
+
|
|
998
|
+
"""
|
|
999
|
+
@typing.overload
|
|
1000
|
+
def __init__(self, scancode: Scancode) -> None:
|
|
1001
|
+
"""
|
|
1002
|
+
Create an input action from a scancode.
|
|
1003
|
+
|
|
1004
|
+
Args:
|
|
1005
|
+
scancode (Scancode): Keyboard scancode.
|
|
1006
|
+
"""
|
|
1007
|
+
@typing.overload
|
|
1008
|
+
def __init__(self, keycode: Keycode) -> None:
|
|
1009
|
+
"""
|
|
1010
|
+
Create an input action from a keycode.
|
|
1011
|
+
|
|
1012
|
+
Args:
|
|
1013
|
+
keycode (Keycode): Keyboard keycode.
|
|
1014
|
+
"""
|
|
1015
|
+
@typing.overload
|
|
1016
|
+
def __init__(self, mouse_button: MouseButton) -> None:
|
|
1017
|
+
"""
|
|
1018
|
+
Create an input action from a mouse button.
|
|
1019
|
+
|
|
1020
|
+
Args:
|
|
1021
|
+
mouse_button (MouseButton): Mouse button code.
|
|
1022
|
+
"""
|
|
1023
|
+
@typing.overload
|
|
1024
|
+
def __init__(self, gamepad_button: GamepadButton, slot: typing.SupportsInt = 0) -> None:
|
|
1025
|
+
"""
|
|
1026
|
+
Create an input action from a gamepad button.
|
|
1027
|
+
|
|
1028
|
+
Args:
|
|
1029
|
+
gamepad_button (GamepadButton): Gamepad button code.
|
|
1030
|
+
slot (int, optional): Gamepad slot (default is 0).
|
|
1031
|
+
"""
|
|
1032
|
+
@typing.overload
|
|
1033
|
+
def __init__(self, gamepad_axis: GamepadAxis, is_positive: bool, slot: typing.SupportsInt = 0) -> None:
|
|
1034
|
+
"""
|
|
1035
|
+
Create an input action from a gamepad axis direction.
|
|
1036
|
+
|
|
1037
|
+
Args:
|
|
1038
|
+
gamepad_axis (GamepadAxis): Gamepad axis code.
|
|
1039
|
+
is_positive (bool): True for positive direction, False for negative.
|
|
1040
|
+
slot (int, optional): Gamepad slot (default is 0).
|
|
1041
|
+
"""
|
|
1042
|
+
class Keycode(enum.IntEnum):
|
|
1043
|
+
K_0: typing.ClassVar[Keycode] # value = <Keycode.K_0: 48>
|
|
1044
|
+
K_1: typing.ClassVar[Keycode] # value = <Keycode.K_1: 49>
|
|
1045
|
+
K_2: typing.ClassVar[Keycode] # value = <Keycode.K_2: 50>
|
|
1046
|
+
K_3: typing.ClassVar[Keycode] # value = <Keycode.K_3: 51>
|
|
1047
|
+
K_4: typing.ClassVar[Keycode] # value = <Keycode.K_4: 52>
|
|
1048
|
+
K_5: typing.ClassVar[Keycode] # value = <Keycode.K_5: 53>
|
|
1049
|
+
K_6: typing.ClassVar[Keycode] # value = <Keycode.K_6: 54>
|
|
1050
|
+
K_7: typing.ClassVar[Keycode] # value = <Keycode.K_7: 55>
|
|
1051
|
+
K_8: typing.ClassVar[Keycode] # value = <Keycode.K_8: 56>
|
|
1052
|
+
K_9: typing.ClassVar[Keycode] # value = <Keycode.K_9: 57>
|
|
1053
|
+
K_AGAIN: typing.ClassVar[Keycode] # value = <Keycode.K_AGAIN: 1073741945>
|
|
1054
|
+
K_AMPERSAND: typing.ClassVar[Keycode] # value = <Keycode.K_AMPERSAND: 38>
|
|
1055
|
+
K_ASTERISK: typing.ClassVar[Keycode] # value = <Keycode.K_ASTERISK: 42>
|
|
1056
|
+
K_AT: typing.ClassVar[Keycode] # value = <Keycode.K_AT: 64>
|
|
1057
|
+
K_BACKSLASH: typing.ClassVar[Keycode] # value = <Keycode.K_BACKSLASH: 92>
|
|
1058
|
+
K_BACKSPACE: typing.ClassVar[Keycode] # value = <Keycode.K_BACKSPACE: 8>
|
|
1059
|
+
K_CAPS: typing.ClassVar[Keycode] # value = <Keycode.K_CAPS: 1073741881>
|
|
1060
|
+
K_CARET: typing.ClassVar[Keycode] # value = <Keycode.K_CARET: 94>
|
|
1061
|
+
K_COLON: typing.ClassVar[Keycode] # value = <Keycode.K_COLON: 58>
|
|
1062
|
+
K_COMMA: typing.ClassVar[Keycode] # value = <Keycode.K_COMMA: 44>
|
|
1063
|
+
K_COPY: typing.ClassVar[Keycode] # value = <Keycode.K_COPY: 1073741948>
|
|
1064
|
+
K_CUT: typing.ClassVar[Keycode] # value = <Keycode.K_CUT: 1073741947>
|
|
1065
|
+
K_DBLQUOTE: typing.ClassVar[Keycode] # value = <Keycode.K_DBLQUOTE: 34>
|
|
1066
|
+
K_DEL: typing.ClassVar[Keycode] # value = <Keycode.K_DEL: 127>
|
|
1067
|
+
K_DOLLAR: typing.ClassVar[Keycode] # value = <Keycode.K_DOLLAR: 36>
|
|
1068
|
+
K_DOWN: typing.ClassVar[Keycode] # value = <Keycode.K_DOWN: 1073741905>
|
|
1069
|
+
K_END: typing.ClassVar[Keycode] # value = <Keycode.K_END: 1073741901>
|
|
1070
|
+
K_EQ: typing.ClassVar[Keycode] # value = <Keycode.K_EQ: 61>
|
|
1071
|
+
K_ESC: typing.ClassVar[Keycode] # value = <Keycode.K_ESC: 27>
|
|
1072
|
+
K_EXCLAIM: typing.ClassVar[Keycode] # value = <Keycode.K_EXCLAIM: 33>
|
|
1073
|
+
K_F1: typing.ClassVar[Keycode] # value = <Keycode.K_F1: 1073741882>
|
|
1074
|
+
K_F10: typing.ClassVar[Keycode] # value = <Keycode.K_F10: 1073741891>
|
|
1075
|
+
K_F11: typing.ClassVar[Keycode] # value = <Keycode.K_F11: 1073741892>
|
|
1076
|
+
K_F12: typing.ClassVar[Keycode] # value = <Keycode.K_F12: 1073741893>
|
|
1077
|
+
K_F2: typing.ClassVar[Keycode] # value = <Keycode.K_F2: 1073741883>
|
|
1078
|
+
K_F3: typing.ClassVar[Keycode] # value = <Keycode.K_F3: 1073741884>
|
|
1079
|
+
K_F4: typing.ClassVar[Keycode] # value = <Keycode.K_F4: 1073741885>
|
|
1080
|
+
K_F5: typing.ClassVar[Keycode] # value = <Keycode.K_F5: 1073741886>
|
|
1081
|
+
K_F6: typing.ClassVar[Keycode] # value = <Keycode.K_F6: 1073741887>
|
|
1082
|
+
K_F7: typing.ClassVar[Keycode] # value = <Keycode.K_F7: 1073741888>
|
|
1083
|
+
K_F8: typing.ClassVar[Keycode] # value = <Keycode.K_F8: 1073741889>
|
|
1084
|
+
K_F9: typing.ClassVar[Keycode] # value = <Keycode.K_F9: 1073741890>
|
|
1085
|
+
K_FIND: typing.ClassVar[Keycode] # value = <Keycode.K_FIND: 1073741950>
|
|
1086
|
+
K_GRAVE: typing.ClassVar[Keycode] # value = <Keycode.K_GRAVE: 96>
|
|
1087
|
+
K_GT: typing.ClassVar[Keycode] # value = <Keycode.K_GT: 62>
|
|
1088
|
+
K_HASH: typing.ClassVar[Keycode] # value = <Keycode.K_HASH: 35>
|
|
1089
|
+
K_HOME: typing.ClassVar[Keycode] # value = <Keycode.K_HOME: 1073741898>
|
|
1090
|
+
K_INS: typing.ClassVar[Keycode] # value = <Keycode.K_INS: 1073741897>
|
|
1091
|
+
K_KP_0: typing.ClassVar[Keycode] # value = <Keycode.K_KP_0: 1073741922>
|
|
1092
|
+
K_KP_1: typing.ClassVar[Keycode] # value = <Keycode.K_KP_1: 1073741913>
|
|
1093
|
+
K_KP_2: typing.ClassVar[Keycode] # value = <Keycode.K_KP_2: 1073741914>
|
|
1094
|
+
K_KP_3: typing.ClassVar[Keycode] # value = <Keycode.K_KP_3: 1073741915>
|
|
1095
|
+
K_KP_4: typing.ClassVar[Keycode] # value = <Keycode.K_KP_4: 1073741916>
|
|
1096
|
+
K_KP_5: typing.ClassVar[Keycode] # value = <Keycode.K_KP_5: 1073741917>
|
|
1097
|
+
K_KP_6: typing.ClassVar[Keycode] # value = <Keycode.K_KP_6: 1073741918>
|
|
1098
|
+
K_KP_7: typing.ClassVar[Keycode] # value = <Keycode.K_KP_7: 1073741919>
|
|
1099
|
+
K_KP_8: typing.ClassVar[Keycode] # value = <Keycode.K_KP_8: 1073741920>
|
|
1100
|
+
K_KP_9: typing.ClassVar[Keycode] # value = <Keycode.K_KP_9: 1073741921>
|
|
1101
|
+
K_KP_DIV: typing.ClassVar[Keycode] # value = <Keycode.K_KP_DIV: 1073741908>
|
|
1102
|
+
K_KP_ENTER: typing.ClassVar[Keycode] # value = <Keycode.K_KP_ENTER: 1073741912>
|
|
1103
|
+
K_KP_MINUS: typing.ClassVar[Keycode] # value = <Keycode.K_KP_MINUS: 1073741910>
|
|
1104
|
+
K_KP_MULT: typing.ClassVar[Keycode] # value = <Keycode.K_KP_MULT: 1073741909>
|
|
1105
|
+
K_KP_PERIOD: typing.ClassVar[Keycode] # value = <Keycode.K_KP_PERIOD: 1073741923>
|
|
1106
|
+
K_KP_PLUS: typing.ClassVar[Keycode] # value = <Keycode.K_KP_PLUS: 1073741911>
|
|
1107
|
+
K_LALT: typing.ClassVar[Keycode] # value = <Keycode.K_LALT: 1073742050>
|
|
1108
|
+
K_LBRACE: typing.ClassVar[Keycode] # value = <Keycode.K_LBRACE: 123>
|
|
1109
|
+
K_LBRACKET: typing.ClassVar[Keycode] # value = <Keycode.K_LBRACKET: 91>
|
|
1110
|
+
K_LCTRL: typing.ClassVar[Keycode] # value = <Keycode.K_LCTRL: 1073742048>
|
|
1111
|
+
K_LEFT: typing.ClassVar[Keycode] # value = <Keycode.K_LEFT: 1073741904>
|
|
1112
|
+
K_LGUI: typing.ClassVar[Keycode] # value = <Keycode.K_LGUI: 1073742051>
|
|
1113
|
+
K_LPAREN: typing.ClassVar[Keycode] # value = <Keycode.K_LPAREN: 40>
|
|
1114
|
+
K_LSHIFT: typing.ClassVar[Keycode] # value = <Keycode.K_LSHIFT: 1073742049>
|
|
1115
|
+
K_LT: typing.ClassVar[Keycode] # value = <Keycode.K_LT: 60>
|
|
1116
|
+
K_MINUS: typing.ClassVar[Keycode] # value = <Keycode.K_MINUS: 45>
|
|
1117
|
+
K_MUTE: typing.ClassVar[Keycode] # value = <Keycode.K_MUTE: 1073741951>
|
|
1118
|
+
K_NUMLOCK: typing.ClassVar[Keycode] # value = <Keycode.K_NUMLOCK: 1073741907>
|
|
1119
|
+
K_PASTE: typing.ClassVar[Keycode] # value = <Keycode.K_PASTE: 1073741949>
|
|
1120
|
+
K_PAUSE: typing.ClassVar[Keycode] # value = <Keycode.K_PAUSE: 1073741896>
|
|
1121
|
+
K_PERCENT: typing.ClassVar[Keycode] # value = <Keycode.K_PERCENT: 37>
|
|
1122
|
+
K_PERIOD: typing.ClassVar[Keycode] # value = <Keycode.K_PERIOD: 46>
|
|
1123
|
+
K_PGDOWN: typing.ClassVar[Keycode] # value = <Keycode.K_PGDOWN: 1073741902>
|
|
1124
|
+
K_PGUP: typing.ClassVar[Keycode] # value = <Keycode.K_PGUP: 1073741899>
|
|
1125
|
+
K_PIPE: typing.ClassVar[Keycode] # value = <Keycode.K_PIPE: 124>
|
|
1126
|
+
K_PLUS: typing.ClassVar[Keycode] # value = <Keycode.K_PLUS: 43>
|
|
1127
|
+
K_PRTSCR: typing.ClassVar[Keycode] # value = <Keycode.K_PRTSCR: 1073741894>
|
|
1128
|
+
K_QUESTION: typing.ClassVar[Keycode] # value = <Keycode.K_QUESTION: 63>
|
|
1129
|
+
K_RALT: typing.ClassVar[Keycode] # value = <Keycode.K_RALT: 1073742054>
|
|
1130
|
+
K_RBRACE: typing.ClassVar[Keycode] # value = <Keycode.K_RBRACE: 125>
|
|
1131
|
+
K_RBRACKET: typing.ClassVar[Keycode] # value = <Keycode.K_RBRACKET: 93>
|
|
1132
|
+
K_RCTRL: typing.ClassVar[Keycode] # value = <Keycode.K_RCTRL: 1073742052>
|
|
1133
|
+
K_RETURN: typing.ClassVar[Keycode] # value = <Keycode.K_RETURN: 13>
|
|
1134
|
+
K_RGUI: typing.ClassVar[Keycode] # value = <Keycode.K_RGUI: 1073742055>
|
|
1135
|
+
K_RIGHT: typing.ClassVar[Keycode] # value = <Keycode.K_RIGHT: 1073741903>
|
|
1136
|
+
K_RPAREN: typing.ClassVar[Keycode] # value = <Keycode.K_RPAREN: 41>
|
|
1137
|
+
K_RSHIFT: typing.ClassVar[Keycode] # value = <Keycode.K_RSHIFT: 1073742053>
|
|
1138
|
+
K_SCRLK: typing.ClassVar[Keycode] # value = <Keycode.K_SCRLK: 1073741895>
|
|
1139
|
+
K_SEMICOLON: typing.ClassVar[Keycode] # value = <Keycode.K_SEMICOLON: 59>
|
|
1140
|
+
K_SGLQUOTE: typing.ClassVar[Keycode] # value = <Keycode.K_SGLQUOTE: 39>
|
|
1141
|
+
K_SLASH: typing.ClassVar[Keycode] # value = <Keycode.K_SLASH: 47>
|
|
1142
|
+
K_SPACE: typing.ClassVar[Keycode] # value = <Keycode.K_SPACE: 32>
|
|
1143
|
+
K_TAB: typing.ClassVar[Keycode] # value = <Keycode.K_TAB: 9>
|
|
1144
|
+
K_TILDE: typing.ClassVar[Keycode] # value = <Keycode.K_TILDE: 126>
|
|
1145
|
+
K_UNDERSCORE: typing.ClassVar[Keycode] # value = <Keycode.K_UNDERSCORE: 95>
|
|
1146
|
+
K_UNDO: typing.ClassVar[Keycode] # value = <Keycode.K_UNDO: 1073741946>
|
|
1147
|
+
K_UP: typing.ClassVar[Keycode] # value = <Keycode.K_UP: 1073741906>
|
|
1148
|
+
K_VOLDOWN: typing.ClassVar[Keycode] # value = <Keycode.K_VOLDOWN: 1073741953>
|
|
1149
|
+
K_VOLUP: typing.ClassVar[Keycode] # value = <Keycode.K_VOLUP: 1073741952>
|
|
1150
|
+
K_a: typing.ClassVar[Keycode] # value = <Keycode.K_a: 97>
|
|
1151
|
+
K_b: typing.ClassVar[Keycode] # value = <Keycode.K_b: 98>
|
|
1152
|
+
K_c: typing.ClassVar[Keycode] # value = <Keycode.K_c: 99>
|
|
1153
|
+
K_d: typing.ClassVar[Keycode] # value = <Keycode.K_d: 100>
|
|
1154
|
+
K_e: typing.ClassVar[Keycode] # value = <Keycode.K_e: 101>
|
|
1155
|
+
K_f: typing.ClassVar[Keycode] # value = <Keycode.K_f: 102>
|
|
1156
|
+
K_g: typing.ClassVar[Keycode] # value = <Keycode.K_g: 103>
|
|
1157
|
+
K_h: typing.ClassVar[Keycode] # value = <Keycode.K_h: 104>
|
|
1158
|
+
K_i: typing.ClassVar[Keycode] # value = <Keycode.K_i: 105>
|
|
1159
|
+
K_j: typing.ClassVar[Keycode] # value = <Keycode.K_j: 106>
|
|
1160
|
+
K_k: typing.ClassVar[Keycode] # value = <Keycode.K_k: 107>
|
|
1161
|
+
K_l: typing.ClassVar[Keycode] # value = <Keycode.K_l: 108>
|
|
1162
|
+
K_m: typing.ClassVar[Keycode] # value = <Keycode.K_m: 109>
|
|
1163
|
+
K_n: typing.ClassVar[Keycode] # value = <Keycode.K_n: 110>
|
|
1164
|
+
K_o: typing.ClassVar[Keycode] # value = <Keycode.K_o: 111>
|
|
1165
|
+
K_p: typing.ClassVar[Keycode] # value = <Keycode.K_p: 112>
|
|
1166
|
+
K_q: typing.ClassVar[Keycode] # value = <Keycode.K_q: 113>
|
|
1167
|
+
K_r: typing.ClassVar[Keycode] # value = <Keycode.K_r: 114>
|
|
1168
|
+
K_s: typing.ClassVar[Keycode] # value = <Keycode.K_s: 115>
|
|
1169
|
+
K_t: typing.ClassVar[Keycode] # value = <Keycode.K_t: 116>
|
|
1170
|
+
K_u: typing.ClassVar[Keycode] # value = <Keycode.K_u: 117>
|
|
1171
|
+
K_v: typing.ClassVar[Keycode] # value = <Keycode.K_v: 118>
|
|
1172
|
+
K_w: typing.ClassVar[Keycode] # value = <Keycode.K_w: 119>
|
|
1173
|
+
K_x: typing.ClassVar[Keycode] # value = <Keycode.K_x: 120>
|
|
1174
|
+
K_y: typing.ClassVar[Keycode] # value = <Keycode.K_y: 121>
|
|
1175
|
+
K_z: typing.ClassVar[Keycode] # value = <Keycode.K_z: 122>
|
|
1176
|
+
@classmethod
|
|
1177
|
+
def __new__(cls, value):
|
|
1178
|
+
...
|
|
1179
|
+
def __format__(self, format_spec):
|
|
1180
|
+
"""
|
|
1181
|
+
Convert to a string according to format_spec.
|
|
1182
|
+
"""
|
|
1183
|
+
class Layer:
|
|
1184
|
+
"""
|
|
1185
|
+
|
|
1186
|
+
A layer within a tile map.
|
|
1187
|
+
|
|
1188
|
+
Layers can be either tile layers or object layers and contain a list of tiles.
|
|
1189
|
+
|
|
1190
|
+
"""
|
|
1191
|
+
class Type(enum.IntEnum):
|
|
1192
|
+
"""
|
|
1193
|
+
|
|
1194
|
+
The type of a Layer.
|
|
1195
|
+
|
|
1196
|
+
"""
|
|
1197
|
+
OBJECT: typing.ClassVar[Layer.Type] # value = <Type.OBJECT: 0>
|
|
1198
|
+
TILE: typing.ClassVar[Layer.Type] # value = <Type.TILE: 1>
|
|
1199
|
+
@classmethod
|
|
1200
|
+
def __new__(cls, value):
|
|
1201
|
+
...
|
|
1202
|
+
def __format__(self, format_spec):
|
|
1203
|
+
"""
|
|
1204
|
+
Convert to a string according to format_spec.
|
|
1205
|
+
"""
|
|
1206
|
+
OBJECT: typing.ClassVar[Layer.Type] # value = <Type.OBJECT: 0>
|
|
1207
|
+
TILE: typing.ClassVar[Layer.Type] # value = <Type.TILE: 1>
|
|
1208
|
+
def render(self) -> None:
|
|
1209
|
+
"""
|
|
1210
|
+
Render the layer.
|
|
1211
|
+
"""
|
|
1212
|
+
@property
|
|
1213
|
+
def is_visible(self) -> bool:
|
|
1214
|
+
"""
|
|
1215
|
+
Whether the layer is visible.
|
|
1216
|
+
"""
|
|
1217
|
+
@property
|
|
1218
|
+
def name(self) -> str:
|
|
1219
|
+
"""
|
|
1220
|
+
The name of the layer.
|
|
1221
|
+
"""
|
|
1222
|
+
@property
|
|
1223
|
+
def tiles(self) -> list[Tile]:
|
|
1224
|
+
"""
|
|
1225
|
+
The list of Tile instances contained in this layer.
|
|
1226
|
+
"""
|
|
1227
|
+
@property
|
|
1228
|
+
def type(self) -> Layer.Type:
|
|
1229
|
+
"""
|
|
1230
|
+
The layer type (OBJECT or TILE).
|
|
1231
|
+
"""
|
|
1232
|
+
class Line:
|
|
1233
|
+
"""
|
|
1234
|
+
|
|
1235
|
+
A 2D line segment defined by two points: A and B.
|
|
1236
|
+
You can access or modify points using `.a`, `.b`, or directly via `.ax`, `.ay`, `.bx`, `.by`.
|
|
1237
|
+
|
|
1238
|
+
"""
|
|
1239
|
+
__hash__: typing.ClassVar[None] = None
|
|
1240
|
+
def __eq__(self, other: Line) -> bool:
|
|
1241
|
+
"""
|
|
1242
|
+
Check if two lines are equal.
|
|
1243
|
+
|
|
1244
|
+
Args:
|
|
1245
|
+
other (Line): The other line to compare.
|
|
1246
|
+
|
|
1247
|
+
Returns:
|
|
1248
|
+
bool: True if all components are equal.
|
|
1249
|
+
"""
|
|
1250
|
+
def __getitem__(self, arg0: typing.SupportsInt) -> float:
|
|
1251
|
+
"""
|
|
1252
|
+
Get coordinate by index:
|
|
1253
|
+
0 = ax, 1 = ay, 2 = bx, 3 = by
|
|
1254
|
+
|
|
1255
|
+
Raises:
|
|
1256
|
+
IndexError: If index is not 0-3.
|
|
1257
|
+
"""
|
|
1258
|
+
@typing.overload
|
|
1259
|
+
def __init__(self) -> None:
|
|
1260
|
+
"""
|
|
1261
|
+
Create a default line with all values set to 0.
|
|
1262
|
+
"""
|
|
1263
|
+
@typing.overload
|
|
1264
|
+
def __init__(self, ax: typing.SupportsFloat, ay: typing.SupportsFloat, bx: typing.SupportsFloat, by: typing.SupportsFloat) -> None:
|
|
1265
|
+
"""
|
|
1266
|
+
Create a line from two coordinate points.
|
|
1267
|
+
|
|
1268
|
+
Args:
|
|
1269
|
+
ax (float): X-coordinate of point A.
|
|
1270
|
+
ay (float): Y-coordinate of point A.
|
|
1271
|
+
bx (float): X-coordinate of point B.
|
|
1272
|
+
by (float): Y-coordinate of point B.
|
|
1273
|
+
"""
|
|
1274
|
+
@typing.overload
|
|
1275
|
+
def __init__(self, ax: typing.SupportsFloat, ay: typing.SupportsFloat, b: Vec2) -> None:
|
|
1276
|
+
"""
|
|
1277
|
+
Create a line from A coordinates and a Vec2 B point.
|
|
1278
|
+
|
|
1279
|
+
Args:
|
|
1280
|
+
ax (float): X-coordinate of point A.
|
|
1281
|
+
ay (float): Y-coordinate of point A.
|
|
1282
|
+
b (Vec2): Point B.
|
|
1283
|
+
"""
|
|
1284
|
+
@typing.overload
|
|
1285
|
+
def __init__(self, a: Vec2, bx: typing.SupportsFloat, by: typing.SupportsFloat) -> None:
|
|
1286
|
+
"""
|
|
1287
|
+
Create a line from a Vec2 A point and B coordinates.
|
|
1288
|
+
|
|
1289
|
+
Args:
|
|
1290
|
+
a (Vec2): Point A.
|
|
1291
|
+
bx (float): X-coordinate of point B.
|
|
1292
|
+
by (float): Y-coordinate of point B.
|
|
1293
|
+
"""
|
|
1294
|
+
@typing.overload
|
|
1295
|
+
def __init__(self, a: Vec2, b: Vec2) -> None:
|
|
1296
|
+
"""
|
|
1297
|
+
Create a line from two Vec2 points.
|
|
1298
|
+
|
|
1299
|
+
Args:
|
|
1300
|
+
a (Vec2): Point A.
|
|
1301
|
+
b (Vec2): Point B.
|
|
1302
|
+
"""
|
|
1303
|
+
@typing.overload
|
|
1304
|
+
def __init__(self, arg0: collections.abc.Sequence) -> None:
|
|
1305
|
+
"""
|
|
1306
|
+
Create a line from two 2-element sequences: [[ax, ay], [bx, by]].
|
|
1307
|
+
|
|
1308
|
+
Raises:
|
|
1309
|
+
ValueError: If either point is not a 2-element sequence.
|
|
1310
|
+
"""
|
|
1311
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
1312
|
+
...
|
|
1313
|
+
def __len__(self) -> int:
|
|
1314
|
+
"""
|
|
1315
|
+
Return the number of components (always 4).
|
|
1316
|
+
|
|
1317
|
+
Returns:
|
|
1318
|
+
int: Always returns 4 (ax, ay, bx, by).
|
|
1319
|
+
"""
|
|
1320
|
+
def __ne__(self, other: Line) -> bool:
|
|
1321
|
+
"""
|
|
1322
|
+
Check if two lines are not equal.
|
|
1323
|
+
|
|
1324
|
+
Args:
|
|
1325
|
+
other (Line): The other line to compare.
|
|
1326
|
+
|
|
1327
|
+
Returns:
|
|
1328
|
+
bool: True if any component differs.
|
|
1329
|
+
"""
|
|
1330
|
+
def copy(self) -> Line:
|
|
1331
|
+
"""
|
|
1332
|
+
Return a copy of this line.
|
|
1333
|
+
"""
|
|
1334
|
+
def move(self, offset: Vec2) -> None:
|
|
1335
|
+
"""
|
|
1336
|
+
Move this line by a Vec2 or 2-element sequence.
|
|
1337
|
+
|
|
1338
|
+
Args:
|
|
1339
|
+
offset (Vec2 | list[float]): The amount to move.
|
|
1340
|
+
"""
|
|
1341
|
+
@property
|
|
1342
|
+
def a(self) -> Vec2:
|
|
1343
|
+
"""
|
|
1344
|
+
Get or set point A as a tuple or Vec2.
|
|
1345
|
+
"""
|
|
1346
|
+
@a.setter
|
|
1347
|
+
def a(self, arg1: Vec2) -> None:
|
|
1348
|
+
...
|
|
1349
|
+
@property
|
|
1350
|
+
def ax(self) -> float:
|
|
1351
|
+
"""
|
|
1352
|
+
X-coordinate of point A.
|
|
1353
|
+
"""
|
|
1354
|
+
@ax.setter
|
|
1355
|
+
def ax(self, arg0: typing.SupportsFloat) -> None:
|
|
1356
|
+
...
|
|
1357
|
+
@property
|
|
1358
|
+
def ay(self) -> float:
|
|
1359
|
+
"""
|
|
1360
|
+
Y-coordinate of point A.
|
|
1361
|
+
"""
|
|
1362
|
+
@ay.setter
|
|
1363
|
+
def ay(self, arg0: typing.SupportsFloat) -> None:
|
|
1364
|
+
...
|
|
1365
|
+
@property
|
|
1366
|
+
def b(self) -> Vec2:
|
|
1367
|
+
"""
|
|
1368
|
+
Get or set point B as a tuple or Vec2.
|
|
1369
|
+
"""
|
|
1370
|
+
@b.setter
|
|
1371
|
+
def b(self, arg1: Vec2) -> None:
|
|
1372
|
+
...
|
|
1373
|
+
@property
|
|
1374
|
+
def bx(self) -> float:
|
|
1375
|
+
"""
|
|
1376
|
+
X-coordinate of point B.
|
|
1377
|
+
"""
|
|
1378
|
+
@bx.setter
|
|
1379
|
+
def bx(self, arg0: typing.SupportsFloat) -> None:
|
|
1380
|
+
...
|
|
1381
|
+
@property
|
|
1382
|
+
def by(self) -> float:
|
|
1383
|
+
"""
|
|
1384
|
+
Y-coordinate of point B.
|
|
1385
|
+
"""
|
|
1386
|
+
@by.setter
|
|
1387
|
+
def by(self, arg0: typing.SupportsFloat) -> None:
|
|
1388
|
+
...
|
|
1389
|
+
@property
|
|
1390
|
+
def length(self) -> float:
|
|
1391
|
+
"""
|
|
1392
|
+
The Euclidean length of the line segment.
|
|
1393
|
+
"""
|
|
1394
|
+
class Mask:
|
|
1395
|
+
"""
|
|
1396
|
+
|
|
1397
|
+
A collision mask for pixel-perfect collision detection.
|
|
1398
|
+
|
|
1399
|
+
A Mask represents a 2D bitmap, typically used for precise collision detection based on
|
|
1400
|
+
non-transparent pixels.
|
|
1401
|
+
|
|
1402
|
+
"""
|
|
1403
|
+
@typing.overload
|
|
1404
|
+
def __init__(self) -> None:
|
|
1405
|
+
"""
|
|
1406
|
+
Create an empty mask with size (0, 0).
|
|
1407
|
+
"""
|
|
1408
|
+
@typing.overload
|
|
1409
|
+
def __init__(self, size: Vec2, filled: bool = False) -> None:
|
|
1410
|
+
"""
|
|
1411
|
+
Create a mask with specified size.
|
|
1412
|
+
|
|
1413
|
+
Args:
|
|
1414
|
+
size (Vec2): The size of the mask as (width, height).
|
|
1415
|
+
filled (bool): Whether to fill the mask with solid pixels. Defaults to False.
|
|
1416
|
+
"""
|
|
1417
|
+
@typing.overload
|
|
1418
|
+
def __init__(self, pixel_array: PixelArray, threshold: typing.SupportsInt = 1) -> None:
|
|
1419
|
+
"""
|
|
1420
|
+
Create a mask from a pixel array based on alpha threshold.
|
|
1421
|
+
|
|
1422
|
+
Args:
|
|
1423
|
+
pixel_array (PixelArray): The source pixel array to create the mask from.
|
|
1424
|
+
threshold (int): Alpha threshold value (0-255). Pixels with alpha >= threshold are solid.
|
|
1425
|
+
|
|
1426
|
+
Raises:
|
|
1427
|
+
RuntimeError: If the pixel array is invalid.
|
|
1428
|
+
"""
|
|
1429
|
+
def add(self, other: Mask, offset: typing.Any = None) -> None:
|
|
1430
|
+
"""
|
|
1431
|
+
Add another mask to this mask with an offset.
|
|
1432
|
+
|
|
1433
|
+
Performs a bitwise OR operation between the masks.
|
|
1434
|
+
|
|
1435
|
+
Args:
|
|
1436
|
+
other (Mask): The mask to add.
|
|
1437
|
+
offset (Vec2): Position offset for the other mask. Defaults to (0, 0).
|
|
1438
|
+
"""
|
|
1439
|
+
def clear(self) -> None:
|
|
1440
|
+
"""
|
|
1441
|
+
Clear the entire mask, setting all pixels to transparent.
|
|
1442
|
+
"""
|
|
1443
|
+
def collide_mask(self, other: Mask, offset: typing.Any = None) -> bool:
|
|
1444
|
+
"""
|
|
1445
|
+
Check collision between this mask and another mask with an offset.
|
|
1446
|
+
|
|
1447
|
+
Args:
|
|
1448
|
+
other (Mask): The other mask to test collision with.
|
|
1449
|
+
offset (Vec2): Position offset between the masks. Defaults to (0, 0).
|
|
1450
|
+
|
|
1451
|
+
Returns:
|
|
1452
|
+
bool: True if the masks collide, False otherwise.
|
|
1453
|
+
"""
|
|
1454
|
+
def copy(self) -> Mask:
|
|
1455
|
+
"""
|
|
1456
|
+
Create a copy of this mask.
|
|
1457
|
+
|
|
1458
|
+
Returns:
|
|
1459
|
+
Mask: A new Mask with the same dimensions and pixel data.
|
|
1460
|
+
"""
|
|
1461
|
+
def fill(self) -> None:
|
|
1462
|
+
"""
|
|
1463
|
+
Fill the entire mask with solid pixels.
|
|
1464
|
+
"""
|
|
1465
|
+
def get_at(self, pos: Vec2) -> bool:
|
|
1466
|
+
"""
|
|
1467
|
+
Get the pixel value at a specific position.
|
|
1468
|
+
|
|
1469
|
+
Args:
|
|
1470
|
+
pos (Vec2): The position to check.
|
|
1471
|
+
|
|
1472
|
+
Returns:
|
|
1473
|
+
bool: True if the pixel is solid (above threshold), False otherwise.
|
|
1474
|
+
"""
|
|
1475
|
+
def get_bounding_rect(self) -> Rect:
|
|
1476
|
+
"""
|
|
1477
|
+
Get the bounding rectangle that contains all solid pixels.
|
|
1478
|
+
|
|
1479
|
+
Returns:
|
|
1480
|
+
Rect: The smallest rectangle containing all solid pixels.
|
|
1481
|
+
Returns empty rect if mask has no solid pixels.
|
|
1482
|
+
"""
|
|
1483
|
+
def get_center_of_mass(self) -> Vec2:
|
|
1484
|
+
"""
|
|
1485
|
+
Calculate the center of mass of all solid pixels.
|
|
1486
|
+
|
|
1487
|
+
Returns:
|
|
1488
|
+
Vec2: The center of mass position. Returns (0, 0) if mask is empty.
|
|
1489
|
+
"""
|
|
1490
|
+
def get_collision_points(self, other: Mask, offset: typing.Any = None) -> list[Vec2]:
|
|
1491
|
+
"""
|
|
1492
|
+
Get all points where this mask collides with another mask.
|
|
1493
|
+
|
|
1494
|
+
Args:
|
|
1495
|
+
other (Mask): The other mask to test collision with.
|
|
1496
|
+
offset (Vec2): Position offset between the masks. Defaults to (0, 0).
|
|
1497
|
+
|
|
1498
|
+
Returns:
|
|
1499
|
+
list[Vec2]: A list of collision points.
|
|
1500
|
+
"""
|
|
1501
|
+
def get_count(self) -> int:
|
|
1502
|
+
"""
|
|
1503
|
+
Get the number of solid pixels in the mask.
|
|
1504
|
+
|
|
1505
|
+
Returns:
|
|
1506
|
+
int: The count of solid pixels.
|
|
1507
|
+
"""
|
|
1508
|
+
def get_outline(self) -> list[Vec2]:
|
|
1509
|
+
"""
|
|
1510
|
+
Get the outline points of the mask.
|
|
1511
|
+
|
|
1512
|
+
Returns a list of points that form the outline of all solid regions.
|
|
1513
|
+
|
|
1514
|
+
Returns:
|
|
1515
|
+
list[Vec2]: A list of outline points.
|
|
1516
|
+
"""
|
|
1517
|
+
def get_overlap_area(self, other: Mask, offset: typing.Any = None) -> int:
|
|
1518
|
+
"""
|
|
1519
|
+
Get the number of overlapping pixels between this mask and another.
|
|
1520
|
+
|
|
1521
|
+
Args:
|
|
1522
|
+
other (Mask): The other mask to check overlap with.
|
|
1523
|
+
offset (Vec2): Position offset between the masks. Defaults to (0, 0).
|
|
1524
|
+
|
|
1525
|
+
Returns:
|
|
1526
|
+
int: The number of overlapping solid pixels.
|
|
1527
|
+
"""
|
|
1528
|
+
def get_overlap_mask(self, other: Mask, offset: typing.Any = None) -> Mask:
|
|
1529
|
+
"""
|
|
1530
|
+
Get a mask representing the overlapping area between this mask and another.
|
|
1531
|
+
|
|
1532
|
+
Args:
|
|
1533
|
+
other (Mask): The other mask to check overlap with.
|
|
1534
|
+
offset (Vec2): Position offset between the masks. Defaults to (0, 0).
|
|
1535
|
+
|
|
1536
|
+
Returns:
|
|
1537
|
+
Mask: A new mask containing only the overlapping pixels.
|
|
1538
|
+
"""
|
|
1539
|
+
def get_pixel_array(self, color: typing.Any = None) -> PixelArray:
|
|
1540
|
+
"""
|
|
1541
|
+
Convert the mask to a pixel array with the specified color.
|
|
1542
|
+
|
|
1543
|
+
Solid pixels become the specified color, transparent pixels become transparent.
|
|
1544
|
+
|
|
1545
|
+
Args:
|
|
1546
|
+
color (Color): The color to use for solid pixels. Defaults to white (255, 255, 255, 255).
|
|
1547
|
+
|
|
1548
|
+
Returns:
|
|
1549
|
+
PixelArray: A new pixel array representation of the mask.
|
|
1550
|
+
|
|
1551
|
+
Raises:
|
|
1552
|
+
RuntimeError: If pixel array creation fails.
|
|
1553
|
+
"""
|
|
1554
|
+
def get_rect(self) -> Rect:
|
|
1555
|
+
"""
|
|
1556
|
+
Get the bounding rectangle of the mask starting at (0, 0).
|
|
1557
|
+
"""
|
|
1558
|
+
def invert(self) -> None:
|
|
1559
|
+
"""
|
|
1560
|
+
Invert all pixels in the mask.
|
|
1561
|
+
|
|
1562
|
+
Solid pixels become transparent and transparent pixels become solid.
|
|
1563
|
+
"""
|
|
1564
|
+
def is_empty(self) -> bool:
|
|
1565
|
+
"""
|
|
1566
|
+
Check if the mask contains no solid pixels.
|
|
1567
|
+
|
|
1568
|
+
Returns:
|
|
1569
|
+
bool: True if the mask is empty, False otherwise.
|
|
1570
|
+
"""
|
|
1571
|
+
def set_at(self, pos: Vec2, value: bool) -> None:
|
|
1572
|
+
"""
|
|
1573
|
+
Set the pixel value at a specific position.
|
|
1574
|
+
|
|
1575
|
+
Args:
|
|
1576
|
+
pos (Vec2): The position to set.
|
|
1577
|
+
value (bool): The pixel value (True for solid, False for transparent).
|
|
1578
|
+
"""
|
|
1579
|
+
def subtract(self, other: Mask, offset: typing.Any = None) -> None:
|
|
1580
|
+
"""
|
|
1581
|
+
Subtract another mask from this mask with an offset.
|
|
1582
|
+
|
|
1583
|
+
Removes pixels where the other mask has solid pixels.
|
|
1584
|
+
|
|
1585
|
+
Args:
|
|
1586
|
+
other (Mask): The mask to subtract.
|
|
1587
|
+
offset (Vec2): Position offset for the other mask. Defaults to (0, 0).
|
|
1588
|
+
"""
|
|
1589
|
+
@property
|
|
1590
|
+
def height(self) -> int:
|
|
1591
|
+
"""
|
|
1592
|
+
The height of the mask in pixels.
|
|
1593
|
+
"""
|
|
1594
|
+
@property
|
|
1595
|
+
def size(self) -> Vec2:
|
|
1596
|
+
"""
|
|
1597
|
+
The size of the mask as a Vec2.
|
|
1598
|
+
"""
|
|
1599
|
+
@property
|
|
1600
|
+
def width(self) -> int:
|
|
1601
|
+
"""
|
|
1602
|
+
The width of the mask in pixels.
|
|
1603
|
+
"""
|
|
1604
|
+
class MouseButton(enum.IntEnum):
|
|
1605
|
+
M_LEFT: typing.ClassVar[MouseButton] # value = <MouseButton.M_LEFT: 1>
|
|
1606
|
+
M_MIDDLE: typing.ClassVar[MouseButton] # value = <MouseButton.M_MIDDLE: 2>
|
|
1607
|
+
M_RIGHT: typing.ClassVar[MouseButton] # value = <MouseButton.M_RIGHT: 3>
|
|
1608
|
+
M_SIDE1: typing.ClassVar[MouseButton] # value = <MouseButton.M_SIDE1: 4>
|
|
1609
|
+
M_SIDE2: typing.ClassVar[MouseButton] # value = <MouseButton.M_SIDE2: 5>
|
|
1610
|
+
@classmethod
|
|
1611
|
+
def __new__(cls, value):
|
|
1612
|
+
...
|
|
1613
|
+
def __format__(self, format_spec):
|
|
1614
|
+
"""
|
|
1615
|
+
Convert to a string according to format_spec.
|
|
1616
|
+
"""
|
|
1617
|
+
class PenAxis(enum.IntEnum):
|
|
1618
|
+
P_DISTANCE: typing.ClassVar[PenAxis] # value = <PenAxis.P_DISTANCE: 3>
|
|
1619
|
+
P_PRESSURE: typing.ClassVar[PenAxis] # value = <PenAxis.P_PRESSURE: 0>
|
|
1620
|
+
P_ROTATION: typing.ClassVar[PenAxis] # value = <PenAxis.P_ROTATION: 4>
|
|
1621
|
+
P_SLIDER: typing.ClassVar[PenAxis] # value = <PenAxis.P_SLIDER: 5>
|
|
1622
|
+
P_TANGENTIAL_PRESSURE: typing.ClassVar[PenAxis] # value = <PenAxis.P_TANGENTIAL_PRESSURE: 6>
|
|
1623
|
+
P_TILT_X: typing.ClassVar[PenAxis] # value = <PenAxis.P_TILT_X: 1>
|
|
1624
|
+
P_TILT_Y: typing.ClassVar[PenAxis] # value = <PenAxis.P_TILT_Y: 2>
|
|
1625
|
+
@classmethod
|
|
1626
|
+
def __new__(cls, value):
|
|
1627
|
+
...
|
|
1628
|
+
def __format__(self, format_spec):
|
|
1629
|
+
"""
|
|
1630
|
+
Convert to a string according to format_spec.
|
|
1631
|
+
"""
|
|
1632
|
+
class PixelArray:
|
|
1633
|
+
"""
|
|
1634
|
+
|
|
1635
|
+
Represents a 2D pixel buffer for image manipulation and blitting operations.
|
|
1636
|
+
|
|
1637
|
+
A PixelArray is a 2D array of pixels that can be manipulated, drawn on, and used as a source
|
|
1638
|
+
for texture creation or blitting to other PixelArrays. Supports pixel-level operations,
|
|
1639
|
+
color key transparency, and alpha blending.
|
|
1640
|
+
|
|
1641
|
+
"""
|
|
1642
|
+
@typing.overload
|
|
1643
|
+
def __init__(self, size: Vec2) -> None:
|
|
1644
|
+
"""
|
|
1645
|
+
Create a new PixelArray with the specified dimensions.
|
|
1646
|
+
|
|
1647
|
+
Args:
|
|
1648
|
+
size (Vec2): The size of the pixel array as (width, height).
|
|
1649
|
+
|
|
1650
|
+
Raises:
|
|
1651
|
+
RuntimeError: If pixel array creation fails.
|
|
1652
|
+
"""
|
|
1653
|
+
@typing.overload
|
|
1654
|
+
def __init__(self, file_path: str) -> None:
|
|
1655
|
+
"""
|
|
1656
|
+
Create a PixelArray by loading an image from a file.
|
|
1657
|
+
|
|
1658
|
+
Args:
|
|
1659
|
+
file_path (str): Path to the image file to load.
|
|
1660
|
+
|
|
1661
|
+
Raises:
|
|
1662
|
+
RuntimeError: If the file cannot be loaded or doesn't exist.
|
|
1663
|
+
"""
|
|
1664
|
+
@typing.overload
|
|
1665
|
+
def blit(self, pixel_array: PixelArray, pos: Vec2, anchor: Anchor = Anchor.CENTER, src: typing.Any = None) -> None:
|
|
1666
|
+
"""
|
|
1667
|
+
Blit (copy) another pixel array onto this pixel array at the specified position with anchor alignment.
|
|
1668
|
+
|
|
1669
|
+
Args:
|
|
1670
|
+
pixel_array (PixelArray): The source pixel array to blit from.
|
|
1671
|
+
pos (Vec2): The position to blit to.
|
|
1672
|
+
anchor (Anchor, optional): The anchor point for positioning. Defaults to CENTER.
|
|
1673
|
+
src (Rect, optional): The source rectangle to blit from. Defaults to entire source pixel array.
|
|
1674
|
+
|
|
1675
|
+
Raises:
|
|
1676
|
+
RuntimeError: If the blit operation fails.
|
|
1677
|
+
"""
|
|
1678
|
+
@typing.overload
|
|
1679
|
+
def blit(self, pixel_array: PixelArray, dst: Rect, src: typing.Any = None) -> None:
|
|
1680
|
+
"""
|
|
1681
|
+
Blit (copy) another pixel array onto this pixel array with specified destination and source rectangles.
|
|
1682
|
+
|
|
1683
|
+
Args:
|
|
1684
|
+
pixel_array (PixelArray): The source pixel array to blit from.
|
|
1685
|
+
dst (Rect): The destination rectangle on this pixel array.
|
|
1686
|
+
src (Rect, optional): The source rectangle to blit from. Defaults to entire source pixel array.
|
|
1687
|
+
|
|
1688
|
+
Raises:
|
|
1689
|
+
RuntimeError: If the blit operation fails.
|
|
1690
|
+
"""
|
|
1691
|
+
def copy(self) -> PixelArray:
|
|
1692
|
+
"""
|
|
1693
|
+
Create a copy of this pixel array.
|
|
1694
|
+
|
|
1695
|
+
Returns:
|
|
1696
|
+
PixelArray: A new PixelArray that is an exact copy of this one.
|
|
1697
|
+
|
|
1698
|
+
Raises:
|
|
1699
|
+
RuntimeError: If pixel array copying fails.
|
|
1700
|
+
"""
|
|
1701
|
+
def fill(self, color: Color) -> None:
|
|
1702
|
+
"""
|
|
1703
|
+
Fill the entire pixel array with a solid color.
|
|
1704
|
+
|
|
1705
|
+
Args:
|
|
1706
|
+
color (Color): The color to fill the pixel array with.
|
|
1707
|
+
"""
|
|
1708
|
+
def get_at(self, coord: Vec2) -> Color:
|
|
1709
|
+
"""
|
|
1710
|
+
Get the color of a pixel at the specified coordinates.
|
|
1711
|
+
|
|
1712
|
+
Args:
|
|
1713
|
+
coord (Vec2): The coordinates of the pixel as (x, y).
|
|
1714
|
+
|
|
1715
|
+
Returns:
|
|
1716
|
+
Color: The color of the pixel at the specified coordinates.
|
|
1717
|
+
|
|
1718
|
+
Raises:
|
|
1719
|
+
IndexError: If coordinates are outside the pixel array bounds.
|
|
1720
|
+
"""
|
|
1721
|
+
def get_rect(self) -> Rect:
|
|
1722
|
+
"""
|
|
1723
|
+
Get a rectangle representing the pixel array bounds.
|
|
1724
|
+
|
|
1725
|
+
Returns:
|
|
1726
|
+
Rect: A rectangle with position (0, 0) and the pixel array's dimensions.
|
|
1727
|
+
"""
|
|
1728
|
+
def set_at(self, coord: Vec2, color: Color) -> None:
|
|
1729
|
+
"""
|
|
1730
|
+
Set the color of a pixel at the specified coordinates.
|
|
1731
|
+
|
|
1732
|
+
Args:
|
|
1733
|
+
coord (Vec2): The coordinates of the pixel as (x, y).
|
|
1734
|
+
color (Color): The color to set the pixel to.
|
|
1735
|
+
|
|
1736
|
+
Raises:
|
|
1737
|
+
IndexError: If coordinates are outside the pixel array bounds.
|
|
1738
|
+
"""
|
|
1739
|
+
@property
|
|
1740
|
+
def alpha_mod(self) -> int:
|
|
1741
|
+
"""
|
|
1742
|
+
The alpha modulation value for the pixel array.
|
|
1743
|
+
|
|
1744
|
+
Controls the overall transparency of the pixel array. Values range from 0 (fully transparent)
|
|
1745
|
+
to 255 (fully opaque).
|
|
1746
|
+
|
|
1747
|
+
Returns:
|
|
1748
|
+
int: The current alpha modulation value [0-255].
|
|
1749
|
+
|
|
1750
|
+
Raises:
|
|
1751
|
+
RuntimeError: If getting the alpha value fails.
|
|
1752
|
+
"""
|
|
1753
|
+
@alpha_mod.setter
|
|
1754
|
+
def alpha_mod(self, arg1: typing.SupportsInt) -> None:
|
|
1755
|
+
...
|
|
1756
|
+
@property
|
|
1757
|
+
def color_key(self) -> Color:
|
|
1758
|
+
"""
|
|
1759
|
+
The color key for transparency.
|
|
1760
|
+
|
|
1761
|
+
When set, pixels of this color will be treated as transparent during blitting operations.
|
|
1762
|
+
Used for simple transparency effects.
|
|
1763
|
+
|
|
1764
|
+
Returns:
|
|
1765
|
+
Color: The current color key.
|
|
1766
|
+
|
|
1767
|
+
Raises:
|
|
1768
|
+
RuntimeError: If getting the color key fails.
|
|
1769
|
+
"""
|
|
1770
|
+
@color_key.setter
|
|
1771
|
+
def color_key(self, arg1: Color) -> None:
|
|
1772
|
+
...
|
|
1773
|
+
@property
|
|
1774
|
+
def height(self) -> int:
|
|
1775
|
+
"""
|
|
1776
|
+
The height of the pixel array.
|
|
1777
|
+
|
|
1778
|
+
Returns:
|
|
1779
|
+
int: The pixel array height.
|
|
1780
|
+
"""
|
|
1781
|
+
@property
|
|
1782
|
+
def size(self) -> Vec2:
|
|
1783
|
+
"""
|
|
1784
|
+
The size of the pixel array as a Vec2.
|
|
1785
|
+
|
|
1786
|
+
Returns:
|
|
1787
|
+
Vec2: The pixel array size as (width, height).
|
|
1788
|
+
"""
|
|
1789
|
+
@property
|
|
1790
|
+
def width(self) -> int:
|
|
1791
|
+
"""
|
|
1792
|
+
The width of the pixel array.
|
|
1793
|
+
|
|
1794
|
+
Returns:
|
|
1795
|
+
int: The pixel array width.
|
|
1796
|
+
"""
|
|
1797
|
+
class PolarCoordinate:
|
|
1798
|
+
"""
|
|
1799
|
+
|
|
1800
|
+
Represents a polar coordinate with angle and radius components.
|
|
1801
|
+
|
|
1802
|
+
A polar coordinate system uses an angle (in radians) and radius to define a position
|
|
1803
|
+
relative to a fixed origin point.
|
|
1804
|
+
|
|
1805
|
+
"""
|
|
1806
|
+
def __eq__(self, arg0: PolarCoordinate) -> bool:
|
|
1807
|
+
"""
|
|
1808
|
+
Check if two PolarCoordinates are equal.
|
|
1809
|
+
|
|
1810
|
+
Args:
|
|
1811
|
+
other (PolarCoordinate): The other PolarCoordinate to compare.
|
|
1812
|
+
|
|
1813
|
+
Returns:
|
|
1814
|
+
bool: True if both angle and radius are equal.
|
|
1815
|
+
"""
|
|
1816
|
+
def __getitem__(self, index: typing.SupportsInt) -> float:
|
|
1817
|
+
"""
|
|
1818
|
+
Access polar coordinate components by index.
|
|
1819
|
+
|
|
1820
|
+
Args:
|
|
1821
|
+
index (int): Index (0=angle, 1=radius).
|
|
1822
|
+
|
|
1823
|
+
Returns:
|
|
1824
|
+
float: The component value.
|
|
1825
|
+
|
|
1826
|
+
Raises:
|
|
1827
|
+
IndexError: If index is not 0 or 1.
|
|
1828
|
+
"""
|
|
1829
|
+
def __hash__(self) -> int:
|
|
1830
|
+
"""
|
|
1831
|
+
Return a hash value for the PolarCoordinate.
|
|
1832
|
+
|
|
1833
|
+
Returns:
|
|
1834
|
+
int: Hash value based on angle and radius.
|
|
1835
|
+
"""
|
|
1836
|
+
@typing.overload
|
|
1837
|
+
def __init__(self) -> None:
|
|
1838
|
+
"""
|
|
1839
|
+
Create a PolarCoordinate with default values (0.0, 0.0).
|
|
1840
|
+
"""
|
|
1841
|
+
@typing.overload
|
|
1842
|
+
def __init__(self, angle: typing.SupportsFloat, radius: typing.SupportsFloat) -> None:
|
|
1843
|
+
"""
|
|
1844
|
+
Create a PolarCoordinate from angle and radius.
|
|
1845
|
+
|
|
1846
|
+
Args:
|
|
1847
|
+
angle (float): The angle in radians.
|
|
1848
|
+
radius (float): The radius/distance from origin.
|
|
1849
|
+
"""
|
|
1850
|
+
@typing.overload
|
|
1851
|
+
def __init__(self, arg0: collections.abc.Sequence) -> None:
|
|
1852
|
+
"""
|
|
1853
|
+
Create a PolarCoordinate from a sequence of two elements.
|
|
1854
|
+
|
|
1855
|
+
Args:
|
|
1856
|
+
sequence: A sequence (list, tuple) containing [angle, radius].
|
|
1857
|
+
|
|
1858
|
+
Raises:
|
|
1859
|
+
RuntimeError: If sequence doesn't contain exactly 2 elements.
|
|
1860
|
+
"""
|
|
1861
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
1862
|
+
"""
|
|
1863
|
+
Return an iterator over (angle, radius).
|
|
1864
|
+
|
|
1865
|
+
Returns:
|
|
1866
|
+
iterator: Iterator that yields angle first, then radius.
|
|
1867
|
+
"""
|
|
1868
|
+
def __len__(self) -> int:
|
|
1869
|
+
"""
|
|
1870
|
+
Return the number of components (always 2).
|
|
1871
|
+
|
|
1872
|
+
Returns:
|
|
1873
|
+
int: Always returns 2 (angle and radius).
|
|
1874
|
+
"""
|
|
1875
|
+
def __ne__(self, arg0: PolarCoordinate) -> bool:
|
|
1876
|
+
"""
|
|
1877
|
+
Check if two PolarCoordinates are not equal.
|
|
1878
|
+
|
|
1879
|
+
Args:
|
|
1880
|
+
other (PolarCoordinate): The other PolarCoordinate to compare.
|
|
1881
|
+
|
|
1882
|
+
Returns:
|
|
1883
|
+
bool: True if angle or radius are different.
|
|
1884
|
+
"""
|
|
1885
|
+
def __repr__(self) -> str:
|
|
1886
|
+
"""
|
|
1887
|
+
Return a string suitable for debugging and recreation.
|
|
1888
|
+
|
|
1889
|
+
Returns:
|
|
1890
|
+
str: String in format "PolarCoordinate(angle, radius)".
|
|
1891
|
+
"""
|
|
1892
|
+
def __setitem__(self, index: typing.SupportsInt, value: typing.SupportsFloat) -> None:
|
|
1893
|
+
"""
|
|
1894
|
+
Set polar coordinate components by index.
|
|
1895
|
+
|
|
1896
|
+
Args:
|
|
1897
|
+
index (int): Index (0=angle, 1=radius).
|
|
1898
|
+
value (float): The new value to set.
|
|
1899
|
+
|
|
1900
|
+
Raises:
|
|
1901
|
+
IndexError: If index is not 0 or 1.
|
|
1902
|
+
"""
|
|
1903
|
+
def __str__(self) -> str:
|
|
1904
|
+
"""
|
|
1905
|
+
Return a human-readable string representation.
|
|
1906
|
+
|
|
1907
|
+
Returns:
|
|
1908
|
+
str: String in format "(angle, radius)".
|
|
1909
|
+
"""
|
|
1910
|
+
def to_cartesian(self) -> Vec2:
|
|
1911
|
+
"""
|
|
1912
|
+
Convert polar coordinates to Cartesian coordinates.
|
|
1913
|
+
|
|
1914
|
+
Returns:
|
|
1915
|
+
Vec2: The equivalent Cartesian coordinates as a Vec2.
|
|
1916
|
+
"""
|
|
1917
|
+
@property
|
|
1918
|
+
def angle(self) -> float:
|
|
1919
|
+
"""
|
|
1920
|
+
The angle component in radians.
|
|
1921
|
+
"""
|
|
1922
|
+
@angle.setter
|
|
1923
|
+
def angle(self, arg0: typing.SupportsFloat) -> None:
|
|
1924
|
+
...
|
|
1925
|
+
@property
|
|
1926
|
+
def radius(self) -> float:
|
|
1927
|
+
"""
|
|
1928
|
+
The radius component (distance from origin).
|
|
1929
|
+
"""
|
|
1930
|
+
@radius.setter
|
|
1931
|
+
def radius(self, arg0: typing.SupportsFloat) -> None:
|
|
1932
|
+
...
|
|
1933
|
+
class Polygon:
|
|
1934
|
+
"""
|
|
1935
|
+
|
|
1936
|
+
Represents a polygon shape defined by a sequence of points.
|
|
1937
|
+
|
|
1938
|
+
A polygon is a closed shape made up of connected line segments. The points define
|
|
1939
|
+
the vertices of the polygon in order. Supports various geometric operations.
|
|
1940
|
+
|
|
1941
|
+
"""
|
|
1942
|
+
def __getitem__(self, index: typing.SupportsInt) -> Vec2:
|
|
1943
|
+
"""
|
|
1944
|
+
Get a point by index.
|
|
1945
|
+
|
|
1946
|
+
Args:
|
|
1947
|
+
index (int): The index of the point to retrieve.
|
|
1948
|
+
|
|
1949
|
+
Returns:
|
|
1950
|
+
Vec2: The point at the specified index.
|
|
1951
|
+
|
|
1952
|
+
Raises:
|
|
1953
|
+
IndexError: If index is out of range.
|
|
1954
|
+
"""
|
|
1955
|
+
@typing.overload
|
|
1956
|
+
def __init__(self) -> None:
|
|
1957
|
+
"""
|
|
1958
|
+
Create an empty polygon with no points.
|
|
1959
|
+
"""
|
|
1960
|
+
@typing.overload
|
|
1961
|
+
def __init__(self, points: collections.abc.Sequence[Vec2]) -> None:
|
|
1962
|
+
"""
|
|
1963
|
+
Create a polygon from a vector of Vec2 points.
|
|
1964
|
+
|
|
1965
|
+
Args:
|
|
1966
|
+
points (list[Vec2]): List of Vec2 points defining the polygon vertices.
|
|
1967
|
+
"""
|
|
1968
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
1969
|
+
"""
|
|
1970
|
+
Return an iterator over the polygon's points.
|
|
1971
|
+
"""
|
|
1972
|
+
def __len__(self) -> int:
|
|
1973
|
+
"""
|
|
1974
|
+
Return the number of points in the polygon.
|
|
1975
|
+
|
|
1976
|
+
Returns:
|
|
1977
|
+
int: The number of vertices.
|
|
1978
|
+
"""
|
|
1979
|
+
def copy(self) -> Polygon:
|
|
1980
|
+
"""
|
|
1981
|
+
Return a copy of the polygon.
|
|
1982
|
+
|
|
1983
|
+
Returns:
|
|
1984
|
+
Polygon: A new polygon with the same points.
|
|
1985
|
+
"""
|
|
1986
|
+
@property
|
|
1987
|
+
def points(self) -> list[Vec2]:
|
|
1988
|
+
"""
|
|
1989
|
+
The list of Vec2 points that define the polygon vertices.
|
|
1990
|
+
"""
|
|
1991
|
+
@points.setter
|
|
1992
|
+
def points(self, arg0: collections.abc.Sequence[Vec2]) -> None:
|
|
1993
|
+
...
|
|
1994
|
+
class Rect:
|
|
1995
|
+
"""
|
|
1996
|
+
|
|
1997
|
+
Represents a rectangle with position and size.
|
|
1998
|
+
|
|
1999
|
+
A Rect is defined by its top-left corner position (x, y) and dimensions (w, h).
|
|
2000
|
+
Supports various geometric operations, collision detection, and positioning methods.
|
|
2001
|
+
|
|
2002
|
+
"""
|
|
2003
|
+
__hash__: typing.ClassVar[None] = None
|
|
2004
|
+
def __bool__(self) -> bool:
|
|
2005
|
+
"""
|
|
2006
|
+
Check if the rectangle has positive area.
|
|
2007
|
+
|
|
2008
|
+
Returns:
|
|
2009
|
+
bool: True if both width and height are greater than 0.
|
|
2010
|
+
"""
|
|
2011
|
+
def __eq__(self, other: Rect) -> bool:
|
|
2012
|
+
"""
|
|
2013
|
+
Check if two rectangles are equal.
|
|
2014
|
+
|
|
2015
|
+
Args:
|
|
2016
|
+
other (Rect): The other rectangle to compare.
|
|
2017
|
+
|
|
2018
|
+
Returns:
|
|
2019
|
+
bool: True if all components (x, y, w, h) are equal.
|
|
2020
|
+
"""
|
|
2021
|
+
def __getitem__(self, index: typing.SupportsInt) -> float:
|
|
2022
|
+
"""
|
|
2023
|
+
Access rectangle components by index.
|
|
2024
|
+
|
|
2025
|
+
Args:
|
|
2026
|
+
index (int): Index (0=x, 1=y, 2=w, 3=h).
|
|
2027
|
+
|
|
2028
|
+
Returns:
|
|
2029
|
+
float: The component value.
|
|
2030
|
+
|
|
2031
|
+
Raises:
|
|
2032
|
+
IndexError: If index is not 0, 1, 2, or 3.
|
|
2033
|
+
"""
|
|
2034
|
+
@typing.overload
|
|
2035
|
+
def __init__(self) -> None:
|
|
2036
|
+
"""
|
|
2037
|
+
Create a Rect with default values (0, 0, 0, 0).
|
|
2038
|
+
"""
|
|
2039
|
+
@typing.overload
|
|
2040
|
+
def __init__(self, x: typing.SupportsFloat, y: typing.SupportsFloat, w: typing.SupportsFloat, h: typing.SupportsFloat) -> None:
|
|
2041
|
+
"""
|
|
2042
|
+
Create a Rect with specified position and dimensions.
|
|
2043
|
+
|
|
2044
|
+
Args:
|
|
2045
|
+
x (float): The x coordinate of the top-left corner.
|
|
2046
|
+
y (float): The y coordinate of the top-left corner.
|
|
2047
|
+
w (float): The width of the rectangle.
|
|
2048
|
+
h (float): The height of the rectangle.
|
|
2049
|
+
"""
|
|
2050
|
+
@typing.overload
|
|
2051
|
+
def __init__(self, x: typing.SupportsFloat, y: typing.SupportsFloat, size: Vec2) -> None:
|
|
2052
|
+
"""
|
|
2053
|
+
Create a Rect with specified position and size vector.
|
|
2054
|
+
|
|
2055
|
+
Args:
|
|
2056
|
+
x (float): The x coordinate of the top-left corner.
|
|
2057
|
+
y (float): The y coordinate of the top-left corner.
|
|
2058
|
+
size (Vec2): The size as a Vec2 (width, height).
|
|
2059
|
+
"""
|
|
2060
|
+
@typing.overload
|
|
2061
|
+
def __init__(self, pos: Vec2, w: typing.SupportsFloat, h: typing.SupportsFloat) -> None:
|
|
2062
|
+
"""
|
|
2063
|
+
Create a Rect with specified position vector and dimensions.
|
|
2064
|
+
|
|
2065
|
+
Args:
|
|
2066
|
+
pos (Vec2): The position as a Vec2 (x, y).
|
|
2067
|
+
w (float): The width of the rectangle.
|
|
2068
|
+
h (float): The height of the rectangle.
|
|
2069
|
+
"""
|
|
2070
|
+
@typing.overload
|
|
2071
|
+
def __init__(self, pos: Vec2, size: Vec2) -> None:
|
|
2072
|
+
"""
|
|
2073
|
+
Create a Rect with specified position and size vectors.
|
|
2074
|
+
|
|
2075
|
+
Args:
|
|
2076
|
+
pos (Vec2): The position as a Vec2 (x, y).
|
|
2077
|
+
size (Vec2): The size as a Vec2 (width, height).
|
|
2078
|
+
"""
|
|
2079
|
+
@typing.overload
|
|
2080
|
+
def __init__(self, arg0: collections.abc.Sequence) -> None:
|
|
2081
|
+
"""
|
|
2082
|
+
Create a Rect from a sequence of four elements.
|
|
2083
|
+
|
|
2084
|
+
Args:
|
|
2085
|
+
sequence: A sequence (list, tuple) containing [x, y, w, h].
|
|
2086
|
+
|
|
2087
|
+
Raises:
|
|
2088
|
+
RuntimeError: If sequence doesn't contain exactly 4 elements.
|
|
2089
|
+
"""
|
|
2090
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
2091
|
+
"""
|
|
2092
|
+
Return an iterator over (x, y, w, h).
|
|
2093
|
+
|
|
2094
|
+
Returns:
|
|
2095
|
+
iterator: Iterator that yields x, y, w, h in order.
|
|
2096
|
+
"""
|
|
2097
|
+
def __len__(self) -> int:
|
|
2098
|
+
"""
|
|
2099
|
+
Return the number of components (always 4).
|
|
2100
|
+
|
|
2101
|
+
Returns:
|
|
2102
|
+
int: Always returns 4 (x, y, w, h).
|
|
2103
|
+
"""
|
|
2104
|
+
def __ne__(self, other: Rect) -> bool:
|
|
2105
|
+
"""
|
|
2106
|
+
Check if two rectangles are not equal.
|
|
2107
|
+
|
|
2108
|
+
Args:
|
|
2109
|
+
other (Rect): The other rectangle to compare.
|
|
2110
|
+
|
|
2111
|
+
Returns:
|
|
2112
|
+
bool: True if any component differs.
|
|
2113
|
+
"""
|
|
2114
|
+
def __repr__(self) -> str:
|
|
2115
|
+
"""
|
|
2116
|
+
Return a string suitable for debugging and recreation.
|
|
2117
|
+
|
|
2118
|
+
Returns:
|
|
2119
|
+
str: String in format "Rect(x=..., y=..., w=..., h=...)".
|
|
2120
|
+
"""
|
|
2121
|
+
def __str__(self) -> str:
|
|
2122
|
+
"""
|
|
2123
|
+
Return a human-readable string representation.
|
|
2124
|
+
|
|
2125
|
+
Returns:
|
|
2126
|
+
str: String in format "[x, y, w, h]".
|
|
2127
|
+
"""
|
|
2128
|
+
@typing.overload
|
|
2129
|
+
def clamp(self, other: Rect) -> None:
|
|
2130
|
+
"""
|
|
2131
|
+
Clamp this rectangle to be within another rectangle.
|
|
2132
|
+
|
|
2133
|
+
Args:
|
|
2134
|
+
other (Rect): The rectangle to clamp within.
|
|
2135
|
+
|
|
2136
|
+
Raises:
|
|
2137
|
+
ValueError: If this rectangle is larger than the clamp area.
|
|
2138
|
+
"""
|
|
2139
|
+
@typing.overload
|
|
2140
|
+
def clamp(self, min: Vec2, max: Vec2) -> None:
|
|
2141
|
+
"""
|
|
2142
|
+
Clamp this rectangle to be within the specified bounds.
|
|
2143
|
+
|
|
2144
|
+
Args:
|
|
2145
|
+
min (Vec2): The minimum bounds as (min_x, min_y).
|
|
2146
|
+
max (Vec2): The maximum bounds as (max_x, max_y).
|
|
2147
|
+
|
|
2148
|
+
Raises:
|
|
2149
|
+
ValueError: If min >= max or rectangle is larger than the clamp area.
|
|
2150
|
+
"""
|
|
2151
|
+
def collide_point(self, point: Vec2) -> bool:
|
|
2152
|
+
"""
|
|
2153
|
+
Check if a point is inside this rectangle.
|
|
2154
|
+
|
|
2155
|
+
Args:
|
|
2156
|
+
point (Vec2): The point to check.
|
|
2157
|
+
|
|
2158
|
+
Returns:
|
|
2159
|
+
bool: True if the point is inside this rectangle.
|
|
2160
|
+
"""
|
|
2161
|
+
def collide_rect(self, other: Rect) -> bool:
|
|
2162
|
+
"""
|
|
2163
|
+
Check if this rectangle collides with another rectangle.
|
|
2164
|
+
|
|
2165
|
+
Args:
|
|
2166
|
+
other (Rect): The rectangle to check collision with.
|
|
2167
|
+
|
|
2168
|
+
Returns:
|
|
2169
|
+
bool: True if the rectangles overlap.
|
|
2170
|
+
"""
|
|
2171
|
+
def contains(self, other: Rect) -> bool:
|
|
2172
|
+
"""
|
|
2173
|
+
Check if this rectangle completely contains another rectangle.
|
|
2174
|
+
|
|
2175
|
+
Args:
|
|
2176
|
+
other (Rect): The rectangle to check.
|
|
2177
|
+
|
|
2178
|
+
Returns:
|
|
2179
|
+
bool: True if this rectangle completely contains the other.
|
|
2180
|
+
"""
|
|
2181
|
+
def copy(self) -> Rect:
|
|
2182
|
+
"""
|
|
2183
|
+
Create a copy of this rectangle.
|
|
2184
|
+
|
|
2185
|
+
Returns:
|
|
2186
|
+
Rect: A new Rect with the same position and size.
|
|
2187
|
+
"""
|
|
2188
|
+
def fit(self, other: Rect) -> None:
|
|
2189
|
+
"""
|
|
2190
|
+
Scale this rectangle to fit inside another rectangle while maintaining aspect ratio.
|
|
2191
|
+
|
|
2192
|
+
Args:
|
|
2193
|
+
other (Rect): The rectangle to fit inside.
|
|
2194
|
+
|
|
2195
|
+
Raises:
|
|
2196
|
+
ValueError: If other rectangle has non-positive dimensions.
|
|
2197
|
+
"""
|
|
2198
|
+
def inflate(self, offset: Vec2) -> None:
|
|
2199
|
+
"""
|
|
2200
|
+
Inflate the rectangle by the given offset.
|
|
2201
|
+
|
|
2202
|
+
The rectangle grows in all directions. The position is adjusted to keep the center
|
|
2203
|
+
in the same place.
|
|
2204
|
+
|
|
2205
|
+
Args:
|
|
2206
|
+
offset (Vec2): The amount to inflate by as (dw, dh).
|
|
2207
|
+
"""
|
|
2208
|
+
def move(self, offset: Vec2) -> None:
|
|
2209
|
+
"""
|
|
2210
|
+
Move the rectangle by the given offset.
|
|
2211
|
+
|
|
2212
|
+
Args:
|
|
2213
|
+
offset (Vec2): The offset to move by as (dx, dy).
|
|
2214
|
+
"""
|
|
2215
|
+
@typing.overload
|
|
2216
|
+
def scale_by(self, factor: typing.SupportsFloat) -> None:
|
|
2217
|
+
"""
|
|
2218
|
+
Scale the rectangle by a uniform factor.
|
|
2219
|
+
|
|
2220
|
+
Args:
|
|
2221
|
+
factor (float): The scaling factor (must be > 0).
|
|
2222
|
+
|
|
2223
|
+
Raises:
|
|
2224
|
+
ValueError: If factor is <= 0.
|
|
2225
|
+
"""
|
|
2226
|
+
@typing.overload
|
|
2227
|
+
def scale_by(self, factor: Vec2) -> None:
|
|
2228
|
+
"""
|
|
2229
|
+
Scale the rectangle by different factors for width and height.
|
|
2230
|
+
|
|
2231
|
+
Args:
|
|
2232
|
+
factor (Vec2): The scaling factors as (scale_x, scale_y).
|
|
2233
|
+
|
|
2234
|
+
Raises:
|
|
2235
|
+
ValueError: If any factor is <= 0.
|
|
2236
|
+
"""
|
|
2237
|
+
def scale_to(self, size: Vec2) -> None:
|
|
2238
|
+
"""
|
|
2239
|
+
Scale the rectangle to the specified size.
|
|
2240
|
+
|
|
2241
|
+
Args:
|
|
2242
|
+
size (Vec2): The new size as (width, height).
|
|
2243
|
+
|
|
2244
|
+
Raises:
|
|
2245
|
+
ValueError: If width or height is <= 0.
|
|
2246
|
+
"""
|
|
2247
|
+
@property
|
|
2248
|
+
def bottom(self) -> float:
|
|
2249
|
+
"""
|
|
2250
|
+
The y coordinate of the bottom edge.
|
|
2251
|
+
"""
|
|
2252
|
+
@bottom.setter
|
|
2253
|
+
def bottom(self, arg1: typing.SupportsFloat) -> None:
|
|
2254
|
+
...
|
|
2255
|
+
@property
|
|
2256
|
+
def bottom_left(self) -> Vec2:
|
|
2257
|
+
"""
|
|
2258
|
+
The position of the bottom-left corner as (x, y).
|
|
2259
|
+
"""
|
|
2260
|
+
@bottom_left.setter
|
|
2261
|
+
def bottom_left(self, arg1: Vec2) -> None:
|
|
2262
|
+
...
|
|
2263
|
+
@property
|
|
2264
|
+
def bottom_mid(self) -> Vec2:
|
|
2265
|
+
"""
|
|
2266
|
+
The position of the bottom-middle point as (x, y).
|
|
2267
|
+
"""
|
|
2268
|
+
@bottom_mid.setter
|
|
2269
|
+
def bottom_mid(self, arg1: Vec2) -> None:
|
|
2270
|
+
...
|
|
2271
|
+
@property
|
|
2272
|
+
def bottom_right(self) -> Vec2:
|
|
2273
|
+
"""
|
|
2274
|
+
The position of the bottom-right corner as (x, y).
|
|
2275
|
+
"""
|
|
2276
|
+
@bottom_right.setter
|
|
2277
|
+
def bottom_right(self, arg1: Vec2) -> None:
|
|
2278
|
+
...
|
|
2279
|
+
@property
|
|
2280
|
+
def center(self) -> Vec2:
|
|
2281
|
+
"""
|
|
2282
|
+
The position of the center point as (x, y).
|
|
2283
|
+
"""
|
|
2284
|
+
@center.setter
|
|
2285
|
+
def center(self, arg1: Vec2) -> None:
|
|
2286
|
+
...
|
|
2287
|
+
@property
|
|
2288
|
+
def h(self) -> float:
|
|
2289
|
+
"""
|
|
2290
|
+
The height of the rectangle.
|
|
2291
|
+
"""
|
|
2292
|
+
@h.setter
|
|
2293
|
+
def h(self, arg0: typing.SupportsFloat) -> None:
|
|
2294
|
+
...
|
|
2295
|
+
@property
|
|
2296
|
+
def left(self) -> float:
|
|
2297
|
+
"""
|
|
2298
|
+
The x coordinate of the left edge.
|
|
2299
|
+
"""
|
|
2300
|
+
@left.setter
|
|
2301
|
+
def left(self, arg1: typing.SupportsFloat) -> None:
|
|
2302
|
+
...
|
|
2303
|
+
@property
|
|
2304
|
+
def mid_left(self) -> Vec2:
|
|
2305
|
+
"""
|
|
2306
|
+
The position of the middle-left point as (x, y).
|
|
2307
|
+
"""
|
|
2308
|
+
@mid_left.setter
|
|
2309
|
+
def mid_left(self, arg1: Vec2) -> None:
|
|
2310
|
+
...
|
|
2311
|
+
@property
|
|
2312
|
+
def mid_right(self) -> Vec2:
|
|
2313
|
+
"""
|
|
2314
|
+
The position of the middle-right point as (x, y).
|
|
2315
|
+
"""
|
|
2316
|
+
@mid_right.setter
|
|
2317
|
+
def mid_right(self, arg1: Vec2) -> None:
|
|
2318
|
+
...
|
|
2319
|
+
@property
|
|
2320
|
+
def right(self) -> float:
|
|
2321
|
+
"""
|
|
2322
|
+
The x coordinate of the right edge.
|
|
2323
|
+
"""
|
|
2324
|
+
@right.setter
|
|
2325
|
+
def right(self, arg1: typing.SupportsFloat) -> None:
|
|
2326
|
+
...
|
|
2327
|
+
@property
|
|
2328
|
+
def size(self) -> Vec2:
|
|
2329
|
+
"""
|
|
2330
|
+
The size of the rectangle as (width, height).
|
|
2331
|
+
"""
|
|
2332
|
+
@size.setter
|
|
2333
|
+
def size(self, arg1: Vec2) -> None:
|
|
2334
|
+
...
|
|
2335
|
+
@property
|
|
2336
|
+
def top(self) -> float:
|
|
2337
|
+
"""
|
|
2338
|
+
The y coordinate of the top edge.
|
|
2339
|
+
"""
|
|
2340
|
+
@top.setter
|
|
2341
|
+
def top(self, arg1: typing.SupportsFloat) -> None:
|
|
2342
|
+
...
|
|
2343
|
+
@property
|
|
2344
|
+
def top_left(self) -> Vec2:
|
|
2345
|
+
"""
|
|
2346
|
+
The position of the top-left corner as (x, y).
|
|
2347
|
+
"""
|
|
2348
|
+
@top_left.setter
|
|
2349
|
+
def top_left(self, arg1: Vec2) -> None:
|
|
2350
|
+
...
|
|
2351
|
+
@property
|
|
2352
|
+
def top_mid(self) -> Vec2:
|
|
2353
|
+
"""
|
|
2354
|
+
The position of the top-middle point as (x, y).
|
|
2355
|
+
"""
|
|
2356
|
+
@top_mid.setter
|
|
2357
|
+
def top_mid(self, arg1: Vec2) -> None:
|
|
2358
|
+
...
|
|
2359
|
+
@property
|
|
2360
|
+
def top_right(self) -> Vec2:
|
|
2361
|
+
"""
|
|
2362
|
+
The position of the top-right corner as (x, y).
|
|
2363
|
+
"""
|
|
2364
|
+
@top_right.setter
|
|
2365
|
+
def top_right(self, arg1: Vec2) -> None:
|
|
2366
|
+
...
|
|
2367
|
+
@property
|
|
2368
|
+
def w(self) -> float:
|
|
2369
|
+
"""
|
|
2370
|
+
The width of the rectangle.
|
|
2371
|
+
"""
|
|
2372
|
+
@w.setter
|
|
2373
|
+
def w(self, arg0: typing.SupportsFloat) -> None:
|
|
2374
|
+
...
|
|
2375
|
+
@property
|
|
2376
|
+
def x(self) -> float:
|
|
2377
|
+
"""
|
|
2378
|
+
The x coordinate of the top-left corner.
|
|
2379
|
+
"""
|
|
2380
|
+
@x.setter
|
|
2381
|
+
def x(self, arg0: typing.SupportsFloat) -> None:
|
|
2382
|
+
...
|
|
2383
|
+
@property
|
|
2384
|
+
def y(self) -> float:
|
|
2385
|
+
"""
|
|
2386
|
+
The y coordinate of the top-left corner.
|
|
2387
|
+
"""
|
|
2388
|
+
@y.setter
|
|
2389
|
+
def y(self, arg0: typing.SupportsFloat) -> None:
|
|
2390
|
+
...
|
|
2391
|
+
class Scancode(enum.IntEnum):
|
|
2392
|
+
S_0: typing.ClassVar[Scancode] # value = <Scancode.S_0: 39>
|
|
2393
|
+
S_1: typing.ClassVar[Scancode] # value = <Scancode.S_1: 30>
|
|
2394
|
+
S_2: typing.ClassVar[Scancode] # value = <Scancode.S_2: 31>
|
|
2395
|
+
S_3: typing.ClassVar[Scancode] # value = <Scancode.S_3: 32>
|
|
2396
|
+
S_4: typing.ClassVar[Scancode] # value = <Scancode.S_4: 33>
|
|
2397
|
+
S_5: typing.ClassVar[Scancode] # value = <Scancode.S_5: 34>
|
|
2398
|
+
S_6: typing.ClassVar[Scancode] # value = <Scancode.S_6: 35>
|
|
2399
|
+
S_7: typing.ClassVar[Scancode] # value = <Scancode.S_7: 36>
|
|
2400
|
+
S_8: typing.ClassVar[Scancode] # value = <Scancode.S_8: 37>
|
|
2401
|
+
S_9: typing.ClassVar[Scancode] # value = <Scancode.S_9: 38>
|
|
2402
|
+
S_AGAIN: typing.ClassVar[Scancode] # value = <Scancode.S_AGAIN: 121>
|
|
2403
|
+
S_APOSTROPHE: typing.ClassVar[Scancode] # value = <Scancode.S_APOSTROPHE: 52>
|
|
2404
|
+
S_BACKSLASH: typing.ClassVar[Scancode] # value = <Scancode.S_BACKSLASH: 49>
|
|
2405
|
+
S_BACKSPACE: typing.ClassVar[Scancode] # value = <Scancode.S_BACKSPACE: 42>
|
|
2406
|
+
S_CAPS: typing.ClassVar[Scancode] # value = <Scancode.S_CAPS: 57>
|
|
2407
|
+
S_COMMA: typing.ClassVar[Scancode] # value = <Scancode.S_COMMA: 54>
|
|
2408
|
+
S_COPY: typing.ClassVar[Scancode] # value = <Scancode.S_COPY: 124>
|
|
2409
|
+
S_CUT: typing.ClassVar[Scancode] # value = <Scancode.S_CUT: 123>
|
|
2410
|
+
S_DEL: typing.ClassVar[Scancode] # value = <Scancode.S_DEL: 76>
|
|
2411
|
+
S_DOWN: typing.ClassVar[Scancode] # value = <Scancode.S_DOWN: 81>
|
|
2412
|
+
S_END: typing.ClassVar[Scancode] # value = <Scancode.S_END: 77>
|
|
2413
|
+
S_EQ: typing.ClassVar[Scancode] # value = <Scancode.S_EQ: 46>
|
|
2414
|
+
S_ESC: typing.ClassVar[Scancode] # value = <Scancode.S_ESC: 41>
|
|
2415
|
+
S_F1: typing.ClassVar[Scancode] # value = <Scancode.S_F1: 58>
|
|
2416
|
+
S_F10: typing.ClassVar[Scancode] # value = <Scancode.S_F10: 67>
|
|
2417
|
+
S_F11: typing.ClassVar[Scancode] # value = <Scancode.S_F11: 68>
|
|
2418
|
+
S_F12: typing.ClassVar[Scancode] # value = <Scancode.S_F12: 69>
|
|
2419
|
+
S_F2: typing.ClassVar[Scancode] # value = <Scancode.S_F2: 59>
|
|
2420
|
+
S_F3: typing.ClassVar[Scancode] # value = <Scancode.S_F3: 60>
|
|
2421
|
+
S_F4: typing.ClassVar[Scancode] # value = <Scancode.S_F4: 61>
|
|
2422
|
+
S_F5: typing.ClassVar[Scancode] # value = <Scancode.S_F5: 62>
|
|
2423
|
+
S_F6: typing.ClassVar[Scancode] # value = <Scancode.S_F6: 63>
|
|
2424
|
+
S_F7: typing.ClassVar[Scancode] # value = <Scancode.S_F7: 64>
|
|
2425
|
+
S_F8: typing.ClassVar[Scancode] # value = <Scancode.S_F8: 65>
|
|
2426
|
+
S_F9: typing.ClassVar[Scancode] # value = <Scancode.S_F9: 66>
|
|
2427
|
+
S_FIND: typing.ClassVar[Scancode] # value = <Scancode.S_FIND: 126>
|
|
2428
|
+
S_GRAVE: typing.ClassVar[Scancode] # value = <Scancode.S_GRAVE: 53>
|
|
2429
|
+
S_HOME: typing.ClassVar[Scancode] # value = <Scancode.S_HOME: 74>
|
|
2430
|
+
S_INS: typing.ClassVar[Scancode] # value = <Scancode.S_INS: 73>
|
|
2431
|
+
S_KP_0: typing.ClassVar[Scancode] # value = <Scancode.S_KP_0: 98>
|
|
2432
|
+
S_KP_1: typing.ClassVar[Scancode] # value = <Scancode.S_KP_1: 89>
|
|
2433
|
+
S_KP_2: typing.ClassVar[Scancode] # value = <Scancode.S_KP_2: 90>
|
|
2434
|
+
S_KP_3: typing.ClassVar[Scancode] # value = <Scancode.S_KP_3: 91>
|
|
2435
|
+
S_KP_4: typing.ClassVar[Scancode] # value = <Scancode.S_KP_4: 92>
|
|
2436
|
+
S_KP_5: typing.ClassVar[Scancode] # value = <Scancode.S_KP_5: 93>
|
|
2437
|
+
S_KP_6: typing.ClassVar[Scancode] # value = <Scancode.S_KP_6: 94>
|
|
2438
|
+
S_KP_7: typing.ClassVar[Scancode] # value = <Scancode.S_KP_7: 95>
|
|
2439
|
+
S_KP_8: typing.ClassVar[Scancode] # value = <Scancode.S_KP_8: 96>
|
|
2440
|
+
S_KP_9: typing.ClassVar[Scancode] # value = <Scancode.S_KP_9: 97>
|
|
2441
|
+
S_KP_DIV: typing.ClassVar[Scancode] # value = <Scancode.S_KP_DIV: 84>
|
|
2442
|
+
S_KP_ENTER: typing.ClassVar[Scancode] # value = <Scancode.S_KP_ENTER: 88>
|
|
2443
|
+
S_KP_MINUS: typing.ClassVar[Scancode] # value = <Scancode.S_KP_MINUS: 86>
|
|
2444
|
+
S_KP_MULT: typing.ClassVar[Scancode] # value = <Scancode.S_KP_MULT: 85>
|
|
2445
|
+
S_KP_PERIOD: typing.ClassVar[Scancode] # value = <Scancode.S_KP_PERIOD: 99>
|
|
2446
|
+
S_KP_PLUS: typing.ClassVar[Scancode] # value = <Scancode.S_KP_PLUS: 87>
|
|
2447
|
+
S_LALT: typing.ClassVar[Scancode] # value = <Scancode.S_LALT: 226>
|
|
2448
|
+
S_LBRACKET: typing.ClassVar[Scancode] # value = <Scancode.S_LBRACKET: 47>
|
|
2449
|
+
S_LCTRL: typing.ClassVar[Scancode] # value = <Scancode.S_LCTRL: 224>
|
|
2450
|
+
S_LEFT: typing.ClassVar[Scancode] # value = <Scancode.S_LEFT: 80>
|
|
2451
|
+
S_LGUI: typing.ClassVar[Scancode] # value = <Scancode.S_LGUI: 227>
|
|
2452
|
+
S_LSHIFT: typing.ClassVar[Scancode] # value = <Scancode.S_LSHIFT: 225>
|
|
2453
|
+
S_MINUS: typing.ClassVar[Scancode] # value = <Scancode.S_MINUS: 45>
|
|
2454
|
+
S_MUTE: typing.ClassVar[Scancode] # value = <Scancode.S_MUTE: 127>
|
|
2455
|
+
S_NUMLOCK: typing.ClassVar[Scancode] # value = <Scancode.S_NUMLOCK: 83>
|
|
2456
|
+
S_PASTE: typing.ClassVar[Scancode] # value = <Scancode.S_PASTE: 125>
|
|
2457
|
+
S_PAUSE: typing.ClassVar[Scancode] # value = <Scancode.S_PAUSE: 72>
|
|
2458
|
+
S_PERIOD: typing.ClassVar[Scancode] # value = <Scancode.S_PERIOD: 55>
|
|
2459
|
+
S_PGDOWN: typing.ClassVar[Scancode] # value = <Scancode.S_PGDOWN: 78>
|
|
2460
|
+
S_PGUP: typing.ClassVar[Scancode] # value = <Scancode.S_PGUP: 75>
|
|
2461
|
+
S_PRTSCR: typing.ClassVar[Scancode] # value = <Scancode.S_PRTSCR: 70>
|
|
2462
|
+
S_RALT: typing.ClassVar[Scancode] # value = <Scancode.S_RALT: 230>
|
|
2463
|
+
S_RBRACKET: typing.ClassVar[Scancode] # value = <Scancode.S_RBRACKET: 48>
|
|
2464
|
+
S_RCTRL: typing.ClassVar[Scancode] # value = <Scancode.S_RCTRL: 228>
|
|
2465
|
+
S_RETURN: typing.ClassVar[Scancode] # value = <Scancode.S_RETURN: 40>
|
|
2466
|
+
S_RGUI: typing.ClassVar[Scancode] # value = <Scancode.S_RGUI: 231>
|
|
2467
|
+
S_RIGHT: typing.ClassVar[Scancode] # value = <Scancode.S_RIGHT: 79>
|
|
2468
|
+
S_RSHIFT: typing.ClassVar[Scancode] # value = <Scancode.S_RSHIFT: 229>
|
|
2469
|
+
S_SCRLK: typing.ClassVar[Scancode] # value = <Scancode.S_SCRLK: 71>
|
|
2470
|
+
S_SEMICOLON: typing.ClassVar[Scancode] # value = <Scancode.S_SEMICOLON: 51>
|
|
2471
|
+
S_SLASH: typing.ClassVar[Scancode] # value = <Scancode.S_SLASH: 56>
|
|
2472
|
+
S_SPACE: typing.ClassVar[Scancode] # value = <Scancode.S_SPACE: 44>
|
|
2473
|
+
S_TAB: typing.ClassVar[Scancode] # value = <Scancode.S_TAB: 43>
|
|
2474
|
+
S_UNDO: typing.ClassVar[Scancode] # value = <Scancode.S_UNDO: 122>
|
|
2475
|
+
S_UP: typing.ClassVar[Scancode] # value = <Scancode.S_UP: 82>
|
|
2476
|
+
S_VOLDOWN: typing.ClassVar[Scancode] # value = <Scancode.S_VOLDOWN: 129>
|
|
2477
|
+
S_VOLUP: typing.ClassVar[Scancode] # value = <Scancode.S_VOLUP: 128>
|
|
2478
|
+
S_a: typing.ClassVar[Scancode] # value = <Scancode.S_a: 4>
|
|
2479
|
+
S_b: typing.ClassVar[Scancode] # value = <Scancode.S_b: 5>
|
|
2480
|
+
S_c: typing.ClassVar[Scancode] # value = <Scancode.S_c: 6>
|
|
2481
|
+
S_d: typing.ClassVar[Scancode] # value = <Scancode.S_d: 7>
|
|
2482
|
+
S_e: typing.ClassVar[Scancode] # value = <Scancode.S_e: 8>
|
|
2483
|
+
S_f: typing.ClassVar[Scancode] # value = <Scancode.S_f: 9>
|
|
2484
|
+
S_g: typing.ClassVar[Scancode] # value = <Scancode.S_g: 10>
|
|
2485
|
+
S_h: typing.ClassVar[Scancode] # value = <Scancode.S_h: 11>
|
|
2486
|
+
S_i: typing.ClassVar[Scancode] # value = <Scancode.S_i: 12>
|
|
2487
|
+
S_j: typing.ClassVar[Scancode] # value = <Scancode.S_j: 13>
|
|
2488
|
+
S_k: typing.ClassVar[Scancode] # value = <Scancode.S_k: 14>
|
|
2489
|
+
S_l: typing.ClassVar[Scancode] # value = <Scancode.S_l: 15>
|
|
2490
|
+
S_m: typing.ClassVar[Scancode] # value = <Scancode.S_m: 16>
|
|
2491
|
+
S_n: typing.ClassVar[Scancode] # value = <Scancode.S_n: 17>
|
|
2492
|
+
S_o: typing.ClassVar[Scancode] # value = <Scancode.S_o: 18>
|
|
2493
|
+
S_p: typing.ClassVar[Scancode] # value = <Scancode.S_p: 19>
|
|
2494
|
+
S_q: typing.ClassVar[Scancode] # value = <Scancode.S_q: 20>
|
|
2495
|
+
S_r: typing.ClassVar[Scancode] # value = <Scancode.S_r: 21>
|
|
2496
|
+
S_s: typing.ClassVar[Scancode] # value = <Scancode.S_s: 22>
|
|
2497
|
+
S_t: typing.ClassVar[Scancode] # value = <Scancode.S_t: 23>
|
|
2498
|
+
S_u: typing.ClassVar[Scancode] # value = <Scancode.S_u: 24>
|
|
2499
|
+
S_v: typing.ClassVar[Scancode] # value = <Scancode.S_v: 25>
|
|
2500
|
+
S_w: typing.ClassVar[Scancode] # value = <Scancode.S_w: 26>
|
|
2501
|
+
S_x: typing.ClassVar[Scancode] # value = <Scancode.S_x: 27>
|
|
2502
|
+
S_y: typing.ClassVar[Scancode] # value = <Scancode.S_y: 28>
|
|
2503
|
+
S_z: typing.ClassVar[Scancode] # value = <Scancode.S_z: 29>
|
|
2504
|
+
@classmethod
|
|
2505
|
+
def __new__(cls, value):
|
|
2506
|
+
...
|
|
2507
|
+
def __format__(self, format_spec):
|
|
2508
|
+
"""
|
|
2509
|
+
Convert to a string according to format_spec.
|
|
2510
|
+
"""
|
|
2511
|
+
class Texture:
|
|
2512
|
+
"""
|
|
2513
|
+
|
|
2514
|
+
Represents a hardware-accelerated image that can be efficiently rendered.
|
|
2515
|
+
|
|
2516
|
+
Textures are optimized for fast rendering operations and support various effects
|
|
2517
|
+
like rotation, flipping, tinting, alpha blending, and different blend modes.
|
|
2518
|
+
They can be created from image files or pixel arrays.
|
|
2519
|
+
|
|
2520
|
+
"""
|
|
2521
|
+
class Flip:
|
|
2522
|
+
"""
|
|
2523
|
+
|
|
2524
|
+
Controls horizontal and vertical flipping of a texture during rendering.
|
|
2525
|
+
|
|
2526
|
+
Used to mirror textures along the horizontal and/or vertical axes without
|
|
2527
|
+
creating additional texture data.
|
|
2528
|
+
|
|
2529
|
+
"""
|
|
2530
|
+
@property
|
|
2531
|
+
def h(self) -> bool:
|
|
2532
|
+
"""
|
|
2533
|
+
Enable or disable horizontal flipping.
|
|
2534
|
+
|
|
2535
|
+
When True, the texture is mirrored horizontally (left-right flip).
|
|
2536
|
+
"""
|
|
2537
|
+
@h.setter
|
|
2538
|
+
def h(self, arg0: bool) -> None:
|
|
2539
|
+
...
|
|
2540
|
+
@property
|
|
2541
|
+
def v(self) -> bool:
|
|
2542
|
+
"""
|
|
2543
|
+
Enable or disable vertical flipping.
|
|
2544
|
+
|
|
2545
|
+
When True, the texture is mirrored vertically (top-bottom flip).
|
|
2546
|
+
"""
|
|
2547
|
+
@v.setter
|
|
2548
|
+
def v(self, arg0: bool) -> None:
|
|
2549
|
+
...
|
|
2550
|
+
@typing.overload
|
|
2551
|
+
def __init__(self, file_path: str) -> None:
|
|
2552
|
+
"""
|
|
2553
|
+
Create a Texture by loading an image from a file.
|
|
2554
|
+
|
|
2555
|
+
Args:
|
|
2556
|
+
file_path (str): Path to the image file to load.
|
|
2557
|
+
|
|
2558
|
+
Raises:
|
|
2559
|
+
ValueError: If file_path is empty.
|
|
2560
|
+
RuntimeError: If the file cannot be loaded or texture creation fails.
|
|
2561
|
+
"""
|
|
2562
|
+
@typing.overload
|
|
2563
|
+
def __init__(self, pixel_array: PixelArray) -> None:
|
|
2564
|
+
"""
|
|
2565
|
+
Create a Texture from an existing PixelArray.
|
|
2566
|
+
|
|
2567
|
+
Args:
|
|
2568
|
+
pixel_array (PixelArray): The pixel array to convert to a texture.
|
|
2569
|
+
|
|
2570
|
+
Raises:
|
|
2571
|
+
RuntimeError: If texture creation from pixel array fails.
|
|
2572
|
+
"""
|
|
2573
|
+
def get_rect(self) -> Rect:
|
|
2574
|
+
"""
|
|
2575
|
+
Get a rectangle representing the texture bounds.
|
|
2576
|
+
|
|
2577
|
+
Returns:
|
|
2578
|
+
Rect: A rectangle with position (0, 0) and the texture's dimensions.
|
|
2579
|
+
"""
|
|
2580
|
+
def make_additive(self) -> None:
|
|
2581
|
+
"""
|
|
2582
|
+
Set the texture to use additive blending mode.
|
|
2583
|
+
|
|
2584
|
+
In additive mode, the texture's colors are added to the destination,
|
|
2585
|
+
creating bright, glowing effects.
|
|
2586
|
+
"""
|
|
2587
|
+
def make_multiply(self) -> None:
|
|
2588
|
+
"""
|
|
2589
|
+
Set the texture to use multiply blending mode.
|
|
2590
|
+
|
|
2591
|
+
In multiply mode, the texture's colors are multiplied with the destination,
|
|
2592
|
+
creating darkening and shadow effects.
|
|
2593
|
+
"""
|
|
2594
|
+
def make_normal(self) -> None:
|
|
2595
|
+
"""
|
|
2596
|
+
Set the texture to use normal (alpha) blending mode.
|
|
2597
|
+
|
|
2598
|
+
This is the default blending mode for standard transparency effects.
|
|
2599
|
+
"""
|
|
2600
|
+
@property
|
|
2601
|
+
def alpha(self) -> float:
|
|
2602
|
+
"""
|
|
2603
|
+
Get or set the alpha modulation of the texture as a float between `0.0` and `1.0`.
|
|
2604
|
+
"""
|
|
2605
|
+
@alpha.setter
|
|
2606
|
+
def alpha(self, arg1: typing.SupportsFloat) -> None:
|
|
2607
|
+
...
|
|
2608
|
+
@property
|
|
2609
|
+
def angle(self) -> float:
|
|
2610
|
+
"""
|
|
2611
|
+
The rotation angle in radians for rendering.
|
|
2612
|
+
|
|
2613
|
+
When the texture is drawn, it will be rotated by this angle about its center.
|
|
2614
|
+
"""
|
|
2615
|
+
@angle.setter
|
|
2616
|
+
def angle(self, arg0: typing.SupportsFloat) -> None:
|
|
2617
|
+
...
|
|
2618
|
+
@property
|
|
2619
|
+
def flip(self) -> Texture.Flip:
|
|
2620
|
+
"""
|
|
2621
|
+
The flip settings for horizontal and vertical mirroring.
|
|
2622
|
+
|
|
2623
|
+
Controls whether the texture is flipped horizontally and/or vertically during rendering.
|
|
2624
|
+
"""
|
|
2625
|
+
@flip.setter
|
|
2626
|
+
def flip(self, arg0: Texture.Flip) -> None:
|
|
2627
|
+
...
|
|
2628
|
+
@property
|
|
2629
|
+
def size(self) -> Vec2:
|
|
2630
|
+
"""
|
|
2631
|
+
Get the size of the texture.
|
|
2632
|
+
|
|
2633
|
+
Returns:
|
|
2634
|
+
Vec2: The texture size as (width, height).
|
|
2635
|
+
"""
|
|
2636
|
+
@property
|
|
2637
|
+
def tint(self) -> Color:
|
|
2638
|
+
"""
|
|
2639
|
+
Get or set the color tint applied to the texture during rendering.
|
|
2640
|
+
"""
|
|
2641
|
+
@tint.setter
|
|
2642
|
+
def tint(self, arg1: Color) -> None:
|
|
2643
|
+
...
|
|
2644
|
+
class Tile:
|
|
2645
|
+
"""
|
|
2646
|
+
|
|
2647
|
+
Represents a single tile instance in a layer.
|
|
2648
|
+
|
|
2649
|
+
Contains source and destination rectangles, a collider, flip flags, rotation angle,
|
|
2650
|
+
and a reference to its owning Layer.
|
|
2651
|
+
|
|
2652
|
+
"""
|
|
2653
|
+
@property
|
|
2654
|
+
def angle(self) -> float:
|
|
2655
|
+
"""
|
|
2656
|
+
The rotation angle in degrees.
|
|
2657
|
+
"""
|
|
2658
|
+
@property
|
|
2659
|
+
def anti_diag_flip(self) -> bool:
|
|
2660
|
+
"""
|
|
2661
|
+
Whether the tile is flipped across the anti-diagonal.
|
|
2662
|
+
"""
|
|
2663
|
+
@property
|
|
2664
|
+
def collider(self) -> Rect:
|
|
2665
|
+
"""
|
|
2666
|
+
The fitted collider rectangle for the tile's opaque area.
|
|
2667
|
+
"""
|
|
2668
|
+
@property
|
|
2669
|
+
def dst(self) -> Rect:
|
|
2670
|
+
"""
|
|
2671
|
+
The destination rectangle on the map.
|
|
2672
|
+
"""
|
|
2673
|
+
@property
|
|
2674
|
+
def h_flip(self) -> bool:
|
|
2675
|
+
"""
|
|
2676
|
+
Whether the tile is flipped horizontally.
|
|
2677
|
+
"""
|
|
2678
|
+
@property
|
|
2679
|
+
def layer(self) -> Layer:
|
|
2680
|
+
"""
|
|
2681
|
+
Get the owning Layer.
|
|
2682
|
+
|
|
2683
|
+
Returns:
|
|
2684
|
+
Layer | None: The owning Layer if it still exists; otherwise None.
|
|
2685
|
+
"""
|
|
2686
|
+
@property
|
|
2687
|
+
def src(self) -> Rect:
|
|
2688
|
+
"""
|
|
2689
|
+
The source rectangle within the tileset texture.
|
|
2690
|
+
"""
|
|
2691
|
+
@property
|
|
2692
|
+
def v_flip(self) -> bool:
|
|
2693
|
+
"""
|
|
2694
|
+
Whether the tile is flipped vertically.
|
|
2695
|
+
"""
|
|
2696
|
+
class TileMap:
|
|
2697
|
+
"""
|
|
2698
|
+
|
|
2699
|
+
Loads and renders TMX tile maps.
|
|
2700
|
+
|
|
2701
|
+
Parses a Tiled TMX file, loads the tileset texture, and exposes layers and tiles for rendering and queries.
|
|
2702
|
+
|
|
2703
|
+
"""
|
|
2704
|
+
@staticmethod
|
|
2705
|
+
def get_tile_collection(layers: collections.abc.Sequence[Layer]) -> list[Tile]:
|
|
2706
|
+
"""
|
|
2707
|
+
Collect all tiles from the provided layers into a single list.
|
|
2708
|
+
|
|
2709
|
+
Args:
|
|
2710
|
+
layers (Sequence[Layer]): The layers to collect tiles from.
|
|
2711
|
+
|
|
2712
|
+
Returns:
|
|
2713
|
+
list[Tile]: A flat list of tiles from the given layers.
|
|
2714
|
+
"""
|
|
2715
|
+
def __init__(self, tmx_path: str, border_size: typing.SupportsInt = 0) -> None:
|
|
2716
|
+
"""
|
|
2717
|
+
Create a TileMap by loading a TMX file.
|
|
2718
|
+
|
|
2719
|
+
Args:
|
|
2720
|
+
tmx_path (str): Path to the TMX file.
|
|
2721
|
+
border_size (int): Optional border (in pixels) around each tile in the tileset; defaults to 0.
|
|
2722
|
+
|
|
2723
|
+
Raises:
|
|
2724
|
+
RuntimeError: If the TMX or TSX files cannot be loaded or parsed.
|
|
2725
|
+
"""
|
|
2726
|
+
def get_layer(self, name: str, type: Layer.Type = Layer.Type.TILE) -> Layer:
|
|
2727
|
+
"""
|
|
2728
|
+
Get a layer by name and type.
|
|
2729
|
+
|
|
2730
|
+
Args:
|
|
2731
|
+
name (str): The layer name.
|
|
2732
|
+
type (Layer.Type): The expected layer type (defaults to TILE).
|
|
2733
|
+
|
|
2734
|
+
Returns:
|
|
2735
|
+
Layer: The matching layer.
|
|
2736
|
+
|
|
2737
|
+
Raises:
|
|
2738
|
+
ValueError: If no matching layer is found or the type doesn't match.
|
|
2739
|
+
"""
|
|
2740
|
+
def get_layers(self) -> list[Layer]:
|
|
2741
|
+
"""
|
|
2742
|
+
Get all layers in the map.
|
|
2743
|
+
|
|
2744
|
+
Returns:
|
|
2745
|
+
list[Layer]: A list of all layers.
|
|
2746
|
+
"""
|
|
2747
|
+
def render(self) -> None:
|
|
2748
|
+
"""
|
|
2749
|
+
Render all visible layers.
|
|
2750
|
+
"""
|
|
2751
|
+
class Timer:
|
|
2752
|
+
"""
|
|
2753
|
+
|
|
2754
|
+
A timer for tracking countdown durations with pause/resume functionality.
|
|
2755
|
+
|
|
2756
|
+
The Timer class provides a simple countdown timer that can be started, paused,
|
|
2757
|
+
and resumed. It's useful for implementing time-based game mechanics like
|
|
2758
|
+
cooldowns, temporary effects, or timed events.
|
|
2759
|
+
|
|
2760
|
+
"""
|
|
2761
|
+
def __init__(self, duration: typing.SupportsFloat) -> None:
|
|
2762
|
+
"""
|
|
2763
|
+
Create a new Timer instance with the specified duration.
|
|
2764
|
+
|
|
2765
|
+
Args:
|
|
2766
|
+
duration (float): The countdown duration in seconds. Must be greater than 0.
|
|
2767
|
+
|
|
2768
|
+
Raises:
|
|
2769
|
+
RuntimeError: If duration is less than or equal to 0.
|
|
2770
|
+
"""
|
|
2771
|
+
def pause(self) -> None:
|
|
2772
|
+
"""
|
|
2773
|
+
Pause the timer countdown.
|
|
2774
|
+
|
|
2775
|
+
The timer will stop counting down but retain its current state. Use resume()
|
|
2776
|
+
to continue the countdown from where it was paused. Has no effect if the
|
|
2777
|
+
timer is not started or already paused.
|
|
2778
|
+
"""
|
|
2779
|
+
def reset(self) -> None:
|
|
2780
|
+
"""
|
|
2781
|
+
Reset the timer to its initial state.
|
|
2782
|
+
|
|
2783
|
+
Stops the timer and resets it back to its initial, unstarted state.
|
|
2784
|
+
The timer can be started again with `start()` after being reset.
|
|
2785
|
+
"""
|
|
2786
|
+
def resume(self) -> None:
|
|
2787
|
+
"""
|
|
2788
|
+
Resume a paused timer countdown.
|
|
2789
|
+
|
|
2790
|
+
Continues the countdown from where it was paused. Has no effect if the
|
|
2791
|
+
timer is not started or not currently paused.
|
|
2792
|
+
"""
|
|
2793
|
+
def start(self) -> None:
|
|
2794
|
+
"""
|
|
2795
|
+
Start or restart the timer countdown.
|
|
2796
|
+
|
|
2797
|
+
This begins the countdown from the full duration. If the timer was previously
|
|
2798
|
+
started, this will reset it back to the beginning.
|
|
2799
|
+
"""
|
|
2800
|
+
@property
|
|
2801
|
+
def done(self) -> bool:
|
|
2802
|
+
"""
|
|
2803
|
+
bool: True if the timer has finished counting down, False otherwise.
|
|
2804
|
+
|
|
2805
|
+
A timer is considered done when the elapsed time since start (excluding
|
|
2806
|
+
paused time) equals or exceeds the specified duration.
|
|
2807
|
+
"""
|
|
2808
|
+
@property
|
|
2809
|
+
def elapsed_time(self) -> float:
|
|
2810
|
+
"""
|
|
2811
|
+
float: The time elapsed since the timer was started, in seconds.
|
|
2812
|
+
|
|
2813
|
+
Returns 0.0 if the timer hasn't been started. This includes time spent
|
|
2814
|
+
while paused, giving you the total wall-clock time since start().
|
|
2815
|
+
"""
|
|
2816
|
+
@property
|
|
2817
|
+
def progress(self) -> float:
|
|
2818
|
+
"""
|
|
2819
|
+
float: The completion progress of the timer as a value between 0.0 and 1.0.
|
|
2820
|
+
|
|
2821
|
+
Returns 0.0 if the timer hasn't been started, and 1.0 when the timer
|
|
2822
|
+
is complete. Useful for progress bars and interpolated animations.
|
|
2823
|
+
"""
|
|
2824
|
+
@property
|
|
2825
|
+
def time_remaining(self) -> float:
|
|
2826
|
+
"""
|
|
2827
|
+
float: The remaining time in seconds before the timer completes.
|
|
2828
|
+
|
|
2829
|
+
Returns the full duration if the timer hasn't been started, or 0.0 if
|
|
2830
|
+
the timer has already finished.
|
|
2831
|
+
"""
|
|
2832
|
+
class Vec2:
|
|
2833
|
+
"""
|
|
2834
|
+
|
|
2835
|
+
Represents a 2D vector with x and y components.
|
|
2836
|
+
|
|
2837
|
+
Vec2 is used for positions, directions, velocities, and other 2D vector operations.
|
|
2838
|
+
Supports arithmetic operations, comparisons, and various mathematical functions.
|
|
2839
|
+
|
|
2840
|
+
"""
|
|
2841
|
+
def __add__(self, other: Vec2) -> Vec2:
|
|
2842
|
+
"""
|
|
2843
|
+
Add another Vec2 to this Vec2.
|
|
2844
|
+
|
|
2845
|
+
Args:
|
|
2846
|
+
other (Vec2): The Vec2 to add.
|
|
2847
|
+
|
|
2848
|
+
Returns:
|
|
2849
|
+
Vec2: A new Vec2 with the result of the addition.
|
|
2850
|
+
"""
|
|
2851
|
+
def __bool__(self) -> bool:
|
|
2852
|
+
"""
|
|
2853
|
+
Check if the vector is not zero.
|
|
2854
|
+
|
|
2855
|
+
Returns:
|
|
2856
|
+
bool: True if the vector is not zero, False if it is zero.
|
|
2857
|
+
"""
|
|
2858
|
+
def __eq__(self, other: Vec2) -> bool:
|
|
2859
|
+
"""
|
|
2860
|
+
Check if two Vec2s are equal (within tolerance).
|
|
2861
|
+
|
|
2862
|
+
Args:
|
|
2863
|
+
other (Vec2): The other Vec2 to compare.
|
|
2864
|
+
|
|
2865
|
+
Returns:
|
|
2866
|
+
bool: True if vectors are equal within tolerance.
|
|
2867
|
+
"""
|
|
2868
|
+
def __ge__(self, other: Vec2) -> bool:
|
|
2869
|
+
"""
|
|
2870
|
+
Check if this Vec2 is component-wise greater than or equal to another.
|
|
2871
|
+
|
|
2872
|
+
Args:
|
|
2873
|
+
other (Vec2): The other Vec2 to compare.
|
|
2874
|
+
|
|
2875
|
+
Returns:
|
|
2876
|
+
bool: True if not component-wise less than other.
|
|
2877
|
+
"""
|
|
2878
|
+
def __getitem__(self, index: typing.SupportsInt) -> float:
|
|
2879
|
+
"""
|
|
2880
|
+
Access vector components by index.
|
|
2881
|
+
|
|
2882
|
+
Args:
|
|
2883
|
+
index (int): Index (0=x, 1=y).
|
|
2884
|
+
|
|
2885
|
+
Returns:
|
|
2886
|
+
float: The component value.
|
|
2887
|
+
|
|
2888
|
+
Raises:
|
|
2889
|
+
IndexError: If index is not 0 or 1.
|
|
2890
|
+
"""
|
|
2891
|
+
def __gt__(self, other: Vec2) -> bool:
|
|
2892
|
+
"""
|
|
2893
|
+
Check if this Vec2 is component-wise greater than another.
|
|
2894
|
+
|
|
2895
|
+
Args:
|
|
2896
|
+
other (Vec2): The other Vec2 to compare.
|
|
2897
|
+
|
|
2898
|
+
Returns:
|
|
2899
|
+
bool: True if both x and y are greater than other's x and y.
|
|
2900
|
+
"""
|
|
2901
|
+
def __hash__(self) -> int:
|
|
2902
|
+
"""
|
|
2903
|
+
Return a hash value for the Vec2.
|
|
2904
|
+
|
|
2905
|
+
Returns:
|
|
2906
|
+
int: Hash value based on x and y components.
|
|
2907
|
+
"""
|
|
2908
|
+
def __iadd__(self, other: Vec2) -> Vec2:
|
|
2909
|
+
"""
|
|
2910
|
+
In-place addition (self += other).
|
|
2911
|
+
|
|
2912
|
+
Args:
|
|
2913
|
+
other (Vec2): The Vec2 to add.
|
|
2914
|
+
|
|
2915
|
+
Returns:
|
|
2916
|
+
Vec2: Reference to self after modification.
|
|
2917
|
+
"""
|
|
2918
|
+
def __imul__(self, scalar: typing.SupportsFloat) -> Vec2:
|
|
2919
|
+
"""
|
|
2920
|
+
In-place multiplication by a scalar value (self *= scalar).
|
|
2921
|
+
|
|
2922
|
+
Args:
|
|
2923
|
+
scalar (float): The scalar to multiply by.
|
|
2924
|
+
|
|
2925
|
+
Returns:
|
|
2926
|
+
Vec2: Reference to self after modification.
|
|
2927
|
+
"""
|
|
2928
|
+
@typing.overload
|
|
2929
|
+
def __init__(self) -> None:
|
|
2930
|
+
"""
|
|
2931
|
+
Create a zero vector (0, 0).
|
|
2932
|
+
"""
|
|
2933
|
+
@typing.overload
|
|
2934
|
+
def __init__(self, value: typing.SupportsFloat) -> None:
|
|
2935
|
+
"""
|
|
2936
|
+
Create a Vec2 with both x and y set to the same value.
|
|
2937
|
+
|
|
2938
|
+
Args:
|
|
2939
|
+
value (float): Value to set for both x and y components.
|
|
2940
|
+
"""
|
|
2941
|
+
@typing.overload
|
|
2942
|
+
def __init__(self, x: typing.SupportsFloat, y: typing.SupportsFloat) -> None:
|
|
2943
|
+
"""
|
|
2944
|
+
Create a Vec2 with given x and y values.
|
|
2945
|
+
|
|
2946
|
+
Args:
|
|
2947
|
+
x (float): The x component.
|
|
2948
|
+
y (float): The y component.
|
|
2949
|
+
"""
|
|
2950
|
+
@typing.overload
|
|
2951
|
+
def __init__(self, arg0: collections.abc.Sequence) -> None:
|
|
2952
|
+
"""
|
|
2953
|
+
Create a Vec2 from a sequence of two elements.
|
|
2954
|
+
|
|
2955
|
+
Args:
|
|
2956
|
+
sequence: A sequence (list, tuple) containing [x, y].
|
|
2957
|
+
|
|
2958
|
+
Raises:
|
|
2959
|
+
RuntimeError: If sequence doesn't contain exactly 2 elements.
|
|
2960
|
+
"""
|
|
2961
|
+
def __isub__(self, other: Vec2) -> Vec2:
|
|
2962
|
+
"""
|
|
2963
|
+
In-place subtraction (self -= other).
|
|
2964
|
+
|
|
2965
|
+
Args:
|
|
2966
|
+
other (Vec2): The Vec2 to subtract.
|
|
2967
|
+
|
|
2968
|
+
Returns:
|
|
2969
|
+
Vec2: Reference to self after modification.
|
|
2970
|
+
"""
|
|
2971
|
+
def __iter__(self) -> collections.abc.Iterator:
|
|
2972
|
+
"""
|
|
2973
|
+
Return an iterator over (x, y).
|
|
2974
|
+
|
|
2975
|
+
Returns:
|
|
2976
|
+
iterator: Iterator that yields x first, then y.
|
|
2977
|
+
"""
|
|
2978
|
+
def __itruediv__(self, scalar: typing.SupportsFloat) -> Vec2:
|
|
2979
|
+
"""
|
|
2980
|
+
In-place division by a scalar value (self /= scalar).
|
|
2981
|
+
|
|
2982
|
+
Args:
|
|
2983
|
+
scalar (float): The scalar to divide by.
|
|
2984
|
+
|
|
2985
|
+
Returns:
|
|
2986
|
+
Vec2: Reference to self after modification.
|
|
2987
|
+
"""
|
|
2988
|
+
def __le__(self, other: Vec2) -> bool:
|
|
2989
|
+
"""
|
|
2990
|
+
Check if this Vec2 is component-wise less than or equal to another.
|
|
2991
|
+
|
|
2992
|
+
Args:
|
|
2993
|
+
other (Vec2): The other Vec2 to compare.
|
|
2994
|
+
|
|
2995
|
+
Returns:
|
|
2996
|
+
bool: True if not component-wise greater than other.
|
|
2997
|
+
"""
|
|
2998
|
+
def __len__(self) -> int:
|
|
2999
|
+
"""
|
|
3000
|
+
Return the number of components (always 2).
|
|
3001
|
+
|
|
3002
|
+
Returns:
|
|
3003
|
+
int: Always returns 2 (x and y).
|
|
3004
|
+
"""
|
|
3005
|
+
def __lt__(self, other: Vec2) -> bool:
|
|
3006
|
+
"""
|
|
3007
|
+
Check if this Vec2 is component-wise less than another.
|
|
3008
|
+
|
|
3009
|
+
Args:
|
|
3010
|
+
other (Vec2): The other Vec2 to compare.
|
|
3011
|
+
|
|
3012
|
+
Returns:
|
|
3013
|
+
bool: True if both x and y are less than other's x and y.
|
|
3014
|
+
"""
|
|
3015
|
+
def __mul__(self, scalar: typing.SupportsFloat) -> Vec2:
|
|
3016
|
+
"""
|
|
3017
|
+
Multiply the vector by a scalar value.
|
|
3018
|
+
|
|
3019
|
+
Args:
|
|
3020
|
+
scalar (float): The scalar to multiply by.
|
|
3021
|
+
|
|
3022
|
+
Returns:
|
|
3023
|
+
Vec2: A new Vec2 with multiplied components.
|
|
3024
|
+
"""
|
|
3025
|
+
def __ne__(self, other: Vec2) -> bool:
|
|
3026
|
+
"""
|
|
3027
|
+
Check if two Vec2s are not equal.
|
|
3028
|
+
|
|
3029
|
+
Args:
|
|
3030
|
+
other (Vec2): The other Vec2 to compare.
|
|
3031
|
+
|
|
3032
|
+
Returns:
|
|
3033
|
+
bool: True if vectors are not equal.
|
|
3034
|
+
"""
|
|
3035
|
+
def __neg__(self) -> Vec2:
|
|
3036
|
+
"""
|
|
3037
|
+
Return the negation of this vector (-self).
|
|
3038
|
+
|
|
3039
|
+
Returns:
|
|
3040
|
+
Vec2: A new Vec2 with negated x and y components.
|
|
3041
|
+
"""
|
|
3042
|
+
def __radd__(self, other: Vec2) -> Vec2:
|
|
3043
|
+
"""
|
|
3044
|
+
Right-hand addition (other + self).
|
|
3045
|
+
|
|
3046
|
+
Args:
|
|
3047
|
+
other (Vec2): The Vec2 to add.
|
|
3048
|
+
|
|
3049
|
+
Returns:
|
|
3050
|
+
Vec2: A new Vec2 with the result of the addition.
|
|
3051
|
+
"""
|
|
3052
|
+
def __repr__(self) -> str:
|
|
3053
|
+
"""
|
|
3054
|
+
Return a string suitable for debugging and recreation.
|
|
3055
|
+
|
|
3056
|
+
Returns:
|
|
3057
|
+
str: String in format "Vec2(x, y)".
|
|
3058
|
+
"""
|
|
3059
|
+
def __rmul__(self, scalar: typing.SupportsFloat) -> Vec2:
|
|
3060
|
+
"""
|
|
3061
|
+
Right-hand multiplication (scalar * self).
|
|
3062
|
+
|
|
3063
|
+
Args:
|
|
3064
|
+
scalar (float): The scalar to multiply by.
|
|
3065
|
+
|
|
3066
|
+
Returns:
|
|
3067
|
+
Vec2: A new Vec2 with multiplied components.
|
|
3068
|
+
"""
|
|
3069
|
+
def __rsub__(self, other: Vec2) -> Vec2:
|
|
3070
|
+
"""
|
|
3071
|
+
Right-hand subtraction (other - self).
|
|
3072
|
+
|
|
3073
|
+
Args:
|
|
3074
|
+
other (Vec2): The Vec2 to subtract from.
|
|
3075
|
+
|
|
3076
|
+
Returns:
|
|
3077
|
+
Vec2: A new Vec2 with the result of the subtraction.
|
|
3078
|
+
"""
|
|
3079
|
+
def __setitem__(self, index: typing.SupportsInt, value: typing.SupportsFloat) -> None:
|
|
3080
|
+
"""
|
|
3081
|
+
Set vector components by index.
|
|
3082
|
+
|
|
3083
|
+
Args:
|
|
3084
|
+
index (int): Index (0=x, 1=y).
|
|
3085
|
+
value (float): The new value to set.
|
|
3086
|
+
|
|
3087
|
+
Raises:
|
|
3088
|
+
IndexError: If index is not 0 or 1.
|
|
3089
|
+
"""
|
|
3090
|
+
def __str__(self) -> str:
|
|
3091
|
+
"""
|
|
3092
|
+
Return a human-readable string representation.
|
|
3093
|
+
|
|
3094
|
+
Returns:
|
|
3095
|
+
str: String in format "<x, y>".
|
|
3096
|
+
"""
|
|
3097
|
+
def __sub__(self, other: Vec2) -> Vec2:
|
|
3098
|
+
"""
|
|
3099
|
+
Subtract another Vec2 from this Vec2.
|
|
3100
|
+
|
|
3101
|
+
Args:
|
|
3102
|
+
other (Vec2): The Vec2 to subtract.
|
|
3103
|
+
|
|
3104
|
+
Returns:
|
|
3105
|
+
Vec2: A new Vec2 with the result of the subtraction.
|
|
3106
|
+
"""
|
|
3107
|
+
def __truediv__(self, scalar: typing.SupportsFloat) -> Vec2:
|
|
3108
|
+
"""
|
|
3109
|
+
Divide the vector by a scalar value.
|
|
3110
|
+
|
|
3111
|
+
Args:
|
|
3112
|
+
scalar (float): The scalar to divide by.
|
|
3113
|
+
|
|
3114
|
+
Returns:
|
|
3115
|
+
Vec2: A new Vec2 with divided components.
|
|
3116
|
+
"""
|
|
3117
|
+
def distance_to(self, other: Vec2) -> float:
|
|
3118
|
+
"""
|
|
3119
|
+
Calculate the distance to another vector.
|
|
3120
|
+
|
|
3121
|
+
Args:
|
|
3122
|
+
other (Vec2): The other vector.
|
|
3123
|
+
|
|
3124
|
+
Returns:
|
|
3125
|
+
float: The Euclidean distance between the vectors.
|
|
3126
|
+
"""
|
|
3127
|
+
def normalize(self) -> None:
|
|
3128
|
+
"""
|
|
3129
|
+
Normalize the vector to unit length in-place.
|
|
3130
|
+
|
|
3131
|
+
If the vector is zero, it remains unchanged.
|
|
3132
|
+
"""
|
|
3133
|
+
def rotate(self, radians: typing.SupportsFloat) -> None:
|
|
3134
|
+
"""
|
|
3135
|
+
Rotate the vector by the given angle in radians.
|
|
3136
|
+
|
|
3137
|
+
Args:
|
|
3138
|
+
radians (float): The angle to rotate by in radians.
|
|
3139
|
+
"""
|
|
3140
|
+
def scale_to_length(self, length: typing.SupportsFloat) -> None:
|
|
3141
|
+
"""
|
|
3142
|
+
Scale the vector to the specified length in-place.
|
|
3143
|
+
|
|
3144
|
+
Args:
|
|
3145
|
+
length (float): The target length.
|
|
3146
|
+
"""
|
|
3147
|
+
def to_polar(self) -> PolarCoordinate:
|
|
3148
|
+
"""
|
|
3149
|
+
Convert to polar coordinates.
|
|
3150
|
+
|
|
3151
|
+
Returns:
|
|
3152
|
+
PolarCoordinate: A polar coordinate representation (angle, length).
|
|
3153
|
+
"""
|
|
3154
|
+
@property
|
|
3155
|
+
def angle(self) -> float:
|
|
3156
|
+
"""
|
|
3157
|
+
Get the angle of the vector in radians.
|
|
3158
|
+
|
|
3159
|
+
Returns:
|
|
3160
|
+
float: The angle from the positive x-axis to this vector.
|
|
3161
|
+
"""
|
|
3162
|
+
@property
|
|
3163
|
+
def length(self) -> float:
|
|
3164
|
+
"""
|
|
3165
|
+
Get the length (magnitude) of the vector.
|
|
3166
|
+
|
|
3167
|
+
Returns:
|
|
3168
|
+
float: The Euclidean length of the vector.
|
|
3169
|
+
"""
|
|
3170
|
+
@property
|
|
3171
|
+
def x(self) -> float:
|
|
3172
|
+
"""
|
|
3173
|
+
The x component of the vector.
|
|
3174
|
+
"""
|
|
3175
|
+
@x.setter
|
|
3176
|
+
def x(self, arg0: typing.SupportsFloat) -> None:
|
|
3177
|
+
...
|
|
3178
|
+
@property
|
|
3179
|
+
def xx(self) -> Vec2:
|
|
3180
|
+
"""
|
|
3181
|
+
Get a new Vec2 with both components set to x.
|
|
3182
|
+
"""
|
|
3183
|
+
@property
|
|
3184
|
+
def xy(self) -> Vec2:
|
|
3185
|
+
"""
|
|
3186
|
+
Get or set the (x, y) components as a new Vec2.
|
|
3187
|
+
"""
|
|
3188
|
+
@xy.setter
|
|
3189
|
+
def xy(self, arg1: typing.SupportsFloat, arg2: typing.SupportsFloat) -> None:
|
|
3190
|
+
...
|
|
3191
|
+
@property
|
|
3192
|
+
def y(self) -> float:
|
|
3193
|
+
"""
|
|
3194
|
+
The y component of the vector.
|
|
3195
|
+
"""
|
|
3196
|
+
@y.setter
|
|
3197
|
+
def y(self, arg0: typing.SupportsFloat) -> None:
|
|
3198
|
+
...
|
|
3199
|
+
@property
|
|
3200
|
+
def yx(self) -> Vec2:
|
|
3201
|
+
"""
|
|
3202
|
+
Get or set the (y, x) components as a new Vec2.
|
|
3203
|
+
"""
|
|
3204
|
+
@yx.setter
|
|
3205
|
+
def yx(self, arg1: typing.SupportsFloat, arg2: typing.SupportsFloat) -> None:
|
|
3206
|
+
...
|
|
3207
|
+
@property
|
|
3208
|
+
def yy(self) -> Vec2:
|
|
3209
|
+
"""
|
|
3210
|
+
Get a new Vec2 with both components set to y.
|
|
3211
|
+
"""
|
|
3212
|
+
def init() -> None:
|
|
3213
|
+
"""
|
|
3214
|
+
Initialize the Kraken Engine.
|
|
3215
|
+
|
|
3216
|
+
This sets up internal systems and must be called before using any other features.
|
|
3217
|
+
"""
|
|
3218
|
+
def quit() -> None:
|
|
3219
|
+
"""
|
|
3220
|
+
Shut down the Kraken Engine and clean up resources.
|
|
3221
|
+
|
|
3222
|
+
Call this once you're done using the engine to avoid memory leaks.
|
|
3223
|
+
"""
|
|
3224
|
+
AUDIO_DEVICE_ADDED: EventType # value = <EventType.AUDIO_DEVICE_ADDED: 4352>
|
|
3225
|
+
AUDIO_DEVICE_FORMAT_CHANGED: EventType # value = <EventType.AUDIO_DEVICE_FORMAT_CHANGED: 4354>
|
|
3226
|
+
AUDIO_DEVICE_REMOVED: EventType # value = <EventType.AUDIO_DEVICE_REMOVED: 4353>
|
|
3227
|
+
BOTTOM_LEFT: Anchor # value = <Anchor.BOTTOM_LEFT: 6>
|
|
3228
|
+
BOTTOM_MID: Anchor # value = <Anchor.BOTTOM_MID: 7>
|
|
3229
|
+
BOTTOM_RIGHT: Anchor # value = <Anchor.BOTTOM_RIGHT: 8>
|
|
3230
|
+
CAMERA_ADDED: EventType # value = <EventType.CAMERA_ADDED: 5120>
|
|
3231
|
+
CAMERA_APPROVED: EventType # value = <EventType.CAMERA_APPROVED: 5122>
|
|
3232
|
+
CAMERA_DENIED: EventType # value = <EventType.CAMERA_DENIED: 5123>
|
|
3233
|
+
CAMERA_REMOVED: EventType # value = <EventType.CAMERA_REMOVED: 5121>
|
|
3234
|
+
CENTER: Anchor # value = <Anchor.CENTER: 4>
|
|
3235
|
+
C_BACK: GamepadButton # value = <GamepadButton.C_BACK: 4>
|
|
3236
|
+
C_DPAD_DOWN: GamepadButton # value = <GamepadButton.C_DPAD_DOWN: 12>
|
|
3237
|
+
C_DPAD_LEFT: GamepadButton # value = <GamepadButton.C_DPAD_LEFT: 13>
|
|
3238
|
+
C_DPAD_RIGHT: GamepadButton # value = <GamepadButton.C_DPAD_RIGHT: 14>
|
|
3239
|
+
C_DPAD_UP: GamepadButton # value = <GamepadButton.C_DPAD_UP: 11>
|
|
3240
|
+
C_EAST: GamepadButton # value = <GamepadButton.C_EAST: 1>
|
|
3241
|
+
C_GUIDE: GamepadButton # value = <GamepadButton.C_GUIDE: 5>
|
|
3242
|
+
C_LSHOULDER: GamepadButton # value = <GamepadButton.C_LSHOULDER: 9>
|
|
3243
|
+
C_LSTICK: GamepadButton # value = <GamepadButton.C_LSTICK: 7>
|
|
3244
|
+
C_LTRIGGER: GamepadAxis # value = <GamepadAxis.C_LTRIGGER: 4>
|
|
3245
|
+
C_LX: GamepadAxis # value = <GamepadAxis.C_LX: 0>
|
|
3246
|
+
C_LY: GamepadAxis # value = <GamepadAxis.C_LY: 1>
|
|
3247
|
+
C_NORTH: GamepadButton # value = <GamepadButton.C_NORTH: 3>
|
|
3248
|
+
C_PS3: GamepadType # value = <GamepadType.C_PS3: 4>
|
|
3249
|
+
C_PS4: GamepadType # value = <GamepadType.C_PS4: 5>
|
|
3250
|
+
C_PS5: GamepadType # value = <GamepadType.C_PS5: 6>
|
|
3251
|
+
C_RSHOULDER: GamepadButton # value = <GamepadButton.C_RSHOULDER: 10>
|
|
3252
|
+
C_RSTICK: GamepadButton # value = <GamepadButton.C_RSTICK: 8>
|
|
3253
|
+
C_RTRIGGER: GamepadAxis # value = <GamepadAxis.C_RTRIGGER: 5>
|
|
3254
|
+
C_RX: GamepadAxis # value = <GamepadAxis.C_RX: 2>
|
|
3255
|
+
C_RY: GamepadAxis # value = <GamepadAxis.C_RY: 3>
|
|
3256
|
+
C_SOUTH: GamepadButton # value = <GamepadButton.C_SOUTH: 0>
|
|
3257
|
+
C_STANDARD: GamepadType # value = <GamepadType.C_STANDARD: 1>
|
|
3258
|
+
C_START: GamepadButton # value = <GamepadButton.C_START: 6>
|
|
3259
|
+
C_SWITCH_JOYCON_LEFT: GamepadType # value = <GamepadType.C_SWITCH_JOYCON_LEFT: 8>
|
|
3260
|
+
C_SWITCH_JOYCON_PAIR: GamepadType # value = <GamepadType.C_SWITCH_JOYCON_PAIR: 10>
|
|
3261
|
+
C_SWITCH_JOYCON_RIGHT: GamepadType # value = <GamepadType.C_SWITCH_JOYCON_RIGHT: 9>
|
|
3262
|
+
C_SWITCH_PRO: GamepadType # value = <GamepadType.C_SWITCH_PRO: 7>
|
|
3263
|
+
C_WEST: GamepadButton # value = <GamepadButton.C_WEST: 2>
|
|
3264
|
+
C_XBOX_360: GamepadType # value = <GamepadType.C_XBOX_360: 2>
|
|
3265
|
+
C_XBOX_ONE: GamepadType # value = <GamepadType.C_XBOX_ONE: 3>
|
|
3266
|
+
DROP_BEGIN: EventType # value = <EventType.DROP_BEGIN: 4098>
|
|
3267
|
+
DROP_COMPLETE: EventType # value = <EventType.DROP_COMPLETE: 4099>
|
|
3268
|
+
DROP_FILE: EventType # value = <EventType.DROP_FILE: 4096>
|
|
3269
|
+
DROP_POSITION: EventType # value = <EventType.DROP_POSITION: 4100>
|
|
3270
|
+
DROP_TEXT: EventType # value = <EventType.DROP_TEXT: 4097>
|
|
3271
|
+
GAMEPAD_ADDED: EventType # value = <EventType.GAMEPAD_ADDED: 1619>
|
|
3272
|
+
GAMEPAD_AXIS_MOTION: EventType # value = <EventType.GAMEPAD_AXIS_MOTION: 1616>
|
|
3273
|
+
GAMEPAD_BUTTON_DOWN: EventType # value = <EventType.GAMEPAD_BUTTON_DOWN: 1617>
|
|
3274
|
+
GAMEPAD_BUTTON_UP: EventType # value = <EventType.GAMEPAD_BUTTON_UP: 1618>
|
|
3275
|
+
GAMEPAD_REMOVED: EventType # value = <EventType.GAMEPAD_REMOVED: 1620>
|
|
3276
|
+
GAMEPAD_TOUCHPAD_DOWN: EventType # value = <EventType.GAMEPAD_TOUCHPAD_DOWN: 1622>
|
|
3277
|
+
GAMEPAD_TOUCHPAD_MOTION: EventType # value = <EventType.GAMEPAD_TOUCHPAD_MOTION: 1623>
|
|
3278
|
+
GAMEPAD_TOUCHPAD_UP: EventType # value = <EventType.GAMEPAD_TOUCHPAD_UP: 1624>
|
|
3279
|
+
KEYBOARD_ADDED: EventType # value = <EventType.KEYBOARD_ADDED: 773>
|
|
3280
|
+
KEYBOARD_REMOVED: EventType # value = <EventType.KEYBOARD_REMOVED: 774>
|
|
3281
|
+
KEY_DOWN: EventType # value = <EventType.KEY_DOWN: 768>
|
|
3282
|
+
KEY_UP: EventType # value = <EventType.KEY_UP: 769>
|
|
3283
|
+
K_0: Keycode # value = <Keycode.K_0: 48>
|
|
3284
|
+
K_1: Keycode # value = <Keycode.K_1: 49>
|
|
3285
|
+
K_2: Keycode # value = <Keycode.K_2: 50>
|
|
3286
|
+
K_3: Keycode # value = <Keycode.K_3: 51>
|
|
3287
|
+
K_4: Keycode # value = <Keycode.K_4: 52>
|
|
3288
|
+
K_5: Keycode # value = <Keycode.K_5: 53>
|
|
3289
|
+
K_6: Keycode # value = <Keycode.K_6: 54>
|
|
3290
|
+
K_7: Keycode # value = <Keycode.K_7: 55>
|
|
3291
|
+
K_8: Keycode # value = <Keycode.K_8: 56>
|
|
3292
|
+
K_9: Keycode # value = <Keycode.K_9: 57>
|
|
3293
|
+
K_AGAIN: Keycode # value = <Keycode.K_AGAIN: 1073741945>
|
|
3294
|
+
K_AMPERSAND: Keycode # value = <Keycode.K_AMPERSAND: 38>
|
|
3295
|
+
K_ASTERISK: Keycode # value = <Keycode.K_ASTERISK: 42>
|
|
3296
|
+
K_AT: Keycode # value = <Keycode.K_AT: 64>
|
|
3297
|
+
K_BACKSLASH: Keycode # value = <Keycode.K_BACKSLASH: 92>
|
|
3298
|
+
K_BACKSPACE: Keycode # value = <Keycode.K_BACKSPACE: 8>
|
|
3299
|
+
K_CAPS: Keycode # value = <Keycode.K_CAPS: 1073741881>
|
|
3300
|
+
K_CARET: Keycode # value = <Keycode.K_CARET: 94>
|
|
3301
|
+
K_COLON: Keycode # value = <Keycode.K_COLON: 58>
|
|
3302
|
+
K_COMMA: Keycode # value = <Keycode.K_COMMA: 44>
|
|
3303
|
+
K_COPY: Keycode # value = <Keycode.K_COPY: 1073741948>
|
|
3304
|
+
K_CUT: Keycode # value = <Keycode.K_CUT: 1073741947>
|
|
3305
|
+
K_DBLQUOTE: Keycode # value = <Keycode.K_DBLQUOTE: 34>
|
|
3306
|
+
K_DEL: Keycode # value = <Keycode.K_DEL: 127>
|
|
3307
|
+
K_DOLLAR: Keycode # value = <Keycode.K_DOLLAR: 36>
|
|
3308
|
+
K_DOWN: Keycode # value = <Keycode.K_DOWN: 1073741905>
|
|
3309
|
+
K_END: Keycode # value = <Keycode.K_END: 1073741901>
|
|
3310
|
+
K_EQ: Keycode # value = <Keycode.K_EQ: 61>
|
|
3311
|
+
K_ESC: Keycode # value = <Keycode.K_ESC: 27>
|
|
3312
|
+
K_EXCLAIM: Keycode # value = <Keycode.K_EXCLAIM: 33>
|
|
3313
|
+
K_F1: Keycode # value = <Keycode.K_F1: 1073741882>
|
|
3314
|
+
K_F10: Keycode # value = <Keycode.K_F10: 1073741891>
|
|
3315
|
+
K_F11: Keycode # value = <Keycode.K_F11: 1073741892>
|
|
3316
|
+
K_F12: Keycode # value = <Keycode.K_F12: 1073741893>
|
|
3317
|
+
K_F2: Keycode # value = <Keycode.K_F2: 1073741883>
|
|
3318
|
+
K_F3: Keycode # value = <Keycode.K_F3: 1073741884>
|
|
3319
|
+
K_F4: Keycode # value = <Keycode.K_F4: 1073741885>
|
|
3320
|
+
K_F5: Keycode # value = <Keycode.K_F5: 1073741886>
|
|
3321
|
+
K_F6: Keycode # value = <Keycode.K_F6: 1073741887>
|
|
3322
|
+
K_F7: Keycode # value = <Keycode.K_F7: 1073741888>
|
|
3323
|
+
K_F8: Keycode # value = <Keycode.K_F8: 1073741889>
|
|
3324
|
+
K_F9: Keycode # value = <Keycode.K_F9: 1073741890>
|
|
3325
|
+
K_FIND: Keycode # value = <Keycode.K_FIND: 1073741950>
|
|
3326
|
+
K_GRAVE: Keycode # value = <Keycode.K_GRAVE: 96>
|
|
3327
|
+
K_GT: Keycode # value = <Keycode.K_GT: 62>
|
|
3328
|
+
K_HASH: Keycode # value = <Keycode.K_HASH: 35>
|
|
3329
|
+
K_HOME: Keycode # value = <Keycode.K_HOME: 1073741898>
|
|
3330
|
+
K_INS: Keycode # value = <Keycode.K_INS: 1073741897>
|
|
3331
|
+
K_KP_0: Keycode # value = <Keycode.K_KP_0: 1073741922>
|
|
3332
|
+
K_KP_1: Keycode # value = <Keycode.K_KP_1: 1073741913>
|
|
3333
|
+
K_KP_2: Keycode # value = <Keycode.K_KP_2: 1073741914>
|
|
3334
|
+
K_KP_3: Keycode # value = <Keycode.K_KP_3: 1073741915>
|
|
3335
|
+
K_KP_4: Keycode # value = <Keycode.K_KP_4: 1073741916>
|
|
3336
|
+
K_KP_5: Keycode # value = <Keycode.K_KP_5: 1073741917>
|
|
3337
|
+
K_KP_6: Keycode # value = <Keycode.K_KP_6: 1073741918>
|
|
3338
|
+
K_KP_7: Keycode # value = <Keycode.K_KP_7: 1073741919>
|
|
3339
|
+
K_KP_8: Keycode # value = <Keycode.K_KP_8: 1073741920>
|
|
3340
|
+
K_KP_9: Keycode # value = <Keycode.K_KP_9: 1073741921>
|
|
3341
|
+
K_KP_DIV: Keycode # value = <Keycode.K_KP_DIV: 1073741908>
|
|
3342
|
+
K_KP_ENTER: Keycode # value = <Keycode.K_KP_ENTER: 1073741912>
|
|
3343
|
+
K_KP_MINUS: Keycode # value = <Keycode.K_KP_MINUS: 1073741910>
|
|
3344
|
+
K_KP_MULT: Keycode # value = <Keycode.K_KP_MULT: 1073741909>
|
|
3345
|
+
K_KP_PERIOD: Keycode # value = <Keycode.K_KP_PERIOD: 1073741923>
|
|
3346
|
+
K_KP_PLUS: Keycode # value = <Keycode.K_KP_PLUS: 1073741911>
|
|
3347
|
+
K_LALT: Keycode # value = <Keycode.K_LALT: 1073742050>
|
|
3348
|
+
K_LBRACE: Keycode # value = <Keycode.K_LBRACE: 123>
|
|
3349
|
+
K_LBRACKET: Keycode # value = <Keycode.K_LBRACKET: 91>
|
|
3350
|
+
K_LCTRL: Keycode # value = <Keycode.K_LCTRL: 1073742048>
|
|
3351
|
+
K_LEFT: Keycode # value = <Keycode.K_LEFT: 1073741904>
|
|
3352
|
+
K_LGUI: Keycode # value = <Keycode.K_LGUI: 1073742051>
|
|
3353
|
+
K_LPAREN: Keycode # value = <Keycode.K_LPAREN: 40>
|
|
3354
|
+
K_LSHIFT: Keycode # value = <Keycode.K_LSHIFT: 1073742049>
|
|
3355
|
+
K_LT: Keycode # value = <Keycode.K_LT: 60>
|
|
3356
|
+
K_MINUS: Keycode # value = <Keycode.K_MINUS: 45>
|
|
3357
|
+
K_MUTE: Keycode # value = <Keycode.K_MUTE: 1073741951>
|
|
3358
|
+
K_NUMLOCK: Keycode # value = <Keycode.K_NUMLOCK: 1073741907>
|
|
3359
|
+
K_PASTE: Keycode # value = <Keycode.K_PASTE: 1073741949>
|
|
3360
|
+
K_PAUSE: Keycode # value = <Keycode.K_PAUSE: 1073741896>
|
|
3361
|
+
K_PERCENT: Keycode # value = <Keycode.K_PERCENT: 37>
|
|
3362
|
+
K_PERIOD: Keycode # value = <Keycode.K_PERIOD: 46>
|
|
3363
|
+
K_PGDOWN: Keycode # value = <Keycode.K_PGDOWN: 1073741902>
|
|
3364
|
+
K_PGUP: Keycode # value = <Keycode.K_PGUP: 1073741899>
|
|
3365
|
+
K_PIPE: Keycode # value = <Keycode.K_PIPE: 124>
|
|
3366
|
+
K_PLUS: Keycode # value = <Keycode.K_PLUS: 43>
|
|
3367
|
+
K_PRTSCR: Keycode # value = <Keycode.K_PRTSCR: 1073741894>
|
|
3368
|
+
K_QUESTION: Keycode # value = <Keycode.K_QUESTION: 63>
|
|
3369
|
+
K_RALT: Keycode # value = <Keycode.K_RALT: 1073742054>
|
|
3370
|
+
K_RBRACE: Keycode # value = <Keycode.K_RBRACE: 125>
|
|
3371
|
+
K_RBRACKET: Keycode # value = <Keycode.K_RBRACKET: 93>
|
|
3372
|
+
K_RCTRL: Keycode # value = <Keycode.K_RCTRL: 1073742052>
|
|
3373
|
+
K_RETURN: Keycode # value = <Keycode.K_RETURN: 13>
|
|
3374
|
+
K_RGUI: Keycode # value = <Keycode.K_RGUI: 1073742055>
|
|
3375
|
+
K_RIGHT: Keycode # value = <Keycode.K_RIGHT: 1073741903>
|
|
3376
|
+
K_RPAREN: Keycode # value = <Keycode.K_RPAREN: 41>
|
|
3377
|
+
K_RSHIFT: Keycode # value = <Keycode.K_RSHIFT: 1073742053>
|
|
3378
|
+
K_SCRLK: Keycode # value = <Keycode.K_SCRLK: 1073741895>
|
|
3379
|
+
K_SEMICOLON: Keycode # value = <Keycode.K_SEMICOLON: 59>
|
|
3380
|
+
K_SGLQUOTE: Keycode # value = <Keycode.K_SGLQUOTE: 39>
|
|
3381
|
+
K_SLASH: Keycode # value = <Keycode.K_SLASH: 47>
|
|
3382
|
+
K_SPACE: Keycode # value = <Keycode.K_SPACE: 32>
|
|
3383
|
+
K_TAB: Keycode # value = <Keycode.K_TAB: 9>
|
|
3384
|
+
K_TILDE: Keycode # value = <Keycode.K_TILDE: 126>
|
|
3385
|
+
K_UNDERSCORE: Keycode # value = <Keycode.K_UNDERSCORE: 95>
|
|
3386
|
+
K_UNDO: Keycode # value = <Keycode.K_UNDO: 1073741946>
|
|
3387
|
+
K_UP: Keycode # value = <Keycode.K_UP: 1073741906>
|
|
3388
|
+
K_VOLDOWN: Keycode # value = <Keycode.K_VOLDOWN: 1073741953>
|
|
3389
|
+
K_VOLUP: Keycode # value = <Keycode.K_VOLUP: 1073741952>
|
|
3390
|
+
K_a: Keycode # value = <Keycode.K_a: 97>
|
|
3391
|
+
K_b: Keycode # value = <Keycode.K_b: 98>
|
|
3392
|
+
K_c: Keycode # value = <Keycode.K_c: 99>
|
|
3393
|
+
K_d: Keycode # value = <Keycode.K_d: 100>
|
|
3394
|
+
K_e: Keycode # value = <Keycode.K_e: 101>
|
|
3395
|
+
K_f: Keycode # value = <Keycode.K_f: 102>
|
|
3396
|
+
K_g: Keycode # value = <Keycode.K_g: 103>
|
|
3397
|
+
K_h: Keycode # value = <Keycode.K_h: 104>
|
|
3398
|
+
K_i: Keycode # value = <Keycode.K_i: 105>
|
|
3399
|
+
K_j: Keycode # value = <Keycode.K_j: 106>
|
|
3400
|
+
K_k: Keycode # value = <Keycode.K_k: 107>
|
|
3401
|
+
K_l: Keycode # value = <Keycode.K_l: 108>
|
|
3402
|
+
K_m: Keycode # value = <Keycode.K_m: 109>
|
|
3403
|
+
K_n: Keycode # value = <Keycode.K_n: 110>
|
|
3404
|
+
K_o: Keycode # value = <Keycode.K_o: 111>
|
|
3405
|
+
K_p: Keycode # value = <Keycode.K_p: 112>
|
|
3406
|
+
K_q: Keycode # value = <Keycode.K_q: 113>
|
|
3407
|
+
K_r: Keycode # value = <Keycode.K_r: 114>
|
|
3408
|
+
K_s: Keycode # value = <Keycode.K_s: 115>
|
|
3409
|
+
K_t: Keycode # value = <Keycode.K_t: 116>
|
|
3410
|
+
K_u: Keycode # value = <Keycode.K_u: 117>
|
|
3411
|
+
K_v: Keycode # value = <Keycode.K_v: 118>
|
|
3412
|
+
K_w: Keycode # value = <Keycode.K_w: 119>
|
|
3413
|
+
K_x: Keycode # value = <Keycode.K_x: 120>
|
|
3414
|
+
K_y: Keycode # value = <Keycode.K_y: 121>
|
|
3415
|
+
K_z: Keycode # value = <Keycode.K_z: 122>
|
|
3416
|
+
MID_LEFT: Anchor # value = <Anchor.MID_LEFT: 3>
|
|
3417
|
+
MID_RIGHT: Anchor # value = <Anchor.MID_RIGHT: 5>
|
|
3418
|
+
MOUSE_ADDED: EventType # value = <EventType.MOUSE_ADDED: 1028>
|
|
3419
|
+
MOUSE_BUTTON_DOWN: EventType # value = <EventType.MOUSE_BUTTON_DOWN: 1025>
|
|
3420
|
+
MOUSE_BUTTON_UP: EventType # value = <EventType.MOUSE_BUTTON_UP: 1026>
|
|
3421
|
+
MOUSE_MOTION: EventType # value = <EventType.MOUSE_MOTION: 1024>
|
|
3422
|
+
MOUSE_REMOVED: EventType # value = <EventType.MOUSE_REMOVED: 1029>
|
|
3423
|
+
MOUSE_WHEEL: EventType # value = <EventType.MOUSE_WHEEL: 1027>
|
|
3424
|
+
M_LEFT: MouseButton # value = <MouseButton.M_LEFT: 1>
|
|
3425
|
+
M_MIDDLE: MouseButton # value = <MouseButton.M_MIDDLE: 2>
|
|
3426
|
+
M_RIGHT: MouseButton # value = <MouseButton.M_RIGHT: 3>
|
|
3427
|
+
M_SIDE1: MouseButton # value = <MouseButton.M_SIDE1: 4>
|
|
3428
|
+
M_SIDE2: MouseButton # value = <MouseButton.M_SIDE2: 5>
|
|
3429
|
+
PEN_AXIS: EventType # value = <EventType.PEN_AXIS: 4871>
|
|
3430
|
+
PEN_BUTTON_DOWN: EventType # value = <EventType.PEN_BUTTON_DOWN: 4868>
|
|
3431
|
+
PEN_BUTTON_UP: EventType # value = <EventType.PEN_BUTTON_UP: 4869>
|
|
3432
|
+
PEN_DOWN: EventType # value = <EventType.PEN_DOWN: 4866>
|
|
3433
|
+
PEN_MOTION: EventType # value = <EventType.PEN_MOTION: 4870>
|
|
3434
|
+
PEN_PROXIMITY_IN: EventType # value = <EventType.PEN_PROXIMITY_IN: 4864>
|
|
3435
|
+
PEN_PROXIMITY_OUT: EventType # value = <EventType.PEN_PROXIMITY_OUT: 4865>
|
|
3436
|
+
PEN_UP: EventType # value = <EventType.PEN_UP: 4867>
|
|
3437
|
+
P_DISTANCE: PenAxis # value = <PenAxis.P_DISTANCE: 3>
|
|
3438
|
+
P_PRESSURE: PenAxis # value = <PenAxis.P_PRESSURE: 0>
|
|
3439
|
+
P_ROTATION: PenAxis # value = <PenAxis.P_ROTATION: 4>
|
|
3440
|
+
P_SLIDER: PenAxis # value = <PenAxis.P_SLIDER: 5>
|
|
3441
|
+
P_TANGENTIAL_PRESSURE: PenAxis # value = <PenAxis.P_TANGENTIAL_PRESSURE: 6>
|
|
3442
|
+
P_TILT_X: PenAxis # value = <PenAxis.P_TILT_X: 1>
|
|
3443
|
+
P_TILT_Y: PenAxis # value = <PenAxis.P_TILT_Y: 2>
|
|
3444
|
+
QUIT: EventType # value = <EventType.QUIT: 256>
|
|
3445
|
+
S_0: Scancode # value = <Scancode.S_0: 39>
|
|
3446
|
+
S_1: Scancode # value = <Scancode.S_1: 30>
|
|
3447
|
+
S_2: Scancode # value = <Scancode.S_2: 31>
|
|
3448
|
+
S_3: Scancode # value = <Scancode.S_3: 32>
|
|
3449
|
+
S_4: Scancode # value = <Scancode.S_4: 33>
|
|
3450
|
+
S_5: Scancode # value = <Scancode.S_5: 34>
|
|
3451
|
+
S_6: Scancode # value = <Scancode.S_6: 35>
|
|
3452
|
+
S_7: Scancode # value = <Scancode.S_7: 36>
|
|
3453
|
+
S_8: Scancode # value = <Scancode.S_8: 37>
|
|
3454
|
+
S_9: Scancode # value = <Scancode.S_9: 38>
|
|
3455
|
+
S_AGAIN: Scancode # value = <Scancode.S_AGAIN: 121>
|
|
3456
|
+
S_APOSTROPHE: Scancode # value = <Scancode.S_APOSTROPHE: 52>
|
|
3457
|
+
S_BACKSLASH: Scancode # value = <Scancode.S_BACKSLASH: 49>
|
|
3458
|
+
S_BACKSPACE: Scancode # value = <Scancode.S_BACKSPACE: 42>
|
|
3459
|
+
S_CAPS: Scancode # value = <Scancode.S_CAPS: 57>
|
|
3460
|
+
S_COMMA: Scancode # value = <Scancode.S_COMMA: 54>
|
|
3461
|
+
S_COPY: Scancode # value = <Scancode.S_COPY: 124>
|
|
3462
|
+
S_CUT: Scancode # value = <Scancode.S_CUT: 123>
|
|
3463
|
+
S_DEL: Scancode # value = <Scancode.S_DEL: 76>
|
|
3464
|
+
S_DOWN: Scancode # value = <Scancode.S_DOWN: 81>
|
|
3465
|
+
S_END: Scancode # value = <Scancode.S_END: 77>
|
|
3466
|
+
S_EQ: Scancode # value = <Scancode.S_EQ: 46>
|
|
3467
|
+
S_ESC: Scancode # value = <Scancode.S_ESC: 41>
|
|
3468
|
+
S_F1: Scancode # value = <Scancode.S_F1: 58>
|
|
3469
|
+
S_F10: Scancode # value = <Scancode.S_F10: 67>
|
|
3470
|
+
S_F11: Scancode # value = <Scancode.S_F11: 68>
|
|
3471
|
+
S_F12: Scancode # value = <Scancode.S_F12: 69>
|
|
3472
|
+
S_F2: Scancode # value = <Scancode.S_F2: 59>
|
|
3473
|
+
S_F3: Scancode # value = <Scancode.S_F3: 60>
|
|
3474
|
+
S_F4: Scancode # value = <Scancode.S_F4: 61>
|
|
3475
|
+
S_F5: Scancode # value = <Scancode.S_F5: 62>
|
|
3476
|
+
S_F6: Scancode # value = <Scancode.S_F6: 63>
|
|
3477
|
+
S_F7: Scancode # value = <Scancode.S_F7: 64>
|
|
3478
|
+
S_F8: Scancode # value = <Scancode.S_F8: 65>
|
|
3479
|
+
S_F9: Scancode # value = <Scancode.S_F9: 66>
|
|
3480
|
+
S_FIND: Scancode # value = <Scancode.S_FIND: 126>
|
|
3481
|
+
S_GRAVE: Scancode # value = <Scancode.S_GRAVE: 53>
|
|
3482
|
+
S_HOME: Scancode # value = <Scancode.S_HOME: 74>
|
|
3483
|
+
S_INS: Scancode # value = <Scancode.S_INS: 73>
|
|
3484
|
+
S_KP_0: Scancode # value = <Scancode.S_KP_0: 98>
|
|
3485
|
+
S_KP_1: Scancode # value = <Scancode.S_KP_1: 89>
|
|
3486
|
+
S_KP_2: Scancode # value = <Scancode.S_KP_2: 90>
|
|
3487
|
+
S_KP_3: Scancode # value = <Scancode.S_KP_3: 91>
|
|
3488
|
+
S_KP_4: Scancode # value = <Scancode.S_KP_4: 92>
|
|
3489
|
+
S_KP_5: Scancode # value = <Scancode.S_KP_5: 93>
|
|
3490
|
+
S_KP_6: Scancode # value = <Scancode.S_KP_6: 94>
|
|
3491
|
+
S_KP_7: Scancode # value = <Scancode.S_KP_7: 95>
|
|
3492
|
+
S_KP_8: Scancode # value = <Scancode.S_KP_8: 96>
|
|
3493
|
+
S_KP_9: Scancode # value = <Scancode.S_KP_9: 97>
|
|
3494
|
+
S_KP_DIV: Scancode # value = <Scancode.S_KP_DIV: 84>
|
|
3495
|
+
S_KP_ENTER: Scancode # value = <Scancode.S_KP_ENTER: 88>
|
|
3496
|
+
S_KP_MINUS: Scancode # value = <Scancode.S_KP_MINUS: 86>
|
|
3497
|
+
S_KP_MULT: Scancode # value = <Scancode.S_KP_MULT: 85>
|
|
3498
|
+
S_KP_PERIOD: Scancode # value = <Scancode.S_KP_PERIOD: 99>
|
|
3499
|
+
S_KP_PLUS: Scancode # value = <Scancode.S_KP_PLUS: 87>
|
|
3500
|
+
S_LALT: Scancode # value = <Scancode.S_LALT: 226>
|
|
3501
|
+
S_LBRACKET: Scancode # value = <Scancode.S_LBRACKET: 47>
|
|
3502
|
+
S_LCTRL: Scancode # value = <Scancode.S_LCTRL: 224>
|
|
3503
|
+
S_LEFT: Scancode # value = <Scancode.S_LEFT: 80>
|
|
3504
|
+
S_LGUI: Scancode # value = <Scancode.S_LGUI: 227>
|
|
3505
|
+
S_LSHIFT: Scancode # value = <Scancode.S_LSHIFT: 225>
|
|
3506
|
+
S_MINUS: Scancode # value = <Scancode.S_MINUS: 45>
|
|
3507
|
+
S_MUTE: Scancode # value = <Scancode.S_MUTE: 127>
|
|
3508
|
+
S_NUMLOCK: Scancode # value = <Scancode.S_NUMLOCK: 83>
|
|
3509
|
+
S_PASTE: Scancode # value = <Scancode.S_PASTE: 125>
|
|
3510
|
+
S_PAUSE: Scancode # value = <Scancode.S_PAUSE: 72>
|
|
3511
|
+
S_PERIOD: Scancode # value = <Scancode.S_PERIOD: 55>
|
|
3512
|
+
S_PGDOWN: Scancode # value = <Scancode.S_PGDOWN: 78>
|
|
3513
|
+
S_PGUP: Scancode # value = <Scancode.S_PGUP: 75>
|
|
3514
|
+
S_PRTSCR: Scancode # value = <Scancode.S_PRTSCR: 70>
|
|
3515
|
+
S_RALT: Scancode # value = <Scancode.S_RALT: 230>
|
|
3516
|
+
S_RBRACKET: Scancode # value = <Scancode.S_RBRACKET: 48>
|
|
3517
|
+
S_RCTRL: Scancode # value = <Scancode.S_RCTRL: 228>
|
|
3518
|
+
S_RETURN: Scancode # value = <Scancode.S_RETURN: 40>
|
|
3519
|
+
S_RGUI: Scancode # value = <Scancode.S_RGUI: 231>
|
|
3520
|
+
S_RIGHT: Scancode # value = <Scancode.S_RIGHT: 79>
|
|
3521
|
+
S_RSHIFT: Scancode # value = <Scancode.S_RSHIFT: 229>
|
|
3522
|
+
S_SCRLK: Scancode # value = <Scancode.S_SCRLK: 71>
|
|
3523
|
+
S_SEMICOLON: Scancode # value = <Scancode.S_SEMICOLON: 51>
|
|
3524
|
+
S_SLASH: Scancode # value = <Scancode.S_SLASH: 56>
|
|
3525
|
+
S_SPACE: Scancode # value = <Scancode.S_SPACE: 44>
|
|
3526
|
+
S_TAB: Scancode # value = <Scancode.S_TAB: 43>
|
|
3527
|
+
S_UNDO: Scancode # value = <Scancode.S_UNDO: 122>
|
|
3528
|
+
S_UP: Scancode # value = <Scancode.S_UP: 82>
|
|
3529
|
+
S_VOLDOWN: Scancode # value = <Scancode.S_VOLDOWN: 129>
|
|
3530
|
+
S_VOLUP: Scancode # value = <Scancode.S_VOLUP: 128>
|
|
3531
|
+
S_a: Scancode # value = <Scancode.S_a: 4>
|
|
3532
|
+
S_b: Scancode # value = <Scancode.S_b: 5>
|
|
3533
|
+
S_c: Scancode # value = <Scancode.S_c: 6>
|
|
3534
|
+
S_d: Scancode # value = <Scancode.S_d: 7>
|
|
3535
|
+
S_e: Scancode # value = <Scancode.S_e: 8>
|
|
3536
|
+
S_f: Scancode # value = <Scancode.S_f: 9>
|
|
3537
|
+
S_g: Scancode # value = <Scancode.S_g: 10>
|
|
3538
|
+
S_h: Scancode # value = <Scancode.S_h: 11>
|
|
3539
|
+
S_i: Scancode # value = <Scancode.S_i: 12>
|
|
3540
|
+
S_j: Scancode # value = <Scancode.S_j: 13>
|
|
3541
|
+
S_k: Scancode # value = <Scancode.S_k: 14>
|
|
3542
|
+
S_l: Scancode # value = <Scancode.S_l: 15>
|
|
3543
|
+
S_m: Scancode # value = <Scancode.S_m: 16>
|
|
3544
|
+
S_n: Scancode # value = <Scancode.S_n: 17>
|
|
3545
|
+
S_o: Scancode # value = <Scancode.S_o: 18>
|
|
3546
|
+
S_p: Scancode # value = <Scancode.S_p: 19>
|
|
3547
|
+
S_q: Scancode # value = <Scancode.S_q: 20>
|
|
3548
|
+
S_r: Scancode # value = <Scancode.S_r: 21>
|
|
3549
|
+
S_s: Scancode # value = <Scancode.S_s: 22>
|
|
3550
|
+
S_t: Scancode # value = <Scancode.S_t: 23>
|
|
3551
|
+
S_u: Scancode # value = <Scancode.S_u: 24>
|
|
3552
|
+
S_v: Scancode # value = <Scancode.S_v: 25>
|
|
3553
|
+
S_w: Scancode # value = <Scancode.S_w: 26>
|
|
3554
|
+
S_x: Scancode # value = <Scancode.S_x: 27>
|
|
3555
|
+
S_y: Scancode # value = <Scancode.S_y: 28>
|
|
3556
|
+
S_z: Scancode # value = <Scancode.S_z: 29>
|
|
3557
|
+
TEXT_EDITING: EventType # value = <EventType.TEXT_EDITING: 770>
|
|
3558
|
+
TEXT_INPUT: EventType # value = <EventType.TEXT_INPUT: 771>
|
|
3559
|
+
TOP_LEFT: Anchor # value = <Anchor.TOP_LEFT: 0>
|
|
3560
|
+
TOP_MID: Anchor # value = <Anchor.TOP_MID: 1>
|
|
3561
|
+
TOP_RIGHT: Anchor # value = <Anchor.TOP_RIGHT: 2>
|
|
3562
|
+
WINDOW_ENTER_FULLSCREEN: EventType # value = <EventType.WINDOW_ENTER_FULLSCREEN: 535>
|
|
3563
|
+
WINDOW_EXPOSED: EventType # value = <EventType.WINDOW_EXPOSED: 516>
|
|
3564
|
+
WINDOW_FOCUS_GAINED: EventType # value = <EventType.WINDOW_FOCUS_GAINED: 526>
|
|
3565
|
+
WINDOW_FOCUS_LOST: EventType # value = <EventType.WINDOW_FOCUS_LOST: 527>
|
|
3566
|
+
WINDOW_HIDDEN: EventType # value = <EventType.WINDOW_HIDDEN: 515>
|
|
3567
|
+
WINDOW_LEAVE_FULLSCREEN: EventType # value = <EventType.WINDOW_LEAVE_FULLSCREEN: 536>
|
|
3568
|
+
WINDOW_MAXIMIZED: EventType # value = <EventType.WINDOW_MAXIMIZED: 522>
|
|
3569
|
+
WINDOW_MINIMIZED: EventType # value = <EventType.WINDOW_MINIMIZED: 521>
|
|
3570
|
+
WINDOW_MOUSE_ENTER: EventType # value = <EventType.WINDOW_MOUSE_ENTER: 524>
|
|
3571
|
+
WINDOW_MOUSE_LEAVE: EventType # value = <EventType.WINDOW_MOUSE_LEAVE: 525>
|
|
3572
|
+
WINDOW_MOVED: EventType # value = <EventType.WINDOW_MOVED: 517>
|
|
3573
|
+
WINDOW_OCCLUDED: EventType # value = <EventType.WINDOW_OCCLUDED: 534>
|
|
3574
|
+
WINDOW_RESIZED: EventType # value = <EventType.WINDOW_RESIZED: 518>
|
|
3575
|
+
WINDOW_RESTORED: EventType # value = <EventType.WINDOW_RESTORED: 523>
|
|
3576
|
+
WINDOW_SHOWN: EventType # value = <EventType.WINDOW_SHOWN: 514>
|