kraken-engine 1.2.1__cp313-cp313-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.
@@ -0,0 +1,285 @@
1
+ """
2
+ Easing functions and animation utilities
3
+ """
4
+ from __future__ import annotations
5
+ import typing
6
+ __all__: list[str] = ['in_back', 'in_bounce', 'in_circ', 'in_cubic', 'in_elastic', 'in_expo', 'in_out_back', 'in_out_bounce', 'in_out_circ', 'in_out_cubic', 'in_out_elastic', 'in_out_expo', 'in_out_quad', 'in_out_quart', 'in_out_quint', 'in_out_sin', 'in_quad', 'in_quart', 'in_quint', 'in_sin', 'linear', 'out_back', 'out_bounce', 'out_circ', 'out_cubic', 'out_elastic', 'out_expo', 'out_quad', 'out_quart', 'out_quint', 'out_sin']
7
+ def in_back(t: typing.SupportsFloat) -> float:
8
+ """
9
+ Back easing in (overshoot at start).
10
+
11
+ Args:
12
+ t (float): Normalized time.
13
+ Returns:
14
+ float: Eased result.
15
+ """
16
+ def in_bounce(t: typing.SupportsFloat) -> float:
17
+ """
18
+ Bounce easing in (bounces toward target).
19
+
20
+ Args:
21
+ t (float): Normalized time.
22
+ Returns:
23
+ float: Eased result.
24
+ """
25
+ def in_circ(t: typing.SupportsFloat) -> float:
26
+ """
27
+ Circular easing in.
28
+
29
+ Args:
30
+ t (float): Normalized time.
31
+ Returns:
32
+ float: Eased result.
33
+ """
34
+ def in_cubic(t: typing.SupportsFloat) -> float:
35
+ """
36
+ Cubic easing in (very slow start).
37
+
38
+ Args:
39
+ t (float): Normalized time.
40
+ Returns:
41
+ float: Eased result.
42
+ """
43
+ def in_elastic(t: typing.SupportsFloat) -> float:
44
+ """
45
+ Elastic easing in (springy start).
46
+
47
+ Args:
48
+ t (float): Normalized time.
49
+ Returns:
50
+ float: Eased result.
51
+ """
52
+ def in_expo(t: typing.SupportsFloat) -> float:
53
+ """
54
+ Exponential easing in.
55
+
56
+ Args:
57
+ t (float): Normalized time.
58
+ Returns:
59
+ float: Eased result.
60
+ """
61
+ def in_out_back(t: typing.SupportsFloat) -> float:
62
+ """
63
+ Back easing in and out.
64
+
65
+ Args:
66
+ t (float): Normalized time.
67
+ Returns:
68
+ float: Eased result.
69
+ """
70
+ def in_out_bounce(t: typing.SupportsFloat) -> float:
71
+ """
72
+ Bounce easing in and out.
73
+
74
+ Args:
75
+ t (float): Normalized time.
76
+ Returns:
77
+ float: Eased result.
78
+ """
79
+ def in_out_circ(t: typing.SupportsFloat) -> float:
80
+ """
81
+ Circular easing in and out.
82
+
83
+ Args:
84
+ t (float): Normalized time.
85
+ Returns:
86
+ float: Eased result.
87
+ """
88
+ def in_out_cubic(t: typing.SupportsFloat) -> float:
89
+ """
90
+ Cubic easing in and out.
91
+
92
+ Args:
93
+ t (float): Normalized time.
94
+ Returns:
95
+ float: Eased result.
96
+ """
97
+ def in_out_elastic(t: typing.SupportsFloat) -> float:
98
+ """
99
+ Elastic easing in and out.
100
+
101
+ Args:
102
+ t (float): Normalized time.
103
+ Returns:
104
+ float: Eased result.
105
+ """
106
+ def in_out_expo(t: typing.SupportsFloat) -> float:
107
+ """
108
+ Exponential easing in and out.
109
+
110
+ Args:
111
+ t (float): Normalized time.
112
+ Returns:
113
+ float: Eased result.
114
+ """
115
+ def in_out_quad(t: typing.SupportsFloat) -> float:
116
+ """
117
+ Quadratic easing in and out.
118
+
119
+ Args:
120
+ t (float): Normalized time.
121
+ Returns:
122
+ float: Eased result.
123
+ """
124
+ def in_out_quart(t: typing.SupportsFloat) -> float:
125
+ """
126
+ Quartic easing in and out.
127
+
128
+ Args:
129
+ t (float): Normalized time.
130
+ Returns:
131
+ float: Eased result.
132
+ """
133
+ def in_out_quint(t: typing.SupportsFloat) -> float:
134
+ """
135
+ Quintic easing in and out.
136
+
137
+ Args:
138
+ t (float): Normalized time.
139
+ Returns:
140
+ float: Eased result.
141
+ """
142
+ def in_out_sin(t: typing.SupportsFloat) -> float:
143
+ """
144
+ Sinusoidal easing in and out.
145
+
146
+ Args:
147
+ t (float): Normalized time.
148
+ Returns:
149
+ float: Eased result.
150
+ """
151
+ def in_quad(t: typing.SupportsFloat) -> float:
152
+ """
153
+ Quadratic easing in (slow start).
154
+
155
+ Args:
156
+ t (float): Normalized time.
157
+ Returns:
158
+ float: Eased result.
159
+ """
160
+ def in_quart(t: typing.SupportsFloat) -> float:
161
+ """
162
+ Quartic easing in.
163
+
164
+ Args:
165
+ t (float): Normalized time.
166
+ Returns:
167
+ float: Eased result.
168
+ """
169
+ def in_quint(t: typing.SupportsFloat) -> float:
170
+ """
171
+ Quintic easing in.
172
+
173
+ Args:
174
+ t (float): Normalized time.
175
+ Returns:
176
+ float: Eased result.
177
+ """
178
+ def in_sin(t: typing.SupportsFloat) -> float:
179
+ """
180
+ Sinusoidal easing in.
181
+
182
+ Args:
183
+ t (float): Normalized time.
184
+ Returns:
185
+ float: Eased result.
186
+ """
187
+ def linear(t: typing.SupportsFloat) -> float:
188
+ """
189
+ Linear easing.
190
+
191
+ Args:
192
+ t (float): Normalized time (0.0 to 1.0).
193
+ Returns:
194
+ float: Eased result.
195
+ """
196
+ def out_back(t: typing.SupportsFloat) -> float:
197
+ """
198
+ Back easing out (overshoot at end).
199
+
200
+ Args:
201
+ t (float): Normalized time.
202
+ Returns:
203
+ float: Eased result.
204
+ """
205
+ def out_bounce(t: typing.SupportsFloat) -> float:
206
+ """
207
+ Bounce easing out (bounces after start).
208
+
209
+ Args:
210
+ t (float): Normalized time.
211
+ Returns:
212
+ float: Eased result.
213
+ """
214
+ def out_circ(t: typing.SupportsFloat) -> float:
215
+ """
216
+ Circular easing out.
217
+
218
+ Args:
219
+ t (float): Normalized time.
220
+ Returns:
221
+ float: Eased result.
222
+ """
223
+ def out_cubic(t: typing.SupportsFloat) -> float:
224
+ """
225
+ Cubic easing out (fast then smooth).
226
+
227
+ Args:
228
+ t (float): Normalized time.
229
+ Returns:
230
+ float: Eased result.
231
+ """
232
+ def out_elastic(t: typing.SupportsFloat) -> float:
233
+ """
234
+ Elastic easing out (springy end).
235
+
236
+ Args:
237
+ t (float): Normalized time.
238
+ Returns:
239
+ float: Eased result.
240
+ """
241
+ def out_expo(t: typing.SupportsFloat) -> float:
242
+ """
243
+ Exponential easing out.
244
+
245
+ Args:
246
+ t (float): Normalized time.
247
+ Returns:
248
+ float: Eased result.
249
+ """
250
+ def out_quad(t: typing.SupportsFloat) -> float:
251
+ """
252
+ Quadratic easing out (fast start).
253
+
254
+ Args:
255
+ t (float): Normalized time.
256
+ Returns:
257
+ float: Eased result.
258
+ """
259
+ def out_quart(t: typing.SupportsFloat) -> float:
260
+ """
261
+ Quartic easing out.
262
+
263
+ Args:
264
+ t (float): Normalized time.
265
+ Returns:
266
+ float: Eased result.
267
+ """
268
+ def out_quint(t: typing.SupportsFloat) -> float:
269
+ """
270
+ Quintic easing out.
271
+
272
+ Args:
273
+ t (float): Normalized time.
274
+ Returns:
275
+ float: Eased result.
276
+ """
277
+ def out_sin(t: typing.SupportsFloat) -> float:
278
+ """
279
+ Sinusoidal easing out.
280
+
281
+ Args:
282
+ t (float): Normalized time.
283
+ Returns:
284
+ float: Eased result.
285
+ """
@@ -0,0 +1,15 @@
1
+ """
2
+ Input event handling
3
+ """
4
+ from __future__ import annotations
5
+ import pykraken._core
6
+ __all__: list[str] = ['poll']
7
+ def poll() -> list[pykraken._core.Event]:
8
+ """
9
+ Poll for all pending user input events.
10
+
11
+ This clears input states and returns a list of events that occurred since the last call.
12
+
13
+ Returns:
14
+ list[Event]: A list of input event objects.
15
+ """
@@ -0,0 +1,105 @@
1
+ """
2
+ Gamepad input handling functions
3
+ """
4
+ from __future__ import annotations
5
+ import pykraken._core
6
+ import typing
7
+ __all__: list[str] = ['get_connected_slots', 'get_deadzone', 'get_left_stick', 'get_left_trigger', 'get_right_stick', 'get_right_trigger', 'is_just_pressed', 'is_just_released', 'is_pressed', 'set_deadzone']
8
+ def get_connected_slots() -> list[int]:
9
+ """
10
+ Get a list of connected gamepad slot indices.
11
+
12
+ Returns:
13
+ list[int]: A list of slot IDs with active gamepads.
14
+ """
15
+ def get_deadzone(slot: typing.SupportsInt = 0) -> float:
16
+ """
17
+ Get the current dead zone value for a gamepad's analog sticks.
18
+
19
+ Args:
20
+ slot (int, optional): Gamepad slot ID (default is 0).
21
+
22
+ Returns:
23
+ float: Deadzone threshold.
24
+ """
25
+ def get_left_stick(slot: typing.SupportsInt = 0) -> pykraken._core.Vec2:
26
+ """
27
+ Get the left analog stick position.
28
+
29
+ Args:
30
+ slot (int, optional): Gamepad slot ID (default is 0).
31
+
32
+ Returns:
33
+ Vec2: A vector of stick input normalized to [-1, 1], or (0, 0) if inside dead zone.
34
+ """
35
+ def get_left_trigger(slot: typing.SupportsInt = 0) -> float:
36
+ """
37
+ Get the left trigger's current pressure value.
38
+
39
+ Args:
40
+ slot (int, optional): Gamepad slot ID (default is 0).
41
+
42
+ Returns:
43
+ float: Trigger value in range [0.0, 1.0].
44
+ """
45
+ def get_right_stick(slot: typing.SupportsInt = 0) -> pykraken._core.Vec2:
46
+ """
47
+ Get the right analog stick position.
48
+
49
+ Args:
50
+ slot (int, optional): Gamepad slot ID (default is 0).
51
+
52
+ Returns:
53
+ Vec2: A vector of stick input normalized to [-1, 1], or (0, 0) if inside dead zone.
54
+ """
55
+ def get_right_trigger(slot: typing.SupportsInt = 0) -> float:
56
+ """
57
+ Get the right trigger's current pressure value.
58
+
59
+ Args:
60
+ slot (int, optional): Gamepad slot ID (default is 0).
61
+
62
+ Returns:
63
+ float: Trigger value in range [0.0, 1.0].
64
+ """
65
+ def is_just_pressed(button: pykraken._core.GamepadButton, slot: typing.SupportsInt = 0) -> bool:
66
+ """
67
+ Check if a gamepad button was pressed during this frame.
68
+
69
+ Args:
70
+ button (GamepadButton): The button code.
71
+ slot (int, optional): Gamepad slot ID (default is 0).
72
+
73
+ Returns:
74
+ bool: True if the button was just pressed.
75
+ """
76
+ def is_just_released(button: pykraken._core.GamepadButton, slot: typing.SupportsInt = 0) -> bool:
77
+ """
78
+ Check if a gamepad button was released during this frame.
79
+
80
+ Args:
81
+ button (GamepadButton): The button code.
82
+ slot (int, optional): Gamepad slot ID (default is 0).
83
+
84
+ Returns:
85
+ bool: True if the button was just released.
86
+ """
87
+ def is_pressed(button: pykraken._core.GamepadButton, slot: typing.SupportsInt = 0) -> bool:
88
+ """
89
+ Check if a gamepad button is currently being held down.
90
+
91
+ Args:
92
+ button (GamepadButton): The button code.
93
+ slot (int, optional): Gamepad slot ID (default is 0).
94
+
95
+ Returns:
96
+ bool: True if the button is pressed.
97
+ """
98
+ def set_deadzone(deadzone: typing.SupportsFloat, slot: typing.SupportsInt = 0) -> None:
99
+ """
100
+ Set the dead zone threshold for a gamepad's analog sticks.
101
+
102
+ Args:
103
+ deadzone (float): Value from 0.0 to 1.0 where movement is ignored.
104
+ slot (int, optional): Gamepad slot ID (default is 0).
105
+ """
@@ -0,0 +1,78 @@
1
+ """
2
+ Input handling and action binding
3
+ """
4
+ from __future__ import annotations
5
+ import collections.abc
6
+ import pykraken._core
7
+ __all__: list[str] = ['bind', 'get_axis', 'get_direction', 'is_just_pressed', 'is_just_released', 'is_pressed', 'unbind']
8
+ def bind(name: str, actions: collections.abc.Sequence[pykraken._core.InputAction]) -> None:
9
+ """
10
+ Bind a name to a list of InputActions.
11
+
12
+ Args:
13
+ name (str): The identifier for this binding (e.g. "jump").
14
+ actions (list[InputAction]): One or more InputActions to bind.
15
+ """
16
+ def get_axis(negative: str, positive: str) -> float:
17
+ """
18
+ Get a 1D axis value based on two opposing input actions.
19
+
20
+ Args:
21
+ negative (str): Name of the negative direction action (e.g. "left").
22
+ positive (str): Name of the positive direction action (e.g. "right").
23
+
24
+ Returns:
25
+ float: Value in range [-1.0, 1.0] based on input.
26
+ """
27
+ def get_direction(up: str, right: str, down: str, left: str) -> pykraken._core.Vec2:
28
+ """
29
+ Get a directional vector based on named input actions.
30
+
31
+ This is typically used for WASD-style or D-pad movement.
32
+
33
+ Args:
34
+ up (str): Name of action for upward movement.
35
+ right (str): Name of action for rightward movement.
36
+ down (str): Name of action for downward movement.
37
+ left (str): Name of action for leftward movement.
38
+
39
+ Returns:
40
+ Vec2: A normalized vector representing the intended direction.
41
+ """
42
+ def is_just_pressed(name: str) -> bool:
43
+ """
44
+ Check if the given action was just pressed this frame.
45
+
46
+ Args:
47
+ name (str): The name of the bound input.
48
+
49
+ Returns:
50
+ bool: True if pressed this frame only.
51
+ """
52
+ def is_just_released(name: str) -> bool:
53
+ """
54
+ Check if the given action was just released this frame.
55
+
56
+ Args:
57
+ name (str): The name of the bound input.
58
+
59
+ Returns:
60
+ bool: True if released this frame only.
61
+ """
62
+ def is_pressed(name: str) -> bool:
63
+ """
64
+ Check if the given action is currently being held.
65
+
66
+ Args:
67
+ name (str): The name of the bound input.
68
+
69
+ Returns:
70
+ bool: True if any action bound to the name is pressed.
71
+ """
72
+ def unbind(name: str) -> None:
73
+ """
74
+ Unbind a previously registered input name.
75
+
76
+ Args:
77
+ name (str): The binding name to remove.
78
+ """
pykraken/_core/key.pyi ADDED
@@ -0,0 +1,73 @@
1
+ """
2
+ Keyboard key state checks
3
+ """
4
+ from __future__ import annotations
5
+ import pykraken._core
6
+ import typing
7
+ __all__: list[str] = ['is_just_pressed', 'is_just_released', 'is_pressed']
8
+ @typing.overload
9
+ def is_just_pressed(scancode: pykraken._core.Scancode) -> bool:
10
+ """
11
+ Check if a key was pressed this frame (by scancode).
12
+
13
+ Args:
14
+ scancode (Scancode): The physical key.
15
+
16
+ Returns:
17
+ bool: True if the key was newly pressed.
18
+ """
19
+ @typing.overload
20
+ def is_just_pressed(keycode: pykraken._core.Keycode) -> bool:
21
+ """
22
+ Check if a key was pressed this frame (by keycode).
23
+
24
+ Args:
25
+ keycode (Keycode): The symbolic key.
26
+
27
+ Returns:
28
+ bool: True if the key was newly pressed.
29
+ """
30
+ @typing.overload
31
+ def is_just_released(scancode: pykraken._core.Scancode) -> bool:
32
+ """
33
+ Check if a key was released this frame (by scancode).
34
+
35
+ Args:
36
+ scancode (Scancode): The physical key.
37
+
38
+ Returns:
39
+ bool: True if the key was newly released.
40
+ """
41
+ @typing.overload
42
+ def is_just_released(keycode: pykraken._core.Keycode) -> bool:
43
+ """
44
+ Check if a key was released this frame (by keycode).
45
+
46
+ Args:
47
+ keycode (Keycode): The symbolic key.
48
+
49
+ Returns:
50
+ bool: True if the key was newly released.
51
+ """
52
+ @typing.overload
53
+ def is_pressed(scancode: pykraken._core.Scancode) -> bool:
54
+ """
55
+ Check if a key is currently held down (by scancode).
56
+
57
+ Args:
58
+ scancode (Scancode): The physical key (e.g., S_w).
59
+
60
+ Returns:
61
+ bool: True if the key is held.
62
+ """
63
+ @typing.overload
64
+ def is_pressed(keycode: pykraken._core.Keycode) -> bool:
65
+ """
66
+ Check if a key is currently held down (by keycode).
67
+
68
+ Args:
69
+ keycode (Keycode): The symbolic key (e.g., K_SPACE).
70
+
71
+ Returns:
72
+ bool: True if the key is held.
73
+ """
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+ import pykraken._core
3
+ __all__: list[str] = ['move']
4
+ def move(line: pykraken._core.Line, offset: pykraken._core.Vec2) -> pykraken._core.Line:
5
+ """
6
+ Move the given line by a Vec2 or 2-element sequence.
7
+
8
+ Args:
9
+ offset (Vec2 | list[float]): The amount to move.
10
+ """