Mercurial > touhou
annotate pytouhou/game/text.pxd @ 639:a8e0219162b6
Implement AnmRunner.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 04 Jul 2019 15:21:46 +0200 |
parents | a6af3ff86612 |
children |
rev | line source |
---|---|
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 from pytouhou.game.element cimport Element |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 from pytouhou.game.sprite cimport Sprite |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 from pytouhou.utils.interpolator cimport Interpolator |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 cdef class Glyph(Element): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 pass |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 cdef class Widget(Element): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 cdef public object update |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 cdef public bint changed |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 cdef unsigned long frame |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 cdef object back_anm |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 #def update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 cdef class GlyphCollection(Widget): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 cdef Sprite ref_sprite |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 cdef object anm |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 cdef list glyphes |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 cdef long xspacing |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
25 cpdef set_length(self, unsigned long length) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 cpdef set_sprites(self, list sprite_indexes) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 cpdef set_color(self, text=*, color=*) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 cpdef set_alpha(self, unsigned char alpha) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 cdef class Text(GlyphCollection): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 cdef bytes text |
491
2276229282fd
Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
473
diff
changeset
|
33 cdef unsigned long timeout, duration, start |
2276229282fd
Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
473
diff
changeset
|
34 cdef long shift |
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 cdef Interpolator fade_interpolator |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 cdef unsigned char alpha |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 |
590
e15672733c93
Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
544
diff
changeset
|
38 cpdef set_text(self, text) |
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 #def timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 #def move_timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 #def fadeout_timeout_update(self) |
617
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
590
diff
changeset
|
42 cdef bint fade(self, unsigned long duration, unsigned char alpha, formula=*) except True |
491
2276229282fd
Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
473
diff
changeset
|
43 cpdef set_timeout(self, unsigned long timeout, str effect=*, unsigned long duration=*, unsigned long start=*) |
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 cdef class Counter(GlyphCollection): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 cdef long value |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
48 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 cpdef set_value(self, long value) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 cdef class Gauge(Element): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 cdef public long value, max_length, maximum |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 cpdef set_value(self, long value) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 cpdef update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 cdef class NativeText(Element): |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 cdef public object update |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 cdef unicode text |
590
e15672733c93
Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
544
diff
changeset
|
63 cdef str align #TODO: use a proper enum. |
491
2276229282fd
Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
473
diff
changeset
|
64 cdef unsigned long frame, timeout, duration, start |
540
53fa73932e9a
Fix warnings introduced in Cython 0.20, when more than one pointer is defined on the same line.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
491
diff
changeset
|
65 cdef double to[2] |
53fa73932e9a
Fix warnings introduced in Cython 0.20, when more than one pointer is defined on the same line.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
491
diff
changeset
|
66 cdef double end[2] |
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 cdef list gradient |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 cdef Interpolator fade_interpolator, offset_interpolator |
544
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
69 |
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
70 #XXX |
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
71 cdef public bint shadow |
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
72 cdef public long width, height |
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
73 cdef public unsigned char alpha |
b895ed2de71f
Implement text rendering for the SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
540
diff
changeset
|
74 cdef public object texture |
473
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 #def normal_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 #def timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 #def move_timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 #def move_ex_timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 #def fadeout_timeout_update(self) |
1c891c71cf22
Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 |
617
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
590
diff
changeset
|
82 cdef bint fade(self, unsigned long duration, unsigned char alpha, formula=*) except True |
a6af3ff86612
Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
590
diff
changeset
|
83 cdef bint move_in(self, unsigned long duration, double x, double y, formula=*) except True |
491
2276229282fd
Fix gcc’s warnings with -Wall -Wextra.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
473
diff
changeset
|
84 cpdef set_timeout(self, unsigned long timeout, str effect=*, unsigned long duration=*, unsigned long start=*, to=*, end=*) |