comparison pytouhou/ui/anmrenderer.py @ 304:f3099ebf4f61

Update attribute names to reflect the actual interface.
author Thibaut Girka <thib@sitedethib.com>
date Tue, 13 Mar 2012 18:38:14 +0100
parents d95beee0087a
children b9aecdc6f72f
comparison
equal deleted inserted replaced
303:647bde10353d 304:f3099ebf4f61
120 elif symbol >= pyglet.window.key.F1 and symbol <= pyglet.window.key.F12: 120 elif symbol >= pyglet.window.key.F1 and symbol <= pyglet.window.key.F12:
121 interrupt = symbol - pyglet.window.key.F1 + 1 121 interrupt = symbol - pyglet.window.key.F1 + 1
122 if modifiers & pyglet.window.key.MOD_SHIFT: 122 if modifiers & pyglet.window.key.MOD_SHIFT:
123 interrupt += 12 123 interrupt += 12
124 if not self.sprites: 124 if not self.sprites:
125 self._anmrunner.interrupt(interrupt) 125 self.anmrunner.interrupt(interrupt)
126 126
127 127
128 def load(self, index=None): 128 def load(self, index=None):
129 if index is None: 129 if index is None:
130 index = self.num 130 index = self.num
131 self._sprite = Sprite() 131 self.sprite = Sprite()
132 if self.sprites: 132 if self.sprites:
133 self._sprite.anm, self._sprite.texcoords = self._anm_wrapper.get_sprite(index) 133 self.sprite.anm, self.sprite.texcoords = self._anm_wrapper.get_sprite(index)
134 print('Loaded sprite %d' % index) 134 print('Loaded sprite %d' % index)
135 else: 135 else:
136 self._anmrunner = ANMRunner(self._anm_wrapper, index, self._sprite) 136 self.anmrunner = ANMRunner(self._anm_wrapper, index, self.sprite)
137 print('Loading anim %d, handled events: %r' % (index, self._anmrunner.script.interrupts.keys())) 137 print('Loading anim %d, handled events: %r' % (index, self.anmrunner.script.interrupts.keys()))
138 self.num = index 138 self.num = index
139 139
140 140
141 def change(self, diff): 141 def change(self, diff):
142 keys = self.items.keys() 142 keys = self.items.keys()
167 self.clear_color = (0., 0., 0., 1.) 167 self.clear_color = (0., 0., 0., 1.)
168 168
169 169
170 def update(self): 170 def update(self):
171 if not self.sprites: 171 if not self.sprites:
172 self._anmrunner.run_frame() 172 self.anmrunner.run_frame()
173 173
174 if self.force_allow_dest_offset: 174 if self.force_allow_dest_offset:
175 self._sprite.allow_dest_offset = True 175 self.sprite.allow_dest_offset = True
176 176
177 glClearColor(*self.clear_color) 177 glClearColor(*self.clear_color)
178 glClear(GL_COLOR_BUFFER_BIT) 178 glClear(GL_COLOR_BUFFER_BIT)
179 if not self._sprite._removed: 179 if not self.sprite.removed:
180 self.render_elements([self]) 180 self.render_elements([self])
181 181