sonolus.py 0.1.4__py3-none-any.whl → 0.1.5__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.

Files changed (77) hide show
  1. sonolus/backend/finalize.py +18 -10
  2. sonolus/backend/interpret.py +7 -7
  3. sonolus/backend/ir.py +24 -0
  4. sonolus/backend/optimize/__init__.py +0 -0
  5. sonolus/backend/{allocate.py → optimize/allocate.py} +4 -3
  6. sonolus/backend/{constant_evaluation.py → optimize/constant_evaluation.py} +7 -7
  7. sonolus/backend/{coalesce.py → optimize/copy_coalesce.py} +3 -3
  8. sonolus/backend/optimize/dead_code.py +185 -0
  9. sonolus/backend/{dominance.py → optimize/dominance.py} +2 -17
  10. sonolus/backend/{flow.py → optimize/flow.py} +6 -5
  11. sonolus/backend/{inlining.py → optimize/inlining.py} +4 -17
  12. sonolus/backend/{liveness.py → optimize/liveness.py} +69 -65
  13. sonolus/backend/optimize/optimize.py +44 -0
  14. sonolus/backend/{passes.py → optimize/passes.py} +1 -1
  15. sonolus/backend/optimize/simplify.py +191 -0
  16. sonolus/backend/{ssa.py → optimize/ssa.py} +31 -18
  17. sonolus/backend/place.py +17 -25
  18. sonolus/backend/utils.py +10 -0
  19. sonolus/backend/visitor.py +360 -101
  20. sonolus/build/compile.py +8 -8
  21. sonolus/build/engine.py +10 -5
  22. sonolus/script/archetype.py +419 -137
  23. sonolus/script/array.py +25 -8
  24. sonolus/script/array_like.py +297 -0
  25. sonolus/script/bucket.py +73 -11
  26. sonolus/script/containers.py +234 -51
  27. sonolus/script/debug.py +8 -8
  28. sonolus/script/easing.py +147 -105
  29. sonolus/script/effect.py +60 -0
  30. sonolus/script/engine.py +71 -4
  31. sonolus/script/globals.py +66 -32
  32. sonolus/script/instruction.py +79 -25
  33. sonolus/script/internal/builtin_impls.py +138 -27
  34. sonolus/script/internal/constant.py +139 -0
  35. sonolus/script/internal/context.py +14 -5
  36. sonolus/script/internal/dict_impl.py +65 -0
  37. sonolus/script/internal/generic.py +6 -9
  38. sonolus/script/internal/impl.py +38 -13
  39. sonolus/script/internal/introspection.py +5 -2
  40. sonolus/script/{math.py → internal/math_impls.py} +28 -28
  41. sonolus/script/internal/native.py +3 -3
  42. sonolus/script/internal/random.py +67 -0
  43. sonolus/script/internal/range.py +81 -0
  44. sonolus/script/internal/transient.py +51 -0
  45. sonolus/script/internal/tuple_impl.py +113 -0
  46. sonolus/script/interval.py +234 -16
  47. sonolus/script/iterator.py +120 -167
  48. sonolus/script/level.py +24 -0
  49. sonolus/script/num.py +79 -47
  50. sonolus/script/options.py +78 -12
  51. sonolus/script/particle.py +37 -4
  52. sonolus/script/pointer.py +4 -4
  53. sonolus/script/print.py +22 -1
  54. sonolus/script/project.py +8 -0
  55. sonolus/script/{graphics.py → quad.py} +75 -12
  56. sonolus/script/record.py +44 -13
  57. sonolus/script/runtime.py +50 -1
  58. sonolus/script/sprite.py +197 -112
  59. sonolus/script/text.py +2 -0
  60. sonolus/script/timing.py +72 -0
  61. sonolus/script/transform.py +296 -66
  62. sonolus/script/ui.py +134 -78
  63. sonolus/script/values.py +6 -13
  64. sonolus/script/vec.py +118 -3
  65. {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/METADATA +1 -1
  66. sonolus_py-0.1.5.dist-info/RECORD +89 -0
  67. sonolus/backend/dead_code.py +0 -80
  68. sonolus/backend/optimize.py +0 -37
  69. sonolus/backend/simplify.py +0 -47
  70. sonolus/script/comptime.py +0 -160
  71. sonolus/script/random.py +0 -14
  72. sonolus/script/range.py +0 -58
  73. sonolus_py-0.1.4.dist-info/RECORD +0 -84
  74. /sonolus/script/{callbacks.py → internal/callbacks.py} +0 -0
  75. {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/WHEEL +0 -0
  76. {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.dist-info}/entry_points.txt +0 -0
  77. {sonolus_py-0.1.4.dist-info → sonolus_py-0.1.5.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 skin_sprite(name: str) -> Any:
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,114 @@ def skin[T](cls: type[T]) -> T | Skin:
220
303
 
221
304
 
222
305
  class StandardSprite:
223
- NOTE_HEAD_NEUTRAL = Annotated[Sprite, skin_sprite("#NOTE_HEAD_NEUTRAL")]
224
- NOTE_HEAD_RED = Annotated[Sprite, skin_sprite("#NOTE_HEAD_RED")]
225
- NOTE_HEAD_GREEN = Annotated[Sprite, skin_sprite("#NOTE_HEAD_GREEN")]
226
- NOTE_HEAD_BLUE = Annotated[Sprite, skin_sprite("#NOTE_HEAD_BLUE")]
227
- NOTE_HEAD_YELLOW = Annotated[Sprite, skin_sprite("#NOTE_HEAD_YELLOW")]
228
- NOTE_HEAD_PURPLE = Annotated[Sprite, skin_sprite("#NOTE_HEAD_PURPLE")]
229
- NOTE_HEAD_CYAN = Annotated[Sprite, skin_sprite("#NOTE_HEAD_CYAN")]
230
-
231
- NOTE_TICK_NEUTRAL = Annotated[Sprite, skin_sprite("#NOTE_TICK_NEUTRAL")]
232
- NOTE_TICK_RED = Annotated[Sprite, skin_sprite("#NOTE_TICK_RED")]
233
- NOTE_TICK_GREEN = Annotated[Sprite, skin_sprite("#NOTE_TICK_GREEN")]
234
- NOTE_TICK_BLUE = Annotated[Sprite, skin_sprite("#NOTE_TICK_BLUE")]
235
- NOTE_TICK_YELLOW = Annotated[Sprite, skin_sprite("#NOTE_TICK_YELLOW")]
236
- NOTE_TICK_PURPLE = Annotated[Sprite, skin_sprite("#NOTE_TICK_PURPLE")]
237
- NOTE_TICK_CYAN = Annotated[Sprite, skin_sprite("#NOTE_TICK_CYAN")]
238
-
239
- NOTE_TAIL_NEUTRAL = Annotated[Sprite, skin_sprite("#NOTE_TAIL_NEUTRAL")]
240
- NOTE_TAIL_RED = Annotated[Sprite, skin_sprite("#NOTE_TAIL_RED")]
241
- NOTE_TAIL_GREEN = Annotated[Sprite, skin_sprite("#NOTE_TAIL_GREEN")]
242
- NOTE_TAIL_BLUE = Annotated[Sprite, skin_sprite("#NOTE_TAIL_BLUE")]
243
- NOTE_TAIL_YELLOW = Annotated[Sprite, skin_sprite("#NOTE_TAIL_YELLOW")]
244
- NOTE_TAIL_PURPLE = Annotated[Sprite, skin_sprite("#NOTE_TAIL_PURPLE")]
245
- NOTE_TAIL_CYAN = Annotated[Sprite, skin_sprite("#NOTE_TAIL_CYAN")]
246
-
247
- NOTE_CONNECTION_NEUTRAL = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_NEUTRAL")]
248
- NOTE_CONNECTION_RED = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_RED")]
249
- NOTE_CONNECTION_GREEN = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_GREEN")]
250
- NOTE_CONNECTION_BLUE = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_BLUE")]
251
- NOTE_CONNECTION_YELLOW = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_YELLOW")]
252
- NOTE_CONNECTION_PURPLE = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_PURPLE")]
253
- NOTE_CONNECTION_CYAN = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_CYAN")]
254
-
255
- NOTE_CONNECTION_NEUTRAL_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_NEUTRAL_SEAMLESS")]
256
- NOTE_CONNECTION_RED_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_RED_SEAMLESS")]
257
- NOTE_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_GREEN_SEAMLESS")]
258
- NOTE_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_BLUE_SEAMLESS")]
259
- NOTE_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_YELLOW_SEAMLESS")]
260
- NOTE_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_PURPLE_SEAMLESS")]
261
- NOTE_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite, skin_sprite("#NOTE_CONNECTION_CYAN_SEAMLESS")]
262
-
263
- SIMULTANEOUS_CONNECTION_NEUTRAL = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_NEUTRAL")]
264
- SIMULTANEOUS_CONNECTION_RED = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_RED")]
265
- SIMULTANEOUS_CONNECTION_GREEN = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_GREEN")]
266
- SIMULTANEOUS_CONNECTION_BLUE = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_BLUE")]
267
- SIMULTANEOUS_CONNECTION_YELLOW = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_YELLOW")]
268
- SIMULTANEOUS_CONNECTION_PURPLE = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_PURPLE")]
269
- SIMULTANEOUS_CONNECTION_CYAN = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_CYAN")]
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")]
270
355
 
271
356
  SIMULTANEOUS_CONNECTION_NEUTRAL_SEAMLESS = Annotated[
272
- Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_NEUTRAL_SEAMLESS")
357
+ Sprite, sprite("#SIMULTANEOUS_CONNECTION_NEUTRAL_SEAMLESS")
273
358
  ]
274
- SIMULTANEOUS_CONNECTION_RED_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_RED_SEAMLESS")]
275
- SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS")]
276
- SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS")]
277
- SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS")]
278
- SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS")]
279
- SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS")]
280
-
281
- DIRECTIONAL_MARKER_NEUTRAL = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_NEUTRAL")]
282
- DIRECTIONAL_MARKER_RED = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_RED")]
283
- DIRECTIONAL_MARKER_GREEN = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_GREEN")]
284
- DIRECTIONAL_MARKER_BLUE = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_BLUE")]
285
- DIRECTIONAL_MARKER_YELLOW = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_YELLOW")]
286
- DIRECTIONAL_MARKER_PURPLE = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_PURPLE")]
287
- DIRECTIONAL_MARKER_CYAN = Annotated[Sprite, skin_sprite("#DIRECTIONAL_MARKER_CYAN")]
288
-
289
- SIMULTANEOUS_MARKER_NEUTRAL = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_NEUTRAL")]
290
- SIMULTANEOUS_MARKER_RED = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_RED")]
291
- SIMULTANEOUS_MARKER_GREEN = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_GREEN")]
292
- SIMULTANEOUS_MARKER_BLUE = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_BLUE")]
293
- SIMULTANEOUS_MARKER_YELLOW = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_YELLOW")]
294
- SIMULTANEOUS_MARKER_PURPLE = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_PURPLE")]
295
- SIMULTANEOUS_MARKER_CYAN = Annotated[Sprite, skin_sprite("#SIMULTANEOUS_MARKER_CYAN")]
296
-
297
- STAGE_MIDDLE = Annotated[Sprite, skin_sprite("#STAGE_MIDDLE")]
298
- STAGE_LEFT_BORDER = Annotated[Sprite, skin_sprite("#STAGE_LEFT_BORDER")]
299
- STAGE_RIGHT_BORDER = Annotated[Sprite, skin_sprite("#STAGE_RIGHT_BORDER")]
300
- STAGE_TOP_BORDER = Annotated[Sprite, skin_sprite("#STAGE_TOP_BORDER")]
301
- STAGE_BOTTOM_BORDER = Annotated[Sprite, skin_sprite("#STAGE_BOTTOM_BORDER")]
302
-
303
- STAGE_LEFT_BORDER_SEAMLESS = Annotated[Sprite, skin_sprite("#STAGE_LEFT_BORDER_SEAMLESS")]
304
- STAGE_RIGHT_BORDER_SEAMLESS = Annotated[Sprite, skin_sprite("#STAGE_RIGHT_BORDER_SEAMLESS")]
305
- STAGE_TOP_BORDER_SEAMLESS = Annotated[Sprite, skin_sprite("#STAGE_TOP_BORDER_SEAMLESS")]
306
- STAGE_BOTTOM_BORDER_SEAMLESS = Annotated[Sprite, skin_sprite("#STAGE_BOTTOM_BORDER_SEAMLESS")]
307
-
308
- STAGE_TOP_LEFT_CORNER = Annotated[Sprite, skin_sprite("#STAGE_TOP_LEFT_CORNER")]
309
- STAGE_TOP_RIGHT_CORNER = Annotated[Sprite, skin_sprite("#STAGE_TOP_RIGHT_CORNER")]
310
- STAGE_BOTTOM_LEFT_CORNER = Annotated[Sprite, skin_sprite("#STAGE_BOTTOM_LEFT_CORNER")]
311
- STAGE_BOTTOM_RIGHT_CORNER = Annotated[Sprite, skin_sprite("#STAGE_BOTTOM_RIGHT_CORNER")]
312
-
313
- LANE = Annotated[Sprite, skin_sprite("#LANE")]
314
- LANE_SEAMLESS = Annotated[Sprite, skin_sprite("#LANE_SEAMLESS")]
315
- LANE_ALTERNATIVE = Annotated[Sprite, skin_sprite("#LANE_ALTERNATIVE")]
316
- LANE_ALTERNATIVE_SEAMLESS = Annotated[Sprite, skin_sprite("#LANE_ALTERNATIVE_SEAMLESS")]
317
-
318
- JUDGMENT_LINE = Annotated[Sprite, skin_sprite("#JUDGMENT_LINE")]
319
- NOTE_SLOT = Annotated[Sprite, skin_sprite("#NOTE_SLOT")]
320
- STAGE_COVER = Annotated[Sprite, skin_sprite("#STAGE_COVER")]
321
-
322
- GRID_NEUTRAL = Annotated[Sprite, skin_sprite("#GRID_NEUTRAL")]
323
- GRID_RED = Annotated[Sprite, skin_sprite("#GRID_RED")]
324
- GRID_GREEN = Annotated[Sprite, skin_sprite("#GRID_GREEN")]
325
- GRID_BLUE = Annotated[Sprite, skin_sprite("#GRID_BLUE")]
326
- GRID_YELLOW = Annotated[Sprite, skin_sprite("#GRID_YELLOW")]
327
- GRID_PURPLE = Annotated[Sprite, skin_sprite("#GRID_PURPLE")]
328
- GRID_CYAN = Annotated[Sprite, skin_sprite("#GRID_CYAN")]
359
+ SIMULTANEOUS_CONNECTION_RED_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_RED_SEAMLESS")]
360
+ SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_GREEN_SEAMLESS")]
361
+ SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_BLUE_SEAMLESS")]
362
+ SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_YELLOW_SEAMLESS")]
363
+ SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_PURPLE_SEAMLESS")]
364
+ SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS = Annotated[Sprite, sprite("#SIMULTANEOUS_CONNECTION_CYAN_SEAMLESS")]
365
+
366
+ DIRECTIONAL_MARKER_NEUTRAL = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_NEUTRAL")]
367
+ DIRECTIONAL_MARKER_RED = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_RED")]
368
+ DIRECTIONAL_MARKER_GREEN = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_GREEN")]
369
+ DIRECTIONAL_MARKER_BLUE = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_BLUE")]
370
+ DIRECTIONAL_MARKER_YELLOW = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_YELLOW")]
371
+ DIRECTIONAL_MARKER_PURPLE = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_PURPLE")]
372
+ DIRECTIONAL_MARKER_CYAN = Annotated[Sprite, sprite("#DIRECTIONAL_MARKER_CYAN")]
373
+
374
+ SIMULTANEOUS_MARKER_NEUTRAL = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_NEUTRAL")]
375
+ SIMULTANEOUS_MARKER_RED = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_RED")]
376
+ SIMULTANEOUS_MARKER_GREEN = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_GREEN")]
377
+ SIMULTANEOUS_MARKER_BLUE = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_BLUE")]
378
+ SIMULTANEOUS_MARKER_YELLOW = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_YELLOW")]
379
+ SIMULTANEOUS_MARKER_PURPLE = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_PURPLE")]
380
+ SIMULTANEOUS_MARKER_CYAN = Annotated[Sprite, sprite("#SIMULTANEOUS_MARKER_CYAN")]
381
+
382
+ STAGE_MIDDLE = Annotated[Sprite, sprite("#STAGE_MIDDLE")]
383
+ STAGE_LEFT_BORDER = Annotated[Sprite, sprite("#STAGE_LEFT_BORDER")]
384
+ STAGE_RIGHT_BORDER = Annotated[Sprite, sprite("#STAGE_RIGHT_BORDER")]
385
+ STAGE_TOP_BORDER = Annotated[Sprite, sprite("#STAGE_TOP_BORDER")]
386
+ STAGE_BOTTOM_BORDER = Annotated[Sprite, sprite("#STAGE_BOTTOM_BORDER")]
387
+
388
+ STAGE_LEFT_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_LEFT_BORDER_SEAMLESS")]
389
+ STAGE_RIGHT_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_RIGHT_BORDER_SEAMLESS")]
390
+ STAGE_TOP_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_TOP_BORDER_SEAMLESS")]
391
+ STAGE_BOTTOM_BORDER_SEAMLESS = Annotated[Sprite, sprite("#STAGE_BOTTOM_BORDER_SEAMLESS")]
392
+
393
+ STAGE_TOP_LEFT_CORNER = Annotated[Sprite, sprite("#STAGE_TOP_LEFT_CORNER")]
394
+ STAGE_TOP_RIGHT_CORNER = Annotated[Sprite, sprite("#STAGE_TOP_RIGHT_CORNER")]
395
+ STAGE_BOTTOM_LEFT_CORNER = Annotated[Sprite, sprite("#STAGE_BOTTOM_LEFT_CORNER")]
396
+ STAGE_BOTTOM_RIGHT_CORNER = Annotated[Sprite, sprite("#STAGE_BOTTOM_RIGHT_CORNER")]
397
+
398
+ LANE = Annotated[Sprite, sprite("#LANE")]
399
+ LANE_SEAMLESS = Annotated[Sprite, sprite("#LANE_SEAMLESS")]
400
+ LANE_ALTERNATIVE = Annotated[Sprite, sprite("#LANE_ALTERNATIVE")]
401
+ LANE_ALTERNATIVE_SEAMLESS = Annotated[Sprite, sprite("#LANE_ALTERNATIVE_SEAMLESS")]
402
+
403
+ JUDGMENT_LINE = Annotated[Sprite, sprite("#JUDGMENT_LINE")]
404
+ NOTE_SLOT = Annotated[Sprite, sprite("#NOTE_SLOT")]
405
+ STAGE_COVER = Annotated[Sprite, sprite("#STAGE_COVER")]
406
+
407
+ GRID_NEUTRAL = Annotated[Sprite, sprite("#GRID_NEUTRAL")]
408
+ GRID_RED = Annotated[Sprite, sprite("#GRID_RED")]
409
+ GRID_GREEN = Annotated[Sprite, sprite("#GRID_GREEN")]
410
+ GRID_BLUE = Annotated[Sprite, sprite("#GRID_BLUE")]
411
+ GRID_YELLOW = Annotated[Sprite, sprite("#GRID_YELLOW")]
412
+ GRID_PURPLE = Annotated[Sprite, sprite("#GRID_PURPLE")]
413
+ GRID_CYAN = Annotated[Sprite, sprite("#GRID_CYAN")]
329
414
 
330
415
 
331
416
  @skin
sonolus/script/text.py CHANGED
@@ -2,6 +2,8 @@ from enum import StrEnum
2
2
 
3
3
 
4
4
  class StandardText(StrEnum):
5
+ """Standard text constants."""
6
+
5
7
  POST = "#POST"
6
8
  PLAYLIST = "#PLAYLIST"
7
9
  LEVEL = "#LEVEL"
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