Mercurial > touhou
annotate pytouhou/game/sprite.pxd @ 795:2d60a14f4816 default tip
python: Rewrite the main entrypoint in Rust
This lets us progressively replace Python modules with Rust ones.
Currently missing features include:
- Saving replays
- Networking code for cooperative mode
- Reading a configuration file for options
- Maybe more.
But the base game is working, so yay!
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Tue, 02 Jun 2026 19:06:16 +0200 |
| parents | df3c4ef5f2cc |
| children |
| rev | line source |
|---|---|
|
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 from pytouhou.utils.interpolator cimport Interpolator |
|
608
725bd24235a2
Make ANM0 pure-python again, by moving the Cython-dependent ANM class into its own module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
532
diff
changeset
|
2 from pytouhou.formats.animation cimport Animation |
|
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 |
|
628
df3c4ef5f2cc
Partially revert 98603f2c32b4, as the creation of a .h file made some checking tools unhappy.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
622
diff
changeset
|
4 cdef class Sprite: |
|
622
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
5 cdef public int blendfunc, frame |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
6 cdef public float width_override, height_override, angle |
|
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 cdef public bint removed, changed, visible, force_rotation |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 cdef public bint automatic_orientation, allow_dest_offset, mirrored |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 cdef public bint corner_relative_placement |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 cdef public Interpolator scale_interpolator, fade_interpolator |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 cdef public Interpolator offset_interpolator, rotation_interpolator |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 cdef public Interpolator color_interpolator |
|
608
725bd24235a2
Make ANM0 pure-python again, by moving the Cython-dependent ANM class into its own module.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
532
diff
changeset
|
13 cdef public Animation anm |
|
532
dacdcca59b66
Don’t put back the rendering data into a tuple, use a specialised struct inside Sprite to pass it to the renderer.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
526
diff
changeset
|
14 |
|
dacdcca59b66
Don’t put back the rendering data into a tuple, use a specialised struct inside Sprite to pass it to the renderer.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
526
diff
changeset
|
15 cdef void *_rendering_data |
|
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 |
|
526
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
525
diff
changeset
|
17 cdef float _dest_offset[3] |
|
622
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
18 cdef float _texcoords[4] |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
19 cdef float _texoffsets[2] |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
20 cdef float _rescale[2] |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
21 cdef float _scale_speed[2] |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
22 cdef float _rotations_3d[3] |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
23 cdef float _rotations_speed_3d[3] |
|
526
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
525
diff
changeset
|
24 cdef unsigned char _color[4] |
|
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
525
diff
changeset
|
25 |
|
622
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
26 cpdef fade(self, unsigned int duration, alpha, formula=*) |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
27 cpdef scale_in(self, unsigned int duration, sx, sy, formula=*) |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
28 cpdef move_in(self, unsigned int duration, x, y, z, formula=*) |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
29 cpdef rotate_in(self, unsigned int duration, rx, ry, rz, formula=*) |
|
98603f2c32b4
Reduce the precision of Sprite’s variables.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
608
diff
changeset
|
30 cpdef change_color_in(self, unsigned int duration, r, g, b, formula=*) |
|
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 cpdef update_orientation(self, double angle_base=*, bint force_rotation=*) |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 cpdef Sprite copy(self) |
|
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 cpdef update(self) |
