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.
- kraken_engine-1.2.1.dist-info/METADATA +53 -0
- kraken_engine-1.2.1.dist-info/RECORD +27 -0
- kraken_engine-1.2.1.dist-info/WHEEL +6 -0
- kraken_engine-1.2.1.dist-info/licenses/LICENSE +21 -0
- pykraken/__init__.py +2 -0
- pykraken/__init__.pyi +513 -0
- pykraken/__pyinstaller/hook-pykraken.py +8 -0
- pykraken/_core/__init__.pyi +4137 -0
- pykraken/_core/collision.pyi +283 -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 +184 -0
- pykraken/_core/mouse.pyi +85 -0
- pykraken/_core/rect.pyi +93 -0
- pykraken/_core/renderer.pyi +74 -0
- pykraken/_core/time.pyi +75 -0
- pykraken/_core/transform.pyi +141 -0
- pykraken/_core/window.pyi +113 -0
- pykraken/_core.cpython-313-darwin.so +0 -0
- pykraken/shader_uniform.py +55 -0
- pykraken/shader_uniform.pyi +59 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Collision detection functions
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import pykraken._core
|
|
6
|
+
import typing
|
|
7
|
+
__all__: list[str] = ['contains', 'overlap']
|
|
8
|
+
@typing.overload
|
|
9
|
+
def contains(outer: pykraken._core.Rect, inner: pykraken._core.Rect) -> bool:
|
|
10
|
+
"""
|
|
11
|
+
Checks if one rectangle completely contains another rectangle.
|
|
12
|
+
|
|
13
|
+
Parameters:
|
|
14
|
+
outer (Rect): The outer rectangle.
|
|
15
|
+
inner (Rect): The inner rectangle.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
bool: Whether the outer rectangle completely contains the inner rectangle.
|
|
19
|
+
"""
|
|
20
|
+
@typing.overload
|
|
21
|
+
def contains(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
|
|
22
|
+
"""
|
|
23
|
+
Checks if a rectangle completely contains a circle.
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
rect (Rect): The rectangle.
|
|
27
|
+
circle (Circle): The circle.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
bool: Whether the rectangle completely contains the circle.
|
|
31
|
+
"""
|
|
32
|
+
@typing.overload
|
|
33
|
+
def contains(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
|
|
34
|
+
"""
|
|
35
|
+
Checks if a rectangle completely contains a line.
|
|
36
|
+
|
|
37
|
+
Parameters:
|
|
38
|
+
rect (Rect): The rectangle.
|
|
39
|
+
line (Line): The line.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
bool: Whether the rectangle completely contains the line.
|
|
43
|
+
"""
|
|
44
|
+
@typing.overload
|
|
45
|
+
def contains(outer: pykraken._core.Circle, inner: pykraken._core.Circle) -> bool:
|
|
46
|
+
"""
|
|
47
|
+
Checks if one circle completely contains another circle.
|
|
48
|
+
|
|
49
|
+
Parameters:
|
|
50
|
+
outer (Circle): The outer circle.
|
|
51
|
+
inner (Circle): The inner circle.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
bool: Whether the outer circle completely contains the inner circle.
|
|
55
|
+
"""
|
|
56
|
+
@typing.overload
|
|
57
|
+
def contains(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
|
|
58
|
+
"""
|
|
59
|
+
Checks if a circle completely contains a rectangle.
|
|
60
|
+
|
|
61
|
+
Parameters:
|
|
62
|
+
circle (Circle): The circle.
|
|
63
|
+
rect (Rect): The rectangle.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
bool: Whether the circle completely contains the rectangle.
|
|
67
|
+
"""
|
|
68
|
+
@typing.overload
|
|
69
|
+
def contains(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
|
|
70
|
+
"""
|
|
71
|
+
Checks if a circle completely contains a line.
|
|
72
|
+
|
|
73
|
+
Parameters:
|
|
74
|
+
circle (Circle): The circle.
|
|
75
|
+
line (Line): The line.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
bool: Whether the circle completely contains the line.
|
|
79
|
+
"""
|
|
80
|
+
@typing.overload
|
|
81
|
+
def overlap(a: pykraken._core.Rect, b: pykraken._core.Rect) -> bool:
|
|
82
|
+
"""
|
|
83
|
+
Checks if two rectangles overlap.
|
|
84
|
+
|
|
85
|
+
Parameters:
|
|
86
|
+
a (Rect): The first rectangle.
|
|
87
|
+
b (Rect): The second rectangle.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
bool: Whether the rectangles overlap.
|
|
91
|
+
"""
|
|
92
|
+
@typing.overload
|
|
93
|
+
def overlap(rect: pykraken._core.Rect, circle: pykraken._core.Circle) -> bool:
|
|
94
|
+
"""
|
|
95
|
+
Checks if a rectangle and a circle overlap.
|
|
96
|
+
|
|
97
|
+
Parameters:
|
|
98
|
+
rect (Rect): The rectangle.
|
|
99
|
+
circle (Circle): The circle.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
bool: Whether the rectangle and circle overlap.
|
|
103
|
+
"""
|
|
104
|
+
@typing.overload
|
|
105
|
+
def overlap(rect: pykraken._core.Rect, line: pykraken._core.Line) -> bool:
|
|
106
|
+
"""
|
|
107
|
+
Checks if a rectangle and a line overlap.
|
|
108
|
+
|
|
109
|
+
Parameters:
|
|
110
|
+
rect (Rect): The rectangle.
|
|
111
|
+
line (Line): The line.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
bool: Whether the rectangle and line overlap.
|
|
115
|
+
"""
|
|
116
|
+
@typing.overload
|
|
117
|
+
def overlap(rect: pykraken._core.Rect, point: pykraken._core.Vec2) -> bool:
|
|
118
|
+
"""
|
|
119
|
+
Checks if a rectangle contains a point.
|
|
120
|
+
|
|
121
|
+
Parameters:
|
|
122
|
+
rect (Rect): The rectangle.
|
|
123
|
+
point (Vec2): The point.
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
bool: Whether the rectangle contains the point.
|
|
127
|
+
"""
|
|
128
|
+
@typing.overload
|
|
129
|
+
def overlap(a: pykraken._core.Circle, b: pykraken._core.Circle) -> bool:
|
|
130
|
+
"""
|
|
131
|
+
Checks if two circles overlap.
|
|
132
|
+
|
|
133
|
+
Parameters:
|
|
134
|
+
a (Circle): The first circle.
|
|
135
|
+
b (Circle): The second circle.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
bool: Whether the circles overlap.
|
|
139
|
+
"""
|
|
140
|
+
@typing.overload
|
|
141
|
+
def overlap(circle: pykraken._core.Circle, rect: pykraken._core.Rect) -> bool:
|
|
142
|
+
"""
|
|
143
|
+
Checks if a circle and a rectangle overlap.
|
|
144
|
+
|
|
145
|
+
Parameters:
|
|
146
|
+
circle (Circle): The circle.
|
|
147
|
+
rect (Rect): The rectangle.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
bool: Whether the circle and rectangle overlap.
|
|
151
|
+
"""
|
|
152
|
+
@typing.overload
|
|
153
|
+
def overlap(circle: pykraken._core.Circle, line: pykraken._core.Line) -> bool:
|
|
154
|
+
"""
|
|
155
|
+
Checks if a circle and a line overlap.
|
|
156
|
+
|
|
157
|
+
Parameters:
|
|
158
|
+
circle (Circle): The circle.
|
|
159
|
+
line (Line): The line.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
bool: Whether the circle and line overlap.
|
|
163
|
+
"""
|
|
164
|
+
@typing.overload
|
|
165
|
+
def overlap(circle: pykraken._core.Circle, point: pykraken._core.Vec2) -> bool:
|
|
166
|
+
"""
|
|
167
|
+
Checks if a circle contains a point.
|
|
168
|
+
|
|
169
|
+
Parameters:
|
|
170
|
+
circle (Circle): The circle.
|
|
171
|
+
point (Vec2): The point.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
bool: Whether the circle contains the point.
|
|
175
|
+
"""
|
|
176
|
+
@typing.overload
|
|
177
|
+
def overlap(a: pykraken._core.Line, b: pykraken._core.Line) -> bool:
|
|
178
|
+
"""
|
|
179
|
+
Checks if two lines overlap (intersect).
|
|
180
|
+
|
|
181
|
+
Parameters:
|
|
182
|
+
a (Line): The first line.
|
|
183
|
+
b (Line): The second line.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
bool: Whether the lines intersect.
|
|
187
|
+
"""
|
|
188
|
+
@typing.overload
|
|
189
|
+
def overlap(line: pykraken._core.Line, rect: pykraken._core.Rect) -> bool:
|
|
190
|
+
"""
|
|
191
|
+
Checks if a line and a rectangle overlap.
|
|
192
|
+
|
|
193
|
+
Parameters:
|
|
194
|
+
line (Line): The line.
|
|
195
|
+
rect (Rect): The rectangle.
|
|
196
|
+
|
|
197
|
+
Returns:
|
|
198
|
+
bool: Whether the line and rectangle overlap.
|
|
199
|
+
"""
|
|
200
|
+
@typing.overload
|
|
201
|
+
def overlap(line: pykraken._core.Line, circle: pykraken._core.Circle) -> bool:
|
|
202
|
+
"""
|
|
203
|
+
Checks if a line and a circle overlap.
|
|
204
|
+
|
|
205
|
+
Parameters:
|
|
206
|
+
line (Line): The line.
|
|
207
|
+
circle (Circle): The circle.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
bool: Whether the line and circle overlap.
|
|
211
|
+
"""
|
|
212
|
+
@typing.overload
|
|
213
|
+
def overlap(point: pykraken._core.Vec2, rect: pykraken._core.Rect) -> bool:
|
|
214
|
+
"""
|
|
215
|
+
Checks if a point is inside a rectangle.
|
|
216
|
+
|
|
217
|
+
Parameters:
|
|
218
|
+
point (Vec2): The point.
|
|
219
|
+
rect (Rect): The rectangle.
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
bool: Whether the point is inside the rectangle.
|
|
223
|
+
"""
|
|
224
|
+
@typing.overload
|
|
225
|
+
def overlap(point: pykraken._core.Vec2, circle: pykraken._core.Circle) -> bool:
|
|
226
|
+
"""
|
|
227
|
+
Checks if a point is inside a circle.
|
|
228
|
+
|
|
229
|
+
Parameters:
|
|
230
|
+
point (Vec2): The point.
|
|
231
|
+
circle (Circle): The circle.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
bool: Whether the point is inside the circle.
|
|
235
|
+
"""
|
|
236
|
+
@typing.overload
|
|
237
|
+
def overlap(polygon: pykraken._core.Polygon, point: pykraken._core.Vec2) -> bool:
|
|
238
|
+
"""
|
|
239
|
+
Checks if a polygon contains a point.
|
|
240
|
+
|
|
241
|
+
Parameters:
|
|
242
|
+
polygon (Polygon): The polygon.
|
|
243
|
+
point (Vec2): The point.
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
bool: Whether the polygon contains the point.
|
|
247
|
+
"""
|
|
248
|
+
@typing.overload
|
|
249
|
+
def overlap(point: pykraken._core.Vec2, polygon: pykraken._core.Polygon) -> bool:
|
|
250
|
+
"""
|
|
251
|
+
Checks if a point is inside a polygon.
|
|
252
|
+
|
|
253
|
+
Parameters:
|
|
254
|
+
point (Vec2): The point.
|
|
255
|
+
polygon (Polygon): The polygon.
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
bool: Whether the point is inside the polygon.
|
|
259
|
+
"""
|
|
260
|
+
@typing.overload
|
|
261
|
+
def overlap(polygon: pykraken._core.Polygon, rect: pykraken._core.Rect) -> bool:
|
|
262
|
+
"""
|
|
263
|
+
Checks if a polygon and a rectangle overlap.
|
|
264
|
+
|
|
265
|
+
Parameters:
|
|
266
|
+
polygon (Polygon): The polygon.
|
|
267
|
+
rect (Rect): The rectangle.
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
bool: Whether the polygon and rectangle overlap.
|
|
271
|
+
"""
|
|
272
|
+
@typing.overload
|
|
273
|
+
def overlap(rect: pykraken._core.Rect, polygon: pykraken._core.Polygon) -> bool:
|
|
274
|
+
"""
|
|
275
|
+
Checks if a rectangle and a polygon overlap.
|
|
276
|
+
|
|
277
|
+
Parameters:
|
|
278
|
+
rect (Rect): The rectangle.
|
|
279
|
+
polygon (Polygon): The polygon.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
bool: Whether the rectangle and polygon overlap.
|
|
283
|
+
"""
|
pykraken/_core/color.pyi
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
Color utility functions and predefined color constants.
|
|
4
|
+
|
|
5
|
+
This module provides functions for color manipulation and conversion,
|
|
6
|
+
as well as commonly used color constants for convenience.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
import pykraken._core
|
|
11
|
+
import typing
|
|
12
|
+
__all__: list[str] = ['BLACK', 'BLUE', 'BROWN', 'CYAN', 'DARK_GRAY', 'DARK_GREY', 'GRAY', 'GREEN', 'GREY', 'LIGHT_GRAY', 'LIGHT_GREY', 'MAGENTA', 'MAROON', 'NAVY', 'OLIVE', 'ORANGE', 'PINK', 'PURPLE', 'RED', 'TEAL', 'WHITE', 'YELLOW', 'from_hex', 'from_hsv', 'grayscale', 'invert', 'lerp']
|
|
13
|
+
def from_hex(hex: str) -> pykraken._core.Color:
|
|
14
|
+
"""
|
|
15
|
+
Create a Color from a hex string.
|
|
16
|
+
|
|
17
|
+
Supports multiple hex formats:
|
|
18
|
+
- "#RRGGBB" - 6-digit hex with full opacity
|
|
19
|
+
- "#RRGGBBAA" - 8-digit hex with alpha
|
|
20
|
+
- "#RGB" - 3-digit hex (each digit duplicated)
|
|
21
|
+
- "#RGBA" - 4-digit hex with alpha (each digit duplicated)
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
hex (str): Hex color string (with or without '#' prefix).
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
Color: New Color object from the hex string.
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
from_hex("#FF00FF") # Magenta, full opacity
|
|
31
|
+
from_hex("#FF00FF80") # Magenta, 50% opacity
|
|
32
|
+
from_hex("#F0F") # Same as "#FF00FF"
|
|
33
|
+
from_hex("RGB") # Without '#' prefix
|
|
34
|
+
"""
|
|
35
|
+
def from_hsv(h: typing.SupportsFloat, s: typing.SupportsFloat, v: typing.SupportsFloat, a: typing.SupportsFloat = 1.0) -> pykraken._core.Color:
|
|
36
|
+
"""
|
|
37
|
+
Create a Color from HSV(A) values.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
h (float): Hue angle (0-360).
|
|
41
|
+
s (float): Saturation (0-1).
|
|
42
|
+
v (float): Value/brightness (0-1).
|
|
43
|
+
a (float, optional): Alpha (0-1). Defaults to 1.0.
|
|
44
|
+
"""
|
|
45
|
+
def grayscale(color: pykraken._core.Color) -> pykraken._core.Color:
|
|
46
|
+
"""
|
|
47
|
+
Convert a color to grayscale.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
color (Color): The color to convert.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Color: New Color object representing the grayscale version.
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
grayscale(Color(255, 0, 0)) # Returns Color(76, 76, 76, 255)
|
|
57
|
+
"""
|
|
58
|
+
def invert(color: pykraken._core.Color) -> pykraken._core.Color:
|
|
59
|
+
"""
|
|
60
|
+
Return the inverse of a color by flipping RGB channels.
|
|
61
|
+
|
|
62
|
+
The alpha channel is preserved unchanged.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
color (Color): The color to invert.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
Color: New Color with inverted RGB values (255 - original value).
|
|
69
|
+
|
|
70
|
+
Example:
|
|
71
|
+
invert(Color(255, 0, 128, 200)) # Returns Color(0, 255, 127, 200)
|
|
72
|
+
"""
|
|
73
|
+
def lerp(a: pykraken._core.Color, b: pykraken._core.Color, t: typing.SupportsFloat) -> pykraken._core.Color:
|
|
74
|
+
"""
|
|
75
|
+
Linearly interpolate between two colors.
|
|
76
|
+
|
|
77
|
+
Performs component-wise linear interpolation between start and end colors.
|
|
78
|
+
All RGBA channels are interpolated independently.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
a (Color): Start color (when t=0.0).
|
|
82
|
+
b (Color): End color (when t=1.0).
|
|
83
|
+
t (float): Blend factor. Values outside [0,1] will extrapolate.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Color: New interpolated color.
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
lerp(Color.RED, Color.BLUE, 0.5) # Purple (halfway between red and blue)
|
|
90
|
+
lerp(Color.BLACK, Color.WHITE, 0.25) # Dark gray
|
|
91
|
+
"""
|
|
92
|
+
BLACK: pykraken._core.Color # value = Color(0, 0, 0, 255)
|
|
93
|
+
BLUE: pykraken._core.Color # value = Color(0, 0, 255, 255)
|
|
94
|
+
BROWN: pykraken._core.Color # value = Color(139, 69, 19, 255)
|
|
95
|
+
CYAN: pykraken._core.Color # value = Color(0, 255, 255, 255)
|
|
96
|
+
DARK_GRAY: pykraken._core.Color # value = Color(64, 64, 64, 255)
|
|
97
|
+
DARK_GREY: pykraken._core.Color # value = Color(64, 64, 64, 255)
|
|
98
|
+
GRAY: pykraken._core.Color # value = Color(128, 128, 128, 255)
|
|
99
|
+
GREEN: pykraken._core.Color # value = Color(0, 255, 0, 255)
|
|
100
|
+
GREY: pykraken._core.Color # value = Color(128, 128, 128, 255)
|
|
101
|
+
LIGHT_GRAY: pykraken._core.Color # value = Color(192, 192, 192, 255)
|
|
102
|
+
LIGHT_GREY: pykraken._core.Color # value = Color(192, 192, 192, 255)
|
|
103
|
+
MAGENTA: pykraken._core.Color # value = Color(255, 0, 255, 255)
|
|
104
|
+
MAROON: pykraken._core.Color # value = Color(128, 0, 0, 255)
|
|
105
|
+
NAVY: pykraken._core.Color # value = Color(0, 0, 128, 255)
|
|
106
|
+
OLIVE: pykraken._core.Color # value = Color(128, 128, 0, 255)
|
|
107
|
+
ORANGE: pykraken._core.Color # value = Color(255, 165, 0, 255)
|
|
108
|
+
PINK: pykraken._core.Color # value = Color(255, 192, 203, 255)
|
|
109
|
+
PURPLE: pykraken._core.Color # value = Color(128, 0, 128, 255)
|
|
110
|
+
RED: pykraken._core.Color # value = Color(255, 0, 0, 255)
|
|
111
|
+
TEAL: pykraken._core.Color # value = Color(0, 128, 128, 255)
|
|
112
|
+
WHITE: pykraken._core.Color # value = Color(255, 255, 255, 255)
|
|
113
|
+
YELLOW: pykraken._core.Color # value = Color(255, 255, 0, 255)
|
pykraken/_core/draw.pyi
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Functions for drawing shape objects
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
import collections.abc
|
|
6
|
+
import numpy
|
|
7
|
+
import numpy.typing
|
|
8
|
+
import pykraken._core
|
|
9
|
+
import typing
|
|
10
|
+
__all__: list[str] = ['circle', 'line', 'point', 'points', 'points_from_ndarray', 'polygon', 'rect', 'rects']
|
|
11
|
+
def circle(circle: pykraken._core.Circle, color: pykraken._core.Color, thickness: typing.SupportsInt = 0) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Draw a circle to the renderer.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
circle (Circle): The circle to draw.
|
|
17
|
+
color (Color): The color of the circle.
|
|
18
|
+
thickness (int, optional): The line thickness. If 0 or >= radius, draws filled circle.
|
|
19
|
+
Defaults to 0 (filled).
|
|
20
|
+
"""
|
|
21
|
+
def line(line: pykraken._core.Line, color: pykraken._core.Color, thickness: typing.SupportsInt = 1) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Draw a line to the renderer.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
line (Line): The line to draw.
|
|
27
|
+
color (Color): The color of the line.
|
|
28
|
+
thickness (int, optional): The line thickness in pixels. Defaults to 1.
|
|
29
|
+
"""
|
|
30
|
+
def point(point: pykraken._core.Vec2, color: pykraken._core.Color) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Draw a single point to the renderer.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
point (Vec2): The position of the point.
|
|
36
|
+
color (Color): The color of the point.
|
|
37
|
+
|
|
38
|
+
Raises:
|
|
39
|
+
RuntimeError: If point rendering fails.
|
|
40
|
+
"""
|
|
41
|
+
def points(points: collections.abc.Sequence[pykraken._core.Vec2], color: pykraken._core.Color) -> None:
|
|
42
|
+
"""
|
|
43
|
+
Batch draw an array of points to the renderer.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
points (Sequence[Vec2]): The points to batch draw.
|
|
47
|
+
color (Color): The color of the points.
|
|
48
|
+
|
|
49
|
+
Raises:
|
|
50
|
+
RuntimeError: If point rendering fails.
|
|
51
|
+
"""
|
|
52
|
+
def points_from_ndarray(points: typing.Annotated[numpy.typing.ArrayLike, numpy.float64], color: pykraken._core.Color) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Batch draw points from a NumPy array.
|
|
55
|
+
|
|
56
|
+
This fast path accepts a contiguous NumPy array of shape (N,2) (dtype float64) and
|
|
57
|
+
reads coordinates directly with minimal overhead. Use this to measure the best-case
|
|
58
|
+
zero-copy/buffer-backed path.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
points (numpy.ndarray): Array with shape (N,2) containing x,y coordinates.
|
|
62
|
+
color (Color): The color of the points.
|
|
63
|
+
|
|
64
|
+
Raises:
|
|
65
|
+
ValueError: If the array shape is not (N,2).
|
|
66
|
+
RuntimeError: If point rendering fails.
|
|
67
|
+
"""
|
|
68
|
+
def polygon(polygon: pykraken._core.Polygon, color: pykraken._core.Color, filled: bool = False) -> None:
|
|
69
|
+
"""
|
|
70
|
+
Draw a polygon to the renderer.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
polygon (Polygon): The polygon to draw.
|
|
74
|
+
color (Color): The color of the polygon.
|
|
75
|
+
filled (bool, optional): Whether to draw a filled polygon or just the outline.
|
|
76
|
+
Defaults to False (outline). Works with both convex and concave polygons.
|
|
77
|
+
"""
|
|
78
|
+
def rect(rect: pykraken._core.Rect, color: pykraken._core.Color, thickness: typing.SupportsInt = 0) -> None:
|
|
79
|
+
"""
|
|
80
|
+
Draw a rectangle to the renderer.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
rect (Rect): The rectangle to draw.
|
|
84
|
+
color (Color): The color of the rectangle.
|
|
85
|
+
thickness (int, optional): The border thickness. If 0 or >= half width/height, draws filled rectangle. Defaults to 0 (filled).
|
|
86
|
+
"""
|
|
87
|
+
def rects(rects: collections.abc.Sequence[pykraken._core.Rect], color: pykraken._core.Color, thickness: typing.SupportsInt = 0) -> None:
|
|
88
|
+
"""
|
|
89
|
+
Batch draw an array of rectangles to the renderer.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
rects (Sequence[Rect]): The rectangles to batch draw.
|
|
93
|
+
color (Color): The color of the rectangles.
|
|
94
|
+
thickness (int, optional): The border thickness of the rectangles. If 0 or >= half width/height, draws filled rectangles. Defaults to 0 (filled).
|
|
95
|
+
"""
|