annotate pytouhou/game/text.pxd @ 474:ca22df9e70bc

Fix a crash when handling non-ascii paths
author Thibaut Girka <thib@sitedethib.com>
date Fri, 27 Sep 2013 18:02:04 +0200
parents 1c891c71cf22
children 2276229282fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
33 cdef long shift, timeout, duration, start
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
34 cdef Interpolator fade_interpolator
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
35 cdef unsigned char alpha
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
36
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
37 cpdef set_text(self, bytes text)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
38 #def timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39 #def move_timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
40 #def fadeout_timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
41 cdef void fade(self, unsigned long duration, unsigned char alpha, formula=*) except *
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
42 cpdef set_timeout(self, long timeout, str effect=*, long duration=*, long start=*)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
43
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 cdef class Counter(GlyphCollection):
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
46 cdef long value
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
47
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
48 cpdef set_value(self, long value)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
49
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 cdef class Gauge(Element):
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
52 cdef public long value, max_length, maximum
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
53
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
54 cpdef set_value(self, long value)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
55 cpdef update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
56
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 cdef class NativeText(Element):
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
59 cdef public object update
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
60
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
61 cdef unicode text
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
62 cdef long width, height
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
63 cdef unsigned char alpha
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
64 cdef bint shadow
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
65 cdef bytes align #TODO: use a proper enum.
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
66 cdef unsigned long frame, timeout, duration
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
67 cdef long start
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
68 cdef double to[2], end[2]
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
69 cdef list gradient
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
70 cdef Interpolator fade_interpolator, offset_interpolator
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
71 cdef object texture
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
72
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
73 #def normal_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
74 #def timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
75 #def move_timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
76 #def move_ex_timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
77 #def fadeout_timeout_update(self)
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
78
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
79 cdef void fade(self, unsigned long duration, unsigned char alpha, formula=*) except *
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
80 cdef void move_in(self, unsigned long duration, double x, double y, formula=*) except *
1c891c71cf22 Cythonize pytouhou.game.text.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
81 cpdef set_timeout(self, long timeout, str effect=*, long duration=*, long start=*, to=*, end=*)