sonolus.py 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.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 sonolus.py might be problematic. Click here for more details.
- sonolus/backend/finalize.py +18 -10
- sonolus/backend/interpret.py +7 -7
- sonolus/backend/ir.py +24 -0
- sonolus/backend/optimize/__init__.py +0 -0
- sonolus/backend/{allocate.py → optimize/allocate.py} +4 -3
- sonolus/backend/{constant_evaluation.py → optimize/constant_evaluation.py} +7 -7
- sonolus/backend/{coalesce.py → optimize/copy_coalesce.py} +3 -3
- sonolus/backend/optimize/dead_code.py +185 -0
- sonolus/backend/{dominance.py → optimize/dominance.py} +2 -17
- sonolus/backend/{flow.py → optimize/flow.py} +6 -5
- sonolus/backend/{inlining.py → optimize/inlining.py} +4 -17
- sonolus/backend/{liveness.py → optimize/liveness.py} +69 -65
- sonolus/backend/optimize/optimize.py +44 -0
- sonolus/backend/{passes.py → optimize/passes.py} +1 -1
- sonolus/backend/optimize/simplify.py +191 -0
- sonolus/backend/{ssa.py → optimize/ssa.py} +31 -18
- sonolus/backend/place.py +17 -25
- sonolus/backend/utils.py +10 -0
- sonolus/backend/visitor.py +360 -101
- sonolus/build/cli.py +14 -3
- sonolus/build/compile.py +8 -8
- sonolus/build/engine.py +10 -5
- sonolus/build/project.py +30 -1
- sonolus/script/archetype.py +429 -138
- sonolus/script/array.py +25 -8
- sonolus/script/array_like.py +297 -0
- sonolus/script/bucket.py +73 -11
- sonolus/script/containers.py +234 -51
- sonolus/script/debug.py +8 -8
- sonolus/script/easing.py +147 -105
- sonolus/script/effect.py +60 -0
- sonolus/script/engine.py +71 -4
- sonolus/script/globals.py +66 -32
- sonolus/script/instruction.py +79 -25
- sonolus/script/internal/builtin_impls.py +138 -27
- sonolus/script/internal/constant.py +139 -0
- sonolus/script/internal/context.py +14 -5
- sonolus/script/internal/dict_impl.py +65 -0
- sonolus/script/internal/generic.py +6 -9
- sonolus/script/internal/impl.py +38 -13
- sonolus/script/internal/introspection.py +5 -2
- sonolus/script/{math.py → internal/math_impls.py} +28 -28
- sonolus/script/internal/native.py +3 -3
- sonolus/script/internal/random.py +67 -0
- sonolus/script/internal/range.py +81 -0
- sonolus/script/internal/transient.py +51 -0
- sonolus/script/internal/tuple_impl.py +113 -0
- sonolus/script/interval.py +234 -16
- sonolus/script/iterator.py +120 -167
- sonolus/script/level.py +24 -0
- sonolus/script/num.py +79 -47
- sonolus/script/options.py +78 -12
- sonolus/script/particle.py +37 -4
- sonolus/script/pointer.py +4 -4
- sonolus/script/print.py +22 -1
- sonolus/script/project.py +59 -0
- sonolus/script/{graphics.py → quad.py} +75 -12
- sonolus/script/record.py +44 -13
- sonolus/script/runtime.py +50 -1
- sonolus/script/sprite.py +198 -115
- sonolus/script/text.py +2 -0
- sonolus/script/timing.py +72 -0
- sonolus/script/transform.py +296 -66
- sonolus/script/ui.py +134 -78
- sonolus/script/values.py +6 -13
- sonolus/script/vec.py +118 -3
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.6.dist-info}/METADATA +1 -1
- sonolus_py-0.1.6.dist-info/RECORD +89 -0
- sonolus/backend/dead_code.py +0 -80
- sonolus/backend/optimize.py +0 -37
- sonolus/backend/simplify.py +0 -47
- sonolus/script/comptime.py +0 -160
- sonolus/script/random.py +0 -14
- sonolus/script/range.py +0 -58
- sonolus_py-0.1.4.dist-info/RECORD +0 -84
- /sonolus/script/{callbacks.py → internal/callbacks.py} +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.6.dist-info}/WHEEL +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.6.dist-info}/entry_points.txt +0 -0
- {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.6.dist-info}/licenses/LICENSE +0 -0
sonolus/script/sprite.py
CHANGED
|
@@ -2,39 +2,111 @@ from dataclasses import dataclass
|
|
|
2
2
|
from typing import Annotated, Any, NewType, dataclass_transform, get_origin
|
|
3
3
|
|
|
4
4
|
from sonolus.backend.ops import Op
|
|
5
|
-
from sonolus.script.graphics import QuadLike, flatten_quad
|
|
6
5
|
from sonolus.script.internal.introspection import get_field_specifiers
|
|
7
6
|
from sonolus.script.internal.native import native_function
|
|
7
|
+
from sonolus.script.quad import QuadLike, flatten_quad
|
|
8
8
|
from sonolus.script.record import Record
|
|
9
9
|
from sonolus.script.vec import Vec2
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Sprite(Record):
|
|
13
|
+
"""Skin sprite.
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
```python
|
|
17
|
+
Sprite(id: int)
|
|
18
|
+
```
|
|
19
|
+
"""
|
|
20
|
+
|
|
13
21
|
id: int
|
|
14
22
|
|
|
15
23
|
@property
|
|
16
24
|
def is_available(self) -> bool:
|
|
25
|
+
"""Check if the sprite is available."""
|
|
17
26
|
return _has_skin_sprite(self.id)
|
|
18
27
|
|
|
19
28
|
def draw(self, quad: QuadLike, z: float = 0.0, a: float = 1.0):
|
|
29
|
+
"""Draw the sprite.
|
|
30
|
+
|
|
31
|
+
Arguments:
|
|
32
|
+
quad: The quad to draw the sprite on.
|
|
33
|
+
z: The z-index of the sprite.
|
|
34
|
+
a: The alpha of the sprite.
|
|
35
|
+
"""
|
|
20
36
|
_draw(self.id, *flatten_quad(quad), z, a)
|
|
21
37
|
|
|
22
38
|
def draw_curved_b(self, quad: QuadLike, cp: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
39
|
+
"""Draw the sprite with a curved bottom with a quadratic Bézier curve.
|
|
40
|
+
|
|
41
|
+
Arguments:
|
|
42
|
+
quad: The quad to draw the sprite on.
|
|
43
|
+
cp: The control point of the curve.
|
|
44
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
45
|
+
z: The z-index of the sprite.
|
|
46
|
+
a: The alpha of the sprite.
|
|
47
|
+
"""
|
|
23
48
|
_draw_curved_b(self.id, *flatten_quad(quad), z, a, n, *cp.tuple)
|
|
24
49
|
|
|
25
50
|
def draw_curved_t(self, quad: QuadLike, cp: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
51
|
+
"""Draw the sprite with a curved top with a quadratic Bézier curve.
|
|
52
|
+
|
|
53
|
+
Arguments:
|
|
54
|
+
quad: The quad to draw the sprite on.
|
|
55
|
+
cp: The control point of the curve.
|
|
56
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
57
|
+
z: The z-index of the sprite.
|
|
58
|
+
a: The alpha of the sprite.
|
|
59
|
+
"""
|
|
26
60
|
_draw_curved_t(self.id, *flatten_quad(quad), z, a, n, *cp.tuple)
|
|
27
61
|
|
|
28
62
|
def draw_curved_l(self, quad: QuadLike, cp: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
63
|
+
"""Draw the sprite with a curved left side with a quadratic Bézier curve.
|
|
64
|
+
|
|
65
|
+
Arguments:
|
|
66
|
+
quad: The quad to draw the sprite on.
|
|
67
|
+
cp: The control point of the curve.
|
|
68
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
69
|
+
z: The z-index of the sprite.
|
|
70
|
+
a: The alpha of the sprite.
|
|
71
|
+
"""
|
|
29
72
|
_draw_curved_l(self.id, *flatten_quad(quad), z, a, n, *cp.tuple)
|
|
30
73
|
|
|
31
74
|
def draw_curved_r(self, quad: QuadLike, cp: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
75
|
+
"""Draw the sprite with a curved right side with a quadratic Bézier curve.
|
|
76
|
+
|
|
77
|
+
Arguments:
|
|
78
|
+
quad: The quad to draw the sprite on.
|
|
79
|
+
cp: The control point of the curve.
|
|
80
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
81
|
+
z: The z-index of the sprite.
|
|
82
|
+
a: The alpha of the sprite.
|
|
83
|
+
"""
|
|
32
84
|
_draw_curved_r(self.id, *flatten_quad(quad), z, a, n, *cp.tuple)
|
|
33
85
|
|
|
34
86
|
def draw_curved_bt(self, quad: QuadLike, cp1: Vec2, cp2: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
87
|
+
"""Draw the sprite with a curved bottom and top with a cubic Bézier curve.
|
|
88
|
+
|
|
89
|
+
Arguments:
|
|
90
|
+
quad: The quad to draw the sprite on.
|
|
91
|
+
cp1: The control point of the bottom curve.
|
|
92
|
+
cp2: The control point of the top curve.
|
|
93
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
94
|
+
z: The z-index of the sprite.
|
|
95
|
+
a: The alpha of the sprite.
|
|
96
|
+
"""
|
|
35
97
|
_draw_curved_bt(self.id, *flatten_quad(quad), z, a, n, *cp1.tuple, *cp2.tuple)
|
|
36
98
|
|
|
37
99
|
def draw_curved_lr(self, quad: QuadLike, cp1: Vec2, cp2: Vec2, n: float, z: float = 0.0, a: float = 1.0):
|
|
100
|
+
"""Draw the sprite with a curved left and right side with a cubic Bézier curve.
|
|
101
|
+
|
|
102
|
+
Arguments:
|
|
103
|
+
quad: The quad to draw the sprite on.
|
|
104
|
+
cp1: The control point of the left curve.
|
|
105
|
+
cp2: The control point of the right curve.
|
|
106
|
+
n: The number of segments to approximate the curve (higher is smoother but more expensive).
|
|
107
|
+
z: The z-index of the sprite.
|
|
108
|
+
a: The alpha of the sprite.
|
|
109
|
+
"""
|
|
38
110
|
_draw_curved_lr(self.id, *flatten_quad(quad), z, a, n, *cp1.tuple, *cp2.tuple)
|
|
39
111
|
|
|
40
112
|
|
|
@@ -56,7 +128,7 @@ def _draw(
|
|
|
56
128
|
y4: float,
|
|
57
129
|
z: float,
|
|
58
130
|
a: float,
|
|
59
|
-
):
|
|
131
|
+
) -> None:
|
|
60
132
|
raise NotImplementedError
|
|
61
133
|
|
|
62
134
|
|
|
@@ -76,7 +148,7 @@ def _draw_curved_b(
|
|
|
76
148
|
n: int,
|
|
77
149
|
p: float,
|
|
78
150
|
q: float,
|
|
79
|
-
):
|
|
151
|
+
) -> None:
|
|
80
152
|
raise NotImplementedError
|
|
81
153
|
|
|
82
154
|
|
|
@@ -96,7 +168,7 @@ def _draw_curved_t(
|
|
|
96
168
|
n: int,
|
|
97
169
|
p: float,
|
|
98
170
|
q: float,
|
|
99
|
-
):
|
|
171
|
+
) -> None:
|
|
100
172
|
raise NotImplementedError
|
|
101
173
|
|
|
102
174
|
|
|
@@ -116,7 +188,7 @@ def _draw_curved_l(
|
|
|
116
188
|
n: int,
|
|
117
189
|
p: float,
|
|
118
190
|
q: float,
|
|
119
|
-
):
|
|
191
|
+
) -> None:
|
|
120
192
|
raise NotImplementedError
|
|
121
193
|
|
|
122
194
|
|
|
@@ -136,7 +208,7 @@ def _draw_curved_r(
|
|
|
136
208
|
n: int,
|
|
137
209
|
p: float,
|
|
138
210
|
q: float,
|
|
139
|
-
):
|
|
211
|
+
) -> None:
|
|
140
212
|
raise NotImplementedError
|
|
141
213
|
|
|
142
214
|
|
|
@@ -158,7 +230,7 @@ def _draw_curved_bt(
|
|
|
158
230
|
q1: float,
|
|
159
231
|
p2: float,
|
|
160
232
|
q2: float,
|
|
161
|
-
):
|
|
233
|
+
) -> None:
|
|
162
234
|
raise NotImplementedError
|
|
163
235
|
|
|
164
236
|
|
|
@@ -180,7 +252,7 @@ def _draw_curved_lr(
|
|
|
180
252
|
q1: float,
|
|
181
253
|
p2: float,
|
|
182
254
|
q2: float,
|
|
183
|
-
):
|
|
255
|
+
) -> None:
|
|
184
256
|
raise NotImplementedError
|
|
185
257
|
|
|
186
258
|
|
|
@@ -189,7 +261,8 @@ class SkinSprite:
|
|
|
189
261
|
name: str
|
|
190
262
|
|
|
191
263
|
|
|
192
|
-
def
|
|
264
|
+
def sprite(name: str) -> Any:
|
|
265
|
+
"""Define a sprite with the given name."""
|
|
193
266
|
return SkinSprite(name)
|
|
194
267
|
|
|
195
268
|
|
|
@@ -198,6 +271,16 @@ type Skin = NewType("Skin", Any)
|
|
|
198
271
|
|
|
199
272
|
@dataclass_transform()
|
|
200
273
|
def skin[T](cls: type[T]) -> T | Skin:
|
|
274
|
+
"""Decorator to define a skin.
|
|
275
|
+
|
|
276
|
+
Usage:
|
|
277
|
+
```python
|
|
278
|
+
@skin
|
|
279
|
+
class Skin:
|
|
280
|
+
note: StandardSprite.NOTE_HEAD_RED
|
|
281
|
+
other: Sprite = skin_sprite("other")
|
|
282
|
+
```
|
|
283
|
+
"""
|
|
201
284
|
if len(cls.__bases__) != 1:
|
|
202
285
|
raise ValueError("Skin class must not inherit from any class (except object)")
|
|
203
286
|
instance = cls()
|
|
@@ -220,112 +303,112 @@ def skin[T](cls: type[T]) -> T | Skin:
|
|
|
220
303
|
|
|
221
304
|
|
|
222
305
|
class StandardSprite:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
]
|
|
274
|
-
SIMULTANEOUS_CONNECTION_RED_SEAMLESS = Annotated[Sprite,
|
|
275
|
-
SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite,
|
|
276
|
-
SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite,
|
|
277
|
-
SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite,
|
|
278
|
-
SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite,
|
|
279
|
-
SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite,
|
|
280
|
-
|
|
281
|
-
DIRECTIONAL_MARKER_NEUTRAL = Annotated[Sprite,
|
|
282
|
-
DIRECTIONAL_MARKER_RED = Annotated[Sprite,
|
|
283
|
-
DIRECTIONAL_MARKER_GREEN = Annotated[Sprite,
|
|
284
|
-
DIRECTIONAL_MARKER_BLUE = Annotated[Sprite,
|
|
285
|
-
DIRECTIONAL_MARKER_YELLOW = Annotated[Sprite,
|
|
286
|
-
DIRECTIONAL_MARKER_PURPLE = Annotated[Sprite,
|
|
287
|
-
DIRECTIONAL_MARKER_CYAN = Annotated[Sprite,
|
|
288
|
-
|
|
289
|
-
SIMULTANEOUS_MARKER_NEUTRAL = Annotated[Sprite,
|
|
290
|
-
SIMULTANEOUS_MARKER_RED = Annotated[Sprite,
|
|
291
|
-
SIMULTANEOUS_MARKER_GREEN = Annotated[Sprite,
|
|
292
|
-
SIMULTANEOUS_MARKER_BLUE = Annotated[Sprite,
|
|
293
|
-
SIMULTANEOUS_MARKER_YELLOW = Annotated[Sprite,
|
|
294
|
-
SIMULTANEOUS_MARKER_PURPLE = Annotated[Sprite,
|
|
295
|
-
SIMULTANEOUS_MARKER_CYAN = Annotated[Sprite,
|
|
296
|
-
|
|
297
|
-
STAGE_MIDDLE = Annotated[Sprite,
|
|
298
|
-
STAGE_LEFT_BORDER = Annotated[Sprite,
|
|
299
|
-
STAGE_RIGHT_BORDER = Annotated[Sprite,
|
|
300
|
-
STAGE_TOP_BORDER = Annotated[Sprite,
|
|
301
|
-
STAGE_BOTTOM_BORDER = Annotated[Sprite,
|
|
302
|
-
|
|
303
|
-
STAGE_LEFT_BORDER_SEAMLESS = Annotated[Sprite,
|
|
304
|
-
STAGE_RIGHT_BORDER_SEAMLESS = Annotated[Sprite,
|
|
305
|
-
STAGE_TOP_BORDER_SEAMLESS = Annotated[Sprite,
|
|
306
|
-
STAGE_BOTTOM_BORDER_SEAMLESS = Annotated[Sprite,
|
|
307
|
-
|
|
308
|
-
STAGE_TOP_LEFT_CORNER = Annotated[Sprite,
|
|
309
|
-
STAGE_TOP_RIGHT_CORNER = Annotated[Sprite,
|
|
310
|
-
STAGE_BOTTOM_LEFT_CORNER = Annotated[Sprite,
|
|
311
|
-
STAGE_BOTTOM_RIGHT_CORNER = Annotated[Sprite,
|
|
312
|
-
|
|
313
|
-
LANE = Annotated[Sprite,
|
|
314
|
-
LANE_SEAMLESS = Annotated[Sprite,
|
|
315
|
-
LANE_ALTERNATIVE = Annotated[Sprite,
|
|
316
|
-
LANE_ALTERNATIVE_SEAMLESS = Annotated[Sprite,
|
|
317
|
-
|
|
318
|
-
JUDGMENT_LINE = Annotated[Sprite,
|
|
319
|
-
NOTE_SLOT = Annotated[Sprite,
|
|
320
|
-
STAGE_COVER = Annotated[Sprite,
|
|
321
|
-
|
|
322
|
-
GRID_NEUTRAL = Annotated[Sprite,
|
|
323
|
-
GRID_RED = Annotated[Sprite,
|
|
324
|
-
GRID_GREEN = Annotated[Sprite,
|
|
325
|
-
GRID_BLUE = Annotated[Sprite,
|
|
326
|
-
GRID_YELLOW = Annotated[Sprite,
|
|
327
|
-
GRID_PURPLE = Annotated[Sprite,
|
|
328
|
-
GRID_CYAN = Annotated[Sprite,
|
|
306
|
+
"""Standard skin sprites."""
|
|
307
|
+
|
|
308
|
+
NOTE_HEAD_NEUTRAL = Annotated[Sprite, sprite("#NOTE_HEAD_NEUTRAL")]
|
|
309
|
+
NOTE_HEAD_RED = Annotated[Sprite, sprite("#NOTE_HEAD_RED")]
|
|
310
|
+
NOTE_HEAD_GREEN = Annotated[Sprite, sprite("#NOTE_HEAD_GREEN")]
|
|
311
|
+
NOTE_HEAD_BLUE = Annotated[Sprite, sprite("#NOTE_HEAD_BLUE")]
|
|
312
|
+
NOTE_HEAD_YELLOW = Annotated[Sprite, sprite("#NOTE_HEAD_YELLOW")]
|
|
313
|
+
NOTE_HEAD_PURPLE = Annotated[Sprite, sprite("#NOTE_HEAD_PURPLE")]
|
|
314
|
+
NOTE_HEAD_CYAN = Annotated[Sprite, sprite("#NOTE_HEAD_CYAN")]
|
|
315
|
+
|
|
316
|
+
NOTE_TICK_NEUTRAL = Annotated[Sprite, sprite("#NOTE_TICK_NEUTRAL")]
|
|
317
|
+
NOTE_TICK_RED = Annotated[Sprite, sprite("#NOTE_TICK_RED")]
|
|
318
|
+
NOTE_TICK_GREEN = Annotated[Sprite, sprite("#NOTE_TICK_GREEN")]
|
|
319
|
+
NOTE_TICK_BLUE = Annotated[Sprite, sprite("#NOTE_TICK_BLUE")]
|
|
320
|
+
NOTE_TICK_YELLOW = Annotated[Sprite, sprite("#NOTE_TICK_YELLOW")]
|
|
321
|
+
NOTE_TICK_PURPLE = Annotated[Sprite, sprite("#NOTE_TICK_PURPLE")]
|
|
322
|
+
NOTE_TICK_CYAN = Annotated[Sprite, sprite("#NOTE_TICK_CYAN")]
|
|
323
|
+
|
|
324
|
+
NOTE_TAIL_NEUTRAL = Annotated[Sprite, sprite("#NOTE_TAIL_NEUTRAL")]
|
|
325
|
+
NOTE_TAIL_RED = Annotated[Sprite, sprite("#NOTE_TAIL_RED")]
|
|
326
|
+
NOTE_TAIL_GREEN = Annotated[Sprite, sprite("#NOTE_TAIL_GREEN")]
|
|
327
|
+
NOTE_TAIL_BLUE = Annotated[Sprite, sprite("#NOTE_TAIL_BLUE")]
|
|
328
|
+
NOTE_TAIL_YELLOW = Annotated[Sprite, sprite("#NOTE_TAIL_YELLOW")]
|
|
329
|
+
NOTE_TAIL_PURPLE = Annotated[Sprite, sprite("#NOTE_TAIL_PURPLE")]
|
|
330
|
+
NOTE_TAIL_CYAN = Annotated[Sprite, sprite("#NOTE_TAIL_CYAN")]
|
|
331
|
+
|
|
332
|
+
NOTE_CONNECTION_NEUTRAL = Annotated[Sprite, sprite("#NOTE_CONNECTION_NEUTRAL")]
|
|
333
|
+
NOTE_CONNECTION_RED = Annotated[Sprite, sprite("#NOTE_CONNECTION_RED")]
|
|
334
|
+
NOTE_CONNECTION_GREEN = Annotated[Sprite, sprite("#NOTE_CONNECTION_GREEN")]
|
|
335
|
+
NOTE_CONNECTION_BLUE = Annotated[Sprite, sprite("#NOTE_CONNECTION_BLUE")]
|
|
336
|
+
NOTE_CONNECTION_YELLOW = Annotated[Sprite, sprite("#NOTE_CONNECTION_YELLOW")]
|
|
337
|
+
NOTE_CONNECTION_PURPLE = Annotated[Sprite, sprite("#NOTE_CONNECTION_PURPLE")]
|
|
338
|
+
NOTE_CONNECTION_CYAN = Annotated[Sprite, sprite("#NOTE_CONNECTION_CYAN")]
|
|
339
|
+
|
|
340
|
+
NOTE_CONNECTION_NEUTRAL_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_NEUTRAL_SEAMLESS")]
|
|
341
|
+
NOTE_CONNECTION_RED_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_RED_SEAMLESS")]
|
|
342
|
+
NOTE_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_GREEN_SEAMLESS")]
|
|
343
|
+
NOTE_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_BLUE_SEAMLESS")]
|
|
344
|
+
NOTE_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_YELLOW_SEAMLESS")]
|
|
345
|
+
NOTE_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_PURPLE_SEAMLESS")]
|
|
346
|
+
NOTE_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite, sprite("#NOTE_CONNECTION_CYAN_SEAMLESS")]
|
|
347
|
+
|
|
348
|
+
SIMULTANEOUS_CONNECTION_NEUTRAL = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_NEUTRAL")]
|
|
349
|
+
SIMULTANEOUS_CONNECTION_RED = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_RED")]
|
|
350
|
+
SIMULTANEOUS_CONNECTION_GREEN = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_GREEN")]
|
|
351
|
+
SIMULTANEOUS_CONNECTION_BLUE = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_BLUE")]
|
|
352
|
+
SIMULTANEOUS_CONNECTION_YELLOW = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_YELLOW")]
|
|
353
|
+
SIMULTANEOUS_CONNECTION_PURPLE = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_PURPLE")]
|
|
354
|
+
SIMULTANEOUS_CONNECTION_CYAN = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_CYAN")]
|
|
355
|
+
|
|
356
|
+
SIMULTANEOUS_CONNECTION_NEUTRAL_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_NEUTRAL_SEAMLESS")]
|
|
357
|
+
SIMULTANEOUS_CONNECTION_RED_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_RED_SEAMLESS")]
|
|
358
|
+
SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS")]
|
|
359
|
+
SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS")]
|
|
360
|
+
SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS")]
|
|
361
|
+
SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS")]
|
|
362
|
+
SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS")]
|
|
363
|
+
|
|
364
|
+
DIRECTIONAL_MARKER_NEUTRAL = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_NEUTRAL")]
|
|
365
|
+
DIRECTIONAL_MARKER_RED = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_RED")]
|
|
366
|
+
DIRECTIONAL_MARKER_GREEN = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_GREEN")]
|
|
367
|
+
DIRECTIONAL_MARKER_BLUE = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_BLUE")]
|
|
368
|
+
DIRECTIONAL_MARKER_YELLOW = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_YELLOW")]
|
|
369
|
+
DIRECTIONAL_MARKER_PURPLE = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_PURPLE")]
|
|
370
|
+
DIRECTIONAL_MARKER_CYAN = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_CYAN")]
|
|
371
|
+
|
|
372
|
+
SIMULTANEOUS_MARKER_NEUTRAL = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_NEUTRAL")]
|
|
373
|
+
SIMULTANEOUS_MARKER_RED = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_RED")]
|
|
374
|
+
SIMULTANEOUS_MARKER_GREEN = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_GREEN")]
|
|
375
|
+
SIMULTANEOUS_MARKER_BLUE = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_BLUE")]
|
|
376
|
+
SIMULTANEOUS_MARKER_YELLOW = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_YELLOW")]
|
|
377
|
+
SIMULTANEOUS_MARKER_PURPLE = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_PURPLE")]
|
|
378
|
+
SIMULTANEOUS_MARKER_CYAN = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_CYAN")]
|
|
379
|
+
|
|
380
|
+
STAGE_MIDDLE = Annotated[Sprite, sprite("#STAGE_MIDDLE")]
|
|
381
|
+
STAGE_LEFT_BORDER = Annotated[Sprite, sprite("#STAGE_LEFT_BORDER")]
|
|
382
|
+
STAGE_RIGHT_BORDER = Annotated[Sprite, sprite("#STAGE_RIGHT_BORDER")]
|
|
383
|
+
STAGE_TOP_BORDER = Annotated[Sprite, sprite("#STAGE_TOP_BORDER")]
|
|
384
|
+
STAGE_BOTTOM_BORDER = Annotated[Sprite, sprite("#STAGE_BOTTOM_BORDER")]
|
|
385
|
+
|
|
386
|
+
STAGE_LEFT_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_LEFT_BORDER_SEAMLESS")]
|
|
387
|
+
STAGE_RIGHT_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_RIGHT_BORDER_SEAMLESS")]
|
|
388
|
+
STAGE_TOP_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_TOP_BORDER_SEAMLESS")]
|
|
389
|
+
STAGE_BOTTOM_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_BOTTOM_BORDER_SEAMLESS")]
|
|
390
|
+
|
|
391
|
+
STAGE_TOP_LEFT_CORNER = Annotated[Sprite, sprite("#STAGE_TOP_LEFT_CORNER")]
|
|
392
|
+
STAGE_TOP_RIGHT_CORNER = Annotated[Sprite, sprite("#STAGE_TOP_RIGHT_CORNER")]
|
|
393
|
+
STAGE_BOTTOM_LEFT_CORNER = Annotated[Sprite, sprite("#STAGE_BOTTOM_LEFT_CORNER")]
|
|
394
|
+
STAGE_BOTTOM_RIGHT_CORNER = Annotated[Sprite, sprite("#STAGE_BOTTOM_RIGHT_CORNER")]
|
|
395
|
+
|
|
396
|
+
LANE = Annotated[Sprite, sprite("#LANE")]
|
|
397
|
+
LANE_SEAMLESS = Annotated[Sprite, sprite("#LANE_SEAMLESS")]
|
|
398
|
+
LANE_ALTERNATIVE = Annotated[Sprite, sprite("#LANE_ALTERNATIVE")]
|
|
399
|
+
LANE_ALTERNATIVE_SEAMLESS = Annotated[Sprite, sprite("#LANE_ALTERNATIVE_SEAMLESS")]
|
|
400
|
+
|
|
401
|
+
JUDGMENT_LINE = Annotated[Sprite, sprite("#JUDGMENT_LINE")]
|
|
402
|
+
NOTE_SLOT = Annotated[Sprite, sprite("#NOTE_SLOT")]
|
|
403
|
+
STAGE_COVER = Annotated[Sprite, sprite("#STAGE_COVER")]
|
|
404
|
+
|
|
405
|
+
GRID_NEUTRAL = Annotated[Sprite, sprite("#GRID_NEUTRAL")]
|
|
406
|
+
GRID_RED = Annotated[Sprite, sprite("#GRID_RED")]
|
|
407
|
+
GRID_GREEN = Annotated[Sprite, sprite("#GRID_GREEN")]
|
|
408
|
+
GRID_BLUE = Annotated[Sprite, sprite("#GRID_BLUE")]
|
|
409
|
+
GRID_YELLOW = Annotated[Sprite, sprite("#GRID_YELLOW")]
|
|
410
|
+
GRID_PURPLE = Annotated[Sprite, sprite("#GRID_PURPLE")]
|
|
411
|
+
GRID_CYAN = Annotated[Sprite, sprite("#GRID_CYAN")]
|
|
329
412
|
|
|
330
413
|
|
|
331
414
|
@skin
|
sonolus/script/text.py
CHANGED
sonolus/script/timing.py
CHANGED
|
@@ -4,39 +4,111 @@ from sonolus.script.internal.native import native_function
|
|
|
4
4
|
|
|
5
5
|
@native_function(Op.BeatToBPM)
|
|
6
6
|
def beat_to_bpm(beat: float) -> float:
|
|
7
|
+
"""Get the bpm at the given beat.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
beat: The beat to get the bpm at.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
The bpm at the given beat.
|
|
14
|
+
"""
|
|
7
15
|
raise NotImplementedError
|
|
8
16
|
|
|
9
17
|
|
|
10
18
|
@native_function(Op.BeatToTime)
|
|
11
19
|
def beat_to_time(beat: float) -> float:
|
|
20
|
+
"""Get the time at the given beat.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
beat: The beat to get the time at.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
The time at the given beat.
|
|
27
|
+
"""
|
|
12
28
|
raise NotImplementedError
|
|
13
29
|
|
|
14
30
|
|
|
15
31
|
@native_function(Op.BeatToStartingBeat)
|
|
16
32
|
def beat_to_starting_beat(beat: float) -> float:
|
|
33
|
+
"""Get the starting beat of the bpm section at the given beat.
|
|
34
|
+
|
|
35
|
+
I.e. the beat of the bpm change at or immediately before the given beat.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
beat: The beat to get the starting beat of the bpm section at.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
The starting beat of the bpm section at the given beat.
|
|
42
|
+
"""
|
|
17
43
|
raise NotImplementedError
|
|
18
44
|
|
|
19
45
|
|
|
20
46
|
@native_function(Op.BeatToStartingTime)
|
|
21
47
|
def beat_to_starting_time(beat: float) -> float:
|
|
48
|
+
"""Get the starting time of the bpm section at the given beat.
|
|
49
|
+
|
|
50
|
+
I.e. the time of the bpm change at or immediately before the given beat.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
beat: The beat to get the starting time of the bpm section at.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
The starting time of the bpm section at the given beat.
|
|
57
|
+
"""
|
|
22
58
|
raise NotImplementedError
|
|
23
59
|
|
|
24
60
|
|
|
25
61
|
@native_function(Op.TimeToScaledTime)
|
|
26
62
|
def time_to_scaled_time(time: float) -> float:
|
|
63
|
+
"""Get the scaled (timescale adjusted) time at the given time.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
time: The time to get the scaled time at.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
The scaled (timescale adjusted) time at the given time.
|
|
70
|
+
"""
|
|
27
71
|
raise NotImplementedError
|
|
28
72
|
|
|
29
73
|
|
|
30
74
|
@native_function(Op.TimeToStartingScaledTime)
|
|
31
75
|
def time_to_starting_scaled_time(time: float) -> float:
|
|
76
|
+
"""Get the starting scaled (timescale adjusted) time at the given time.
|
|
77
|
+
|
|
78
|
+
I.e. the scaled time of the timescale change at or immediately before the given time.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
time: The time to get the starting scaled time at.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
The starting scaled time at the given time.
|
|
85
|
+
"""
|
|
32
86
|
raise NotImplementedError
|
|
33
87
|
|
|
34
88
|
|
|
35
89
|
@native_function(Op.TimeToStartingTime)
|
|
36
90
|
def time_to_starting_time(time: float) -> float:
|
|
91
|
+
"""Get the starting time of the timescale section at the given time.
|
|
92
|
+
|
|
93
|
+
I.e. the time of the timescale change at or immediately before the given time.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
time: The time to get the starting time of the timescale section at.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
The starting time of the timescale section at the given time.
|
|
100
|
+
"""
|
|
37
101
|
raise NotImplementedError
|
|
38
102
|
|
|
39
103
|
|
|
40
104
|
@native_function(Op.TimeToTimeScale)
|
|
41
105
|
def time_to_timescale(time: float) -> float:
|
|
106
|
+
"""Get the timescale at the given time.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
time: The time to get the timescale at.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
The timescale at the given time.
|
|
113
|
+
"""
|
|
42
114
|
raise NotImplementedError
|