kraken-engine 1.1.1__cp313-cp313-win_amd64.whl → 1.3.0__cp313-cp313-win_amd64.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.
- {kraken_engine-1.1.1.dist-info → kraken_engine-1.3.0.dist-info}/METADATA +2 -1
- kraken_engine-1.3.0.dist-info/RECORD +28 -0
- pykraken/__init__.pyi +7 -10
- pykraken/_core/__init__.pyi +640 -672
- pykraken/_core/collision.pyi +105 -57
- pykraken/_core/event.pyi +46 -1
- pykraken/_core/math.pyi +14 -3
- pykraken/_core/time.pyi +4 -4
- pykraken/_core/viewport.pyi +30 -0
- pykraken/_core/window.pyi +10 -9
- pykraken/_core.cp313-win_amd64.pyd +0 -0
- pykraken/shader_uniform.py +16 -24
- pykraken/shader_uniform.pyi +13 -21
- kraken_engine-1.1.1.dist-info/RECORD +0 -27
- {kraken_engine-1.1.1.dist-info → kraken_engine-1.3.0.dist-info}/WHEEL +0 -0
- {kraken_engine-1.1.1.dist-info → kraken_engine-1.3.0.dist-info}/licenses/LICENSE +0 -0
pykraken/_core/collision.pyi
CHANGED
|
@@ -8,228 +8,276 @@ __all__: list[str] = ['contains', 'overlap']
|
|
|
8
8
|
@typing.overload
|
|
9
9
|
def contains(outer: pykraken._core.Rect, inner: pykraken._core.Rect) -> bool:
|
|
10
10
|
"""
|
|
11
|
-
|
|
11
|
+
Check whether one rectangle completely contains another rectangle.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Args:
|
|
14
14
|
outer (Rect): The outer rectangle.
|
|
15
15
|
inner (Rect): The inner rectangle.
|
|
16
16
|
|
|
17
17
|
Returns:
|
|
18
|
-
bool:
|
|
18
|
+
bool: True if the outer rectangle completely contains the inner rectangle.
|
|
19
19
|
"""
|
|
20
20
|
@typing.overload
|
|
21
21
|
def contains(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
|
|
22
22
|
"""
|
|
23
|
-
|
|
23
|
+
Check whether a rectangle completely contains a circle.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Args:
|
|
26
26
|
rect (Rect): The rectangle.
|
|
27
27
|
circle (Circle): The circle.
|
|
28
28
|
|
|
29
29
|
Returns:
|
|
30
|
-
bool:
|
|
30
|
+
bool: True if the rectangle completely contains the circle.
|
|
31
31
|
"""
|
|
32
32
|
@typing.overload
|
|
33
33
|
def contains(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
|
|
34
34
|
"""
|
|
35
|
-
|
|
35
|
+
Check whether a rectangle completely contains a line.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Args:
|
|
38
38
|
rect (Rect): The rectangle.
|
|
39
39
|
line (Line): The line.
|
|
40
40
|
|
|
41
41
|
Returns:
|
|
42
|
-
bool:
|
|
42
|
+
bool: True if the rectangle completely contains the line.
|
|
43
43
|
"""
|
|
44
44
|
@typing.overload
|
|
45
45
|
def contains(outer: pykraken._core.Circle, inner: pykraken._core.Circle) -> bool:
|
|
46
46
|
"""
|
|
47
|
-
|
|
47
|
+
Check whether one circle completely contains another circle.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Args:
|
|
50
50
|
outer (Circle): The outer circle.
|
|
51
51
|
inner (Circle): The inner circle.
|
|
52
52
|
|
|
53
53
|
Returns:
|
|
54
|
-
bool:
|
|
54
|
+
bool: True if the outer circle completely contains the inner circle.
|
|
55
55
|
"""
|
|
56
56
|
@typing.overload
|
|
57
57
|
def contains(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
|
|
58
58
|
"""
|
|
59
|
-
|
|
59
|
+
Check whether a circle completely contains a rectangle.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Args:
|
|
62
62
|
circle (Circle): The circle.
|
|
63
63
|
rect (Rect): The rectangle.
|
|
64
64
|
|
|
65
65
|
Returns:
|
|
66
|
-
bool:
|
|
66
|
+
bool: True if the circle completely contains the rectangle.
|
|
67
67
|
"""
|
|
68
68
|
@typing.overload
|
|
69
69
|
def contains(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
|
|
70
70
|
"""
|
|
71
|
-
|
|
71
|
+
Check whether a circle completely contains a line.
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Args:
|
|
74
74
|
circle (Circle): The circle.
|
|
75
75
|
line (Line): The line.
|
|
76
76
|
|
|
77
77
|
Returns:
|
|
78
|
-
bool:
|
|
78
|
+
bool: True if the circle completely contains the line.
|
|
79
79
|
"""
|
|
80
80
|
@typing.overload
|
|
81
81
|
def overlap(a: pykraken._core.Rect, b: pykraken._core.Rect) -> bool:
|
|
82
82
|
"""
|
|
83
|
-
|
|
83
|
+
Check whether two rectangles overlap.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Args:
|
|
86
86
|
a (Rect): The first rectangle.
|
|
87
87
|
b (Rect): The second rectangle.
|
|
88
88
|
|
|
89
89
|
Returns:
|
|
90
|
-
bool:
|
|
90
|
+
bool: True if the rectangles overlap.
|
|
91
91
|
"""
|
|
92
92
|
@typing.overload
|
|
93
93
|
def overlap(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
|
|
94
94
|
"""
|
|
95
|
-
|
|
95
|
+
Check whether a rectangle and a circle overlap.
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Args:
|
|
98
98
|
rect (Rect): The rectangle.
|
|
99
99
|
circle (Circle): The circle.
|
|
100
100
|
|
|
101
101
|
Returns:
|
|
102
|
-
bool:
|
|
102
|
+
bool: True if the rectangle and circle overlap.
|
|
103
103
|
"""
|
|
104
104
|
@typing.overload
|
|
105
105
|
def overlap(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
|
|
106
106
|
"""
|
|
107
|
-
|
|
107
|
+
Check whether a rectangle and a line overlap.
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Args:
|
|
110
110
|
rect (Rect): The rectangle.
|
|
111
111
|
line (Line): The line.
|
|
112
112
|
|
|
113
113
|
Returns:
|
|
114
|
-
bool:
|
|
114
|
+
bool: True if the rectangle and line overlap.
|
|
115
115
|
"""
|
|
116
116
|
@typing.overload
|
|
117
117
|
def overlap(rect: pykraken._core.Rect, point: pykraken._core.Vec2) -> bool:
|
|
118
118
|
"""
|
|
119
|
-
|
|
119
|
+
Check whether a rectangle contains a point.
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Args:
|
|
122
122
|
rect (Rect): The rectangle.
|
|
123
123
|
point (Vec2): The point.
|
|
124
124
|
|
|
125
125
|
Returns:
|
|
126
|
-
bool:
|
|
126
|
+
bool: True if the rectangle contains the point.
|
|
127
127
|
"""
|
|
128
128
|
@typing.overload
|
|
129
129
|
def overlap(a: pykraken._core.Circle, b: pykraken._core.Circle) -> bool:
|
|
130
130
|
"""
|
|
131
|
-
|
|
131
|
+
Check whether two circles overlap.
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
Args:
|
|
134
134
|
a (Circle): The first circle.
|
|
135
135
|
b (Circle): The second circle.
|
|
136
136
|
|
|
137
137
|
Returns:
|
|
138
|
-
bool:
|
|
138
|
+
bool: True if the circles overlap.
|
|
139
139
|
"""
|
|
140
140
|
@typing.overload
|
|
141
141
|
def overlap(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
|
|
142
142
|
"""
|
|
143
|
-
|
|
143
|
+
Check whether a circle and a rectangle overlap.
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
Args:
|
|
146
146
|
circle (Circle): The circle.
|
|
147
147
|
rect (Rect): The rectangle.
|
|
148
148
|
|
|
149
149
|
Returns:
|
|
150
|
-
bool:
|
|
150
|
+
bool: True if the circle and rectangle overlap.
|
|
151
151
|
"""
|
|
152
152
|
@typing.overload
|
|
153
153
|
def overlap(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
|
|
154
154
|
"""
|
|
155
|
-
|
|
155
|
+
Check whether a circle and a line overlap.
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
Args:
|
|
158
158
|
circle (Circle): The circle.
|
|
159
159
|
line (Line): The line.
|
|
160
160
|
|
|
161
161
|
Returns:
|
|
162
|
-
bool:
|
|
162
|
+
bool: True if the circle and line overlap.
|
|
163
163
|
"""
|
|
164
164
|
@typing.overload
|
|
165
165
|
def overlap(circle: pykraken._core.Circle, point: pykraken._core.Vec2) -> bool:
|
|
166
166
|
"""
|
|
167
|
-
|
|
167
|
+
Check whether a circle contains a point.
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
Args:
|
|
170
170
|
circle (Circle): The circle.
|
|
171
171
|
point (Vec2): The point.
|
|
172
172
|
|
|
173
173
|
Returns:
|
|
174
|
-
bool:
|
|
174
|
+
bool: True if the circle contains the point.
|
|
175
175
|
"""
|
|
176
176
|
@typing.overload
|
|
177
177
|
def overlap(a: pykraken._core.Line, b: pykraken._core.Line) -> bool:
|
|
178
178
|
"""
|
|
179
|
-
|
|
179
|
+
Check whether two lines overlap (intersect).
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
Args:
|
|
182
182
|
a (Line): The first line.
|
|
183
183
|
b (Line): The second line.
|
|
184
184
|
|
|
185
185
|
Returns:
|
|
186
|
-
bool:
|
|
186
|
+
bool: True if the lines intersect.
|
|
187
187
|
"""
|
|
188
188
|
@typing.overload
|
|
189
189
|
def overlap(line: pykraken._core.Line, rect: pykraken._core.Rect) -> bool:
|
|
190
190
|
"""
|
|
191
|
-
|
|
191
|
+
Check whether a line and a rectangle overlap.
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
Args:
|
|
194
194
|
line (Line): The line.
|
|
195
195
|
rect (Rect): The rectangle.
|
|
196
196
|
|
|
197
197
|
Returns:
|
|
198
|
-
bool:
|
|
198
|
+
bool: True if the line and rectangle overlap.
|
|
199
199
|
"""
|
|
200
200
|
@typing.overload
|
|
201
201
|
def overlap(line: pykraken._core.Line, circle: pykraken._core.Circle) -> bool:
|
|
202
202
|
"""
|
|
203
|
-
|
|
203
|
+
Check whether a line and a circle overlap.
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
Args:
|
|
206
206
|
line (Line): The line.
|
|
207
207
|
circle (Circle): The circle.
|
|
208
208
|
|
|
209
209
|
Returns:
|
|
210
|
-
bool:
|
|
210
|
+
bool: True if the line and circle overlap.
|
|
211
211
|
"""
|
|
212
212
|
@typing.overload
|
|
213
213
|
def overlap(point: pykraken._core.Vec2, rect: pykraken._core.Rect) -> bool:
|
|
214
214
|
"""
|
|
215
|
-
|
|
215
|
+
Check whether a point is inside a rectangle.
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
Args:
|
|
218
218
|
point (Vec2): The point.
|
|
219
219
|
rect (Rect): The rectangle.
|
|
220
220
|
|
|
221
221
|
Returns:
|
|
222
|
-
bool:
|
|
222
|
+
bool: True if the point is inside the rectangle.
|
|
223
223
|
"""
|
|
224
224
|
@typing.overload
|
|
225
225
|
def overlap(point: pykraken._core.Vec2, circle: pykraken._core.Circle) -> bool:
|
|
226
226
|
"""
|
|
227
|
-
|
|
227
|
+
Check whether a point is inside a circle.
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
Args:
|
|
230
230
|
point (Vec2): The point.
|
|
231
231
|
circle (Circle): The circle.
|
|
232
232
|
|
|
233
233
|
Returns:
|
|
234
|
-
bool:
|
|
234
|
+
bool: True if the point is inside the circle.
|
|
235
|
+
"""
|
|
236
|
+
@typing.overload
|
|
237
|
+
def overlap(polygon: pykraken._core.Polygon, point: pykraken._core.Vec2) -> bool:
|
|
238
|
+
"""
|
|
239
|
+
Check whether a polygon contains a point.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
polygon (Polygon): The polygon.
|
|
243
|
+
point (Vec2): The point.
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
bool: True if the polygon contains the point.
|
|
247
|
+
"""
|
|
248
|
+
@typing.overload
|
|
249
|
+
def overlap(point: pykraken._core.Vec2, polygon: pykraken._core.Polygon) -> bool:
|
|
250
|
+
"""
|
|
251
|
+
Check whether a point is inside a polygon.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
point (Vec2): The point.
|
|
255
|
+
polygon (Polygon): The polygon.
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
bool: True if the point is inside the polygon.
|
|
259
|
+
"""
|
|
260
|
+
@typing.overload
|
|
261
|
+
def overlap(polygon: pykraken._core.Polygon, rect: pykraken._core.Rect) -> bool:
|
|
262
|
+
"""
|
|
263
|
+
Check whether a polygon and a rectangle overlap.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
polygon (Polygon): The polygon.
|
|
267
|
+
rect (Rect): The rectangle.
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
bool: True if the polygon and rectangle overlap.
|
|
271
|
+
"""
|
|
272
|
+
@typing.overload
|
|
273
|
+
def overlap(rect: pykraken._core.Rect, polygon: pykraken._core.Polygon) -> bool:
|
|
274
|
+
"""
|
|
275
|
+
Check whether a rectangle and a polygon overlap.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
rect (Rect): The rectangle.
|
|
279
|
+
polygon (Polygon): The polygon.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
bool: True if the rectangle and polygon overlap.
|
|
235
283
|
"""
|
pykraken/_core/event.pyi
CHANGED
|
@@ -3,7 +3,28 @@ Input event handling
|
|
|
3
3
|
"""
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
import pykraken._core
|
|
6
|
-
|
|
6
|
+
import typing
|
|
7
|
+
__all__: list[str] = ['cancel_scheduled', 'new_custom', 'poll', 'push', 'schedule']
|
|
8
|
+
def cancel_scheduled(event: pykraken._core.Event) -> None:
|
|
9
|
+
"""
|
|
10
|
+
Cancel a scheduled event timer.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
event (Event): The custom event whose timer should be cancelled.
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
RuntimeError: If attempting to cancel a non-custom event type.
|
|
17
|
+
"""
|
|
18
|
+
def new_custom() -> pykraken._core.Event:
|
|
19
|
+
"""
|
|
20
|
+
Create a new custom event type.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Event: A new Event object with a unique custom event type.
|
|
24
|
+
|
|
25
|
+
Raises:
|
|
26
|
+
RuntimeError: If registering a custom event type fails.
|
|
27
|
+
"""
|
|
7
28
|
def poll() -> list[pykraken._core.Event]:
|
|
8
29
|
"""
|
|
9
30
|
Poll for all pending user input events.
|
|
@@ -13,3 +34,27 @@ def poll() -> list[pykraken._core.Event]:
|
|
|
13
34
|
Returns:
|
|
14
35
|
list[Event]: A list of input event objects.
|
|
15
36
|
"""
|
|
37
|
+
def push(event: pykraken._core.Event) -> None:
|
|
38
|
+
"""
|
|
39
|
+
Push a custom event to the event queue.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
event (Event): The custom event to push to the queue.
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
RuntimeError: If attempting to push a non-custom event type.
|
|
46
|
+
"""
|
|
47
|
+
def schedule(event: pykraken._core.Event, delay_ms: typing.SupportsInt, repeat: bool = False) -> None:
|
|
48
|
+
"""
|
|
49
|
+
Schedule a custom event to be pushed after a delay. Will overwrite any existing timer for the same event.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
event (Event): The custom event to schedule.
|
|
53
|
+
delay_ms (int): Delay in milliseconds before the event is pushed.
|
|
54
|
+
repeat (bool, optional): If True, the event will be pushed repeatedly at the
|
|
55
|
+
specified interval. If False, the event is pushed only once. Defaults to False.
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
RuntimeError: If attempting to schedule a non-custom event type, or if timer
|
|
59
|
+
creation fails.
|
|
60
|
+
"""
|
pykraken/_core/math.pyi
CHANGED
|
@@ -4,7 +4,7 @@ Math related functions
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
import pykraken._core
|
|
6
6
|
import typing
|
|
7
|
-
__all__: list[str] = ['angle_between', 'clamp', 'cross', 'dot', 'from_polar', 'lerp', 'normalize', 'remap', 'scale_to_length', 'to_deg', 'to_rad']
|
|
7
|
+
__all__: list[str] = ['angle_between', 'clamp', 'cross', 'dot', 'from_polar', 'lerp', 'normalize', 'remap', 'rotate', 'scale_to_length', 'to_deg', 'to_rad']
|
|
8
8
|
def angle_between(a: pykraken._core.Vec2, b: pykraken._core.Vec2) -> float:
|
|
9
9
|
"""
|
|
10
10
|
Calculate the angle between two vectors.
|
|
@@ -22,7 +22,7 @@ def clamp(vec: pykraken._core.Vec2, min_vec: pykraken._core.Vec2, max_vec: pykra
|
|
|
22
22
|
Clamp a vector between two boundary vectors.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
|
|
25
|
+
vec (Vec2): The vector to clamp.
|
|
26
26
|
min_vec (Vec2): The minimum boundary vector.
|
|
27
27
|
max_vec (Vec2): The maximum boundary vector.
|
|
28
28
|
|
|
@@ -118,7 +118,7 @@ def normalize(vec: pykraken._core.Vec2) -> pykraken._core.Vec2:
|
|
|
118
118
|
Normalize a vector to unit length.
|
|
119
119
|
|
|
120
120
|
Args:
|
|
121
|
-
|
|
121
|
+
vec (Vec2): The input vector.
|
|
122
122
|
|
|
123
123
|
Returns:
|
|
124
124
|
Vec2: A new normalized vector.
|
|
@@ -140,6 +140,17 @@ def remap(in_min: typing.SupportsFloat, in_max: typing.SupportsFloat, out_min: t
|
|
|
140
140
|
Raises:
|
|
141
141
|
ValueError: If in_min equals in_max.
|
|
142
142
|
"""
|
|
143
|
+
def rotate(vec: pykraken._core.Vec2, radians: typing.SupportsFloat) -> pykraken._core.Vec2:
|
|
144
|
+
"""
|
|
145
|
+
Rotate a vector by an angle without mutating the input.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
vec (Vec2): The vector to rotate.
|
|
149
|
+
radians (float): Rotation angle in radians.
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
Vec2: A new rotated vector.
|
|
153
|
+
"""
|
|
143
154
|
def scale_to_length(vector: pykraken._core.Vec2, length: typing.SupportsFloat) -> pykraken._core.Vec2:
|
|
144
155
|
"""
|
|
145
156
|
Scale a vector to a given length.
|
pykraken/_core/time.pyi
CHANGED
|
@@ -52,10 +52,10 @@ def set_max_delta(max_delta: typing.SupportsFloat) -> None:
|
|
|
52
52
|
"""
|
|
53
53
|
Set the maximum allowed delta time between frames.
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
max_delta (float):
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
Args:
|
|
56
|
+
max_delta (float): Maximum delta time in seconds (> 0.0).
|
|
57
|
+
Use this to avoid large deltas during frame drops or pauses
|
|
58
|
+
that could destabilize physics or animations.
|
|
59
59
|
"""
|
|
60
60
|
def set_scale(scale: typing.SupportsFloat) -> None:
|
|
61
61
|
"""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Viewport management functions
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import pykraken._core
|
|
6
|
+
import typing
|
|
7
|
+
__all__: list[str] = ['layout', 'set', 'unset']
|
|
8
|
+
def layout(count: typing.SupportsInt, mode: pykraken._core.ViewportMode = pykraken._core.ViewportMode.VERTICAL) -> list[pykraken._core.Rect]:
|
|
9
|
+
"""
|
|
10
|
+
Layout the screen into multiple viewports.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
count (int): The number of viewports to create (between 2 and 4).
|
|
14
|
+
mode (ViewportMode, optional): The layout mode for 2 viewports (VERTICAL or HORIZONTAL).
|
|
15
|
+
Defaults to VERTICAL.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
list[Rect]: A list of Rects representing the viewports.
|
|
19
|
+
"""
|
|
20
|
+
def set(rect: pykraken._core.Rect) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Set the current viewport to the given rectangle.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
rect (Rect): The rectangle defining the viewport.
|
|
26
|
+
"""
|
|
27
|
+
def unset() -> None:
|
|
28
|
+
"""
|
|
29
|
+
Unset the current viewport, reverting to the full rendering area.
|
|
30
|
+
"""
|
pykraken/_core/window.pyi
CHANGED
|
@@ -13,18 +13,16 @@ def close() -> None:
|
|
|
13
13
|
"""
|
|
14
14
|
def create(title: str, resolution: pykraken._core.Vec2, scaled: bool = False) -> None:
|
|
15
15
|
"""
|
|
16
|
-
Create a window with
|
|
16
|
+
Create a window with the requested title and resolution.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
|
-
title (str):
|
|
20
|
-
resolution (Vec2):
|
|
21
|
-
scaled (bool
|
|
22
|
-
display's usable bounds, retaining the resolution's ratio.
|
|
23
|
-
Defaults to False.
|
|
19
|
+
title (str): Non-empty title no longer than 255 characters.
|
|
20
|
+
resolution (Vec2): Target renderer resolution as (width, height).
|
|
21
|
+
scaled (bool): When True, stretches to usable display bounds while maintaining aspect.
|
|
24
22
|
|
|
25
23
|
Raises:
|
|
26
|
-
RuntimeError: If a window already exists or window creation fails.
|
|
27
|
-
ValueError: If title is
|
|
24
|
+
RuntimeError: If a window already exists or SDL window creation fails.
|
|
25
|
+
ValueError: If the title is invalid or any dimension is non-positive.
|
|
28
26
|
"""
|
|
29
27
|
def get_scale() -> int:
|
|
30
28
|
"""
|
|
@@ -68,7 +66,7 @@ def is_fullscreen() -> bool:
|
|
|
68
66
|
"""
|
|
69
67
|
def is_open() -> bool:
|
|
70
68
|
"""
|
|
71
|
-
|
|
69
|
+
Report whether the window is currently open.
|
|
72
70
|
|
|
73
71
|
Returns:
|
|
74
72
|
bool: True if the window is open and active.
|
|
@@ -79,6 +77,9 @@ def save_screenshot(path: str) -> None:
|
|
|
79
77
|
|
|
80
78
|
Args:
|
|
81
79
|
path (str): The path to save the screenshot to.
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
RuntimeError: If the window is not initialized or the screenshot cannot be saved.
|
|
82
83
|
"""
|
|
83
84
|
def set_fullscreen(fullscreen: bool) -> None:
|
|
84
85
|
"""
|
|
Binary file
|
pykraken/shader_uniform.py
CHANGED
|
@@ -3,35 +3,27 @@ import struct
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class ShaderUniform(BaseModel):
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
to
|
|
13
|
-
|
|
14
|
-
Supported field types:
|
|
15
|
-
- float: Packed as 'f' (4 bytes)
|
|
16
|
-
- int: Packed as 'i' (4 bytes, signed)
|
|
17
|
-
- bool: Packed as '?' (1 byte)
|
|
18
|
-
- tuple/list of 2-4 floats: Packed as vectors (vec2, vec3, vec4)
|
|
6
|
+
"""Base model for shader uniform data structures.
|
|
7
|
+
|
|
8
|
+
Subclass this to describe your shader's uniform layout. Instances can be
|
|
9
|
+
converted to bytes for uploads through ``ShaderState.set_uniform()``. Field
|
|
10
|
+
values are packed according to their types: ``float`` values use the ``f``
|
|
11
|
+
format, ``int`` values use ``i``, ``bool`` values use ``?``, and tuples or
|
|
12
|
+
lists of two to four floats are packed as vector components.
|
|
19
13
|
"""
|
|
20
14
|
|
|
21
15
|
def to_bytes(self) -> bytes:
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
is automatically determined based on field types.
|
|
28
|
-
|
|
16
|
+
"""Serialize the uniform data into a packed binary format.
|
|
17
|
+
|
|
18
|
+
The packing order follows the model's field order, and Python's ``struct``
|
|
19
|
+
module determines the byte layout based on field types.
|
|
20
|
+
|
|
29
21
|
Returns:
|
|
30
|
-
bytes:
|
|
31
|
-
|
|
22
|
+
bytes: Packed binary representation of the uniform data.
|
|
23
|
+
|
|
32
24
|
Raises:
|
|
33
|
-
ValueError: If a tuple
|
|
34
|
-
TypeError: If a field
|
|
25
|
+
ValueError: If a tuple or list field does not contain 2, 3, or 4 values.
|
|
26
|
+
TypeError: If a field uses an unsupported type.
|
|
35
27
|
"""
|
|
36
28
|
fmt = ""
|
|
37
29
|
values = []
|
pykraken/shader_uniform.pyi
CHANGED
|
@@ -9,26 +9,20 @@ import typing
|
|
|
9
9
|
__all__: list[str] = ['BaseModel', 'ShaderUniform', 'struct']
|
|
10
10
|
class ShaderUniform(pydantic.main.BaseModel):
|
|
11
11
|
"""
|
|
12
|
+
Base model for shader uniform data structures.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
to the GPU via `ShaderState.set_uniform()`.
|
|
19
|
-
|
|
20
|
-
Supported field types:
|
|
21
|
-
- float: Packed as 'f' (4 bytes)
|
|
22
|
-
- int: Packed as 'i' (4 bytes, signed)
|
|
23
|
-
- bool: Packed as '?' (1 byte)
|
|
24
|
-
- tuple/list of 2-4 floats: Packed as vectors (vec2, vec3, vec4)
|
|
14
|
+
Subclass this to describe your shader's uniform layout. Instances can be
|
|
15
|
+
converted to bytes for uploads through ``ShaderState.set_uniform()``. Field
|
|
16
|
+
values are packed according to their types: ``float`` values use the ``f``
|
|
17
|
+
format, ``int`` values use ``i``, ``bool`` values use ``?``, and tuples or
|
|
18
|
+
lists of two to four floats are packed as vector components.
|
|
25
19
|
"""
|
|
26
20
|
__abstractmethods__: typing.ClassVar[frozenset] # value = frozenset()
|
|
27
21
|
__class_vars__: typing.ClassVar[set] = set()
|
|
28
22
|
__private_attributes__: typing.ClassVar[dict] = {}
|
|
29
23
|
__pydantic_complete__: typing.ClassVar[bool] = True
|
|
30
24
|
__pydantic_computed_fields__: typing.ClassVar[dict] = {}
|
|
31
|
-
__pydantic_core_schema__: typing.ClassVar[dict] = {'type': 'model', 'cls': ShaderUniform, 'schema': {'type': 'model-fields', 'fields': {}, 'model_name': 'ShaderUniform', 'computed_fields': list()}, 'custom_init': False, 'root_model': False, 'config': {'title': 'ShaderUniform'}, 'ref': 'pykraken.shader_uniform.ShaderUniform:
|
|
25
|
+
__pydantic_core_schema__: typing.ClassVar[dict] = {'type': 'model', 'cls': ShaderUniform, 'schema': {'type': 'model-fields', 'fields': {}, 'model_name': 'ShaderUniform', 'computed_fields': list()}, 'custom_init': False, 'root_model': False, 'config': {'title': 'ShaderUniform'}, 'ref': 'pykraken.shader_uniform.ShaderUniform:1434400820944', 'metadata': {'pydantic_js_functions': [pydantic.main.BaseModel.__get_pydantic_json_schema__]}}
|
|
32
26
|
__pydantic_custom_init__: typing.ClassVar[bool] = False
|
|
33
27
|
__pydantic_decorators__: typing.ClassVar[pydantic._internal._decorators.DecoratorInfos] # value = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
|
|
34
28
|
__pydantic_fields__: typing.ClassVar[dict] = {}
|
|
@@ -43,17 +37,15 @@ class ShaderUniform(pydantic.main.BaseModel):
|
|
|
43
37
|
model_config: typing.ClassVar[dict] = {}
|
|
44
38
|
def to_bytes(self) -> bytes:
|
|
45
39
|
"""
|
|
40
|
+
Serialize the uniform data into a packed binary format.
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Serializes all fields in the model to a bytes object using Python's struct
|
|
50
|
-
module, suitable for uploading to GPU uniform buffers. The packing format
|
|
51
|
-
is automatically determined based on field types.
|
|
42
|
+
The packing order follows the model's field order, and Python's ``struct``
|
|
43
|
+
module determines the byte layout based on field types.
|
|
52
44
|
|
|
53
45
|
Returns:
|
|
54
|
-
bytes:
|
|
46
|
+
bytes: Packed binary representation of the uniform data.
|
|
55
47
|
|
|
56
48
|
Raises:
|
|
57
|
-
ValueError: If a tuple
|
|
58
|
-
TypeError: If a field
|
|
49
|
+
ValueError: If a tuple or list field does not contain 2, 3, or 4 values.
|
|
50
|
+
TypeError: If a field uses an unsupported type.
|
|
59
51
|
"""
|