Mercurial > touhou
annotate pytouhou/game/sprite.pyx @ 591:2dfa4aa135d2
Make the SDLError exception class automatically call SDL_GetError().
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 15 Oct 2014 13:17:07 +0200 |
parents | e15672733c93 |
children | 98603f2c32b4 |
rev | line source |
---|---|
52
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
2 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
4 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
8 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
12 ## GNU General Public License for more details. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
13 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
14 |
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
|
15 from libc.stdlib cimport free |
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
|
16 from libc.string cimport memcpy |
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
|
17 |
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
|
18 |
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:
439
diff
changeset
|
19 cdef class Sprite: |
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
|
20 def __dealloc__(self): |
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
|
21 if self._rendering_data != NULL: |
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
|
22 free(self._rendering_data) |
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
|
23 |
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
|
24 |
120
4300a832f033
Small refactoring and massive performance improvement
Thibaut Girka <thib@sitedethib.com>
parents:
108
diff
changeset
|
25 def __init__(self, width_override=0, height_override=0): |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
26 self.anm = None |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
280
diff
changeset
|
27 self.removed = False |
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
280
diff
changeset
|
28 self.changed = True |
245
d3ba32a9096e
Implement ANM0 instruction 29 and fix 24
Thibaut Girka <thib@sitedethib.com>
parents:
150
diff
changeset
|
29 self.visible = True |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
30 |
120
4300a832f033
Small refactoring and massive performance improvement
Thibaut Girka <thib@sitedethib.com>
parents:
108
diff
changeset
|
31 self.width_override = width_override |
4300a832f033
Small refactoring and massive performance improvement
Thibaut Girka <thib@sitedethib.com>
parents:
108
diff
changeset
|
32 self.height_override = height_override |
90 | 33 self.angle = 0 |
34 self.force_rotation = False | |
35 | |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
36 self.scale_interpolator = None |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
37 self.fade_interpolator = None |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
38 self.offset_interpolator = None |
429
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
39 self.rotation_interpolator = None |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
40 self.color_interpolator = None |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
41 |
81
f5f9b5eb69a3
Handle one more ANM instruction, and handle sprite indexes offsets
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
42 self.automatic_orientation = False |
f5f9b5eb69a3
Handle one more ANM instruction, and handle sprite indexes offsets
Thibaut Girka <thib@sitedethib.com>
parents:
75
diff
changeset
|
43 |
72
6a08f44fa01b
Handle a few more ANM instructions. pytouhou.game.background needs some serious refactoring.
Thibaut Girka <thib@sitedethib.com>
parents:
71
diff
changeset
|
44 self.blendfunc = 0 # 0 = Normal, 1 = saturate #TODO: proper constants |
6a08f44fa01b
Handle a few more ANM instructions. pytouhou.game.background needs some serious refactoring.
Thibaut Girka <thib@sitedethib.com>
parents:
71
diff
changeset
|
45 |
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:
439
diff
changeset
|
46 self._texcoords[:] = [0, 0, 0, 0] # x, y, width, height |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
47 self._dest_offset[:] = [0., 0., 0.] |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
48 self.allow_dest_offset = False |
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:
439
diff
changeset
|
49 self._texoffsets[:] = [0., 0.] |
15 | 50 self.mirrored = False |
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:
439
diff
changeset
|
51 self._rescale[:] = [1., 1.] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
52 self._scale_speed[:] = [0., 0.] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
53 self._rotations_3d[:] = [0., 0., 0.] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
54 self._rotations_speed_3d[:] = [0., 0., 0.] |
15 | 55 self.corner_relative_placement = False |
17
d940d004b840
Make game.sprite.Sprite use its own frame counter.
Thibaut Girka <thib@sitedethib.com>
parents:
15
diff
changeset
|
56 self.frame = 0 |
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:
439
diff
changeset
|
57 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
58 # Cython treats unsigned char* variables as bytes, so we can’t use |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
59 # slicing here. |
590
e15672733c93
Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
532
diff
changeset
|
60 for i in range(4): |
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:
439
diff
changeset
|
61 self._color[i] = 255 |
108
2a03940deea3
Move everything graphical to pytouhou.opengl!
Thibaut Girka <thib@sitedethib.com>
parents:
97
diff
changeset
|
62 |
15 | 63 |
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:
439
diff
changeset
|
64 property scale_speed: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
65 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
66 return (self._scale_speed[0], self._scale_speed[1]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
67 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
68 self._scale_speed[:] = [value[0], value[1]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
69 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
70 property texoffsets: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
71 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
72 return (self._texoffsets[0], self._texoffsets[1]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
73 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
74 self._texoffsets[:] = [value[0], value[1]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
75 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
76 property rescale: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
77 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
78 return (self._rescale[0], self._rescale[1]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
79 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
80 self._rescale[:] = [value[0], value[1]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
81 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
82 property dest_offset: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
83 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
84 return (self._dest_offset[0], self._dest_offset[1], self._dest_offset[2]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
85 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
86 self._dest_offset[:] = [value[0], value[1], value[2]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
87 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
88 property rotations_speed_3d: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
89 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
90 return (self._rotations_speed_3d[0], self._rotations_speed_3d[1], self._rotations_speed_3d[2]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
91 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
92 self._rotations_speed_3d[:] = [value[0], value[1], value[2]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
93 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
94 property rotations_3d: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
95 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
96 return (self._rotations_3d[0], self._rotations_3d[1], self._rotations_3d[2]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
97 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
98 self._rotations_3d[:] = [value[0], value[1], value[2]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
99 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
100 property color: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
101 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
102 return (self._color[0], self._color[1], self._color[2]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
103 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
104 self._color[0] = value[0] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
105 self._color[1] = value[1] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
106 self._color[2] = value[2] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
107 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
108 property alpha: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
109 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
110 return self._color[3] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
111 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
112 self._color[3] = value |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
113 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
114 property texcoords: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
115 def __get__(self): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
116 return (self._texcoords[0], self._texcoords[1], self._texcoords[2], self._texcoords[3]) |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
117 def __set__(self, value): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
118 self._texcoords[:] = [value[0], value[1], value[2], value[3]] |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
119 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
120 |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
121 cpdef fade(self, unsigned long duration, alpha, formula=None): |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
122 self.fade_interpolator = Interpolator((self._color[3],), self.frame, |
280 | 123 (alpha,), self.frame + duration, |
124 formula) | |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
125 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
126 |
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:
439
diff
changeset
|
127 cpdef scale_in(self, unsigned long duration, sx, sy, formula=None): |
280 | 128 self.scale_interpolator = Interpolator(self.rescale, self.frame, |
129 (sx, sy), self.frame + duration, | |
130 formula) | |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
131 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
132 |
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:
439
diff
changeset
|
133 cpdef move_in(self, unsigned long duration, x, y, z, formula=None): |
280 | 134 self.offset_interpolator = Interpolator(self.dest_offset, self.frame, |
135 (x, y, z), self.frame + duration, | |
136 formula) | |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
137 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
138 |
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:
439
diff
changeset
|
139 cpdef rotate_in(self, unsigned long duration, rx, ry, rz, formula=None): |
429
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
140 self.rotation_interpolator = Interpolator(self.rotations_3d, self.frame, |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
141 (rx, ry, rz), self.frame + duration, |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
142 formula) |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
143 |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
144 |
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:
439
diff
changeset
|
145 cpdef change_color_in(self, unsigned long duration, r, g, b, formula=None): |
429
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
146 self.color_interpolator = Interpolator(self.color, self.frame, |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
147 (r, g, b), self.frame + duration, |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
148 formula) |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
149 |
40d5f3083ebc
Implement PCB’s ANM2 format and vm.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
304
diff
changeset
|
150 |
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:
439
diff
changeset
|
151 cpdef update_orientation(self, double angle_base=0., bint force_rotation=False): |
120
4300a832f033
Small refactoring and massive performance improvement
Thibaut Girka <thib@sitedethib.com>
parents:
108
diff
changeset
|
152 if (self.angle != angle_base or self.force_rotation != force_rotation): |
92
85f3b8ba3f24
Minor refactoring and optimizations. Drop stageviewer.
Thibaut Girka <thib@sitedethib.com>
parents:
90
diff
changeset
|
153 self.angle = angle_base |
85f3b8ba3f24
Minor refactoring and optimizations. Drop stageviewer.
Thibaut Girka <thib@sitedethib.com>
parents:
90
diff
changeset
|
154 self.force_rotation = force_rotation |
304
f3099ebf4f61
Update attribute names to reflect the actual interface.
Thibaut Girka <thib@sitedethib.com>
parents:
280
diff
changeset
|
155 self.changed = True |
94
ca571697ec83
Various minor optimisations and refactoring
Thibaut Girka <thib@sitedethib.com>
parents:
92
diff
changeset
|
156 |
432
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
157 |
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:
439
diff
changeset
|
158 cpdef Sprite copy(self): |
439
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
159 sprite = Sprite(self.width_override, self.height_override) |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
160 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
161 sprite.blendfunc = self.blendfunc |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
162 sprite.frame = self.frame |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
163 sprite.angle = self.angle |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
164 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
165 sprite.removed = self.removed |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
166 sprite.changed = self.changed |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
167 sprite.visible = self.visible |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
168 sprite.force_rotation = self.force_rotation |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
169 sprite.automatic_orientation = self.automatic_orientation |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
170 sprite.allow_dest_offset = self.allow_dest_offset |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
171 sprite.mirrored = self.mirrored |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
172 sprite.corner_relative_placement = self.corner_relative_placement |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
173 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
174 sprite.scale_interpolator = self.scale_interpolator |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
175 sprite.fade_interpolator = self.fade_interpolator |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
176 sprite.offset_interpolator = self.offset_interpolator |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
177 sprite.rotation_interpolator = self.rotation_interpolator |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
178 sprite.color_interpolator = self.color_interpolator |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
179 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
180 sprite.texcoords = self.texcoords |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
181 sprite.dest_offset = self.dest_offset |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
182 sprite.texoffsets = self.texoffsets |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
183 sprite.rescale = self.rescale |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
184 sprite.scale_speed = self.scale_speed |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
185 sprite.rotations_3d = self.rotations_3d |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
186 sprite.rotations_speed_3d = self.rotations_speed_3d |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
187 sprite.color = self.color |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
188 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
189 sprite.alpha = self.alpha |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
190 sprite.anm = self.anm |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
191 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
192 return sprite |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
193 |
723a3e67a223
Make pytouhou.game.sprite an extension type.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
432
diff
changeset
|
194 |
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:
439
diff
changeset
|
195 cpdef update(self): |
432
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
196 self.frame += 1 |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
197 |
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:
439
diff
changeset
|
198 sax, say, saz = self._rotations_speed_3d[0], self._rotations_speed_3d[1], self._rotations_speed_3d[2] #XXX |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
199 if sax or say or saz: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
200 ax, ay, az = self._rotations_3d[0], self._rotations_3d[1], self._rotations_3d[2] #XXX |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
201 self._rotations_3d[:] = [ax + sax, ay + say, az + saz] |
432
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
202 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
203 elif self.rotation_interpolator: |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
204 self.rotation_interpolator.update(self.frame) |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
205 self.rotations_3d = self.rotation_interpolator.values |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
206 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
207 |
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:
439
diff
changeset
|
208 rsx, rsy = self._scale_speed[0], self._scale_speed[1] #XXX |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
209 if rsx or rsy: |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
210 rx, ry = self._rescale[0], self._rescale[1] #XXX |
0b2a92a25245
Store data in C arrays in Sprite, and add an interface to access them as tuples.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
439
diff
changeset
|
211 self._rescale[:] = [rx + rsx, ry + rsy] |
432
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
212 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
213 |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
214 if self.fade_interpolator: |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
215 self.fade_interpolator.update(self.frame) |
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:
439
diff
changeset
|
216 self._color[3] = self.fade_interpolator.values[0] |
432
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
217 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
218 |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
219 if self.scale_interpolator: |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
220 self.scale_interpolator.update(self.frame) |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
221 self.rescale = self.scale_interpolator.values |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
222 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
223 |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
224 if self.offset_interpolator: |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
225 self.offset_interpolator.update(self.frame) |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
226 self.dest_offset = self.offset_interpolator.values |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
227 self.changed = True |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
228 |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
229 if self.color_interpolator: |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
230 self.color_interpolator.update(self.frame) |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
231 self.color = self.color_interpolator.values |
d4874ebaa06e
Split ANMRunner.run_frame into Sprite.update.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
429
diff
changeset
|
232 self.changed = True |