comparison pytouhou/game/game.py @ 409:608468be7a93

Move ascii_wrapper to the interface, as it is game-dependent.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 12 Jun 2013 16:03:26 +0200
parents 6c0cb3eee33e
children f41a26971a19
comparison
equal deleted inserted replaced
408:c689ff1743bf 409:608468be7a93
82 self.ecl_runners = [ECLMainRunner(main, ecl.subs, self) for main in ecl.mains] 82 self.ecl_runners = [ECLMainRunner(main, ecl.subs, self) for main in ecl.mains]
83 83
84 self.spellcard_effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,)) 84 self.spellcard_effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,))
85 self.spellcard_effect = None 85 self.spellcard_effect = None
86 86
87 #TODO: better place?
88 self.ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',))
89
90 # See 102h.exe@0x413220 if you think you're brave enough. 87 # See 102h.exe@0x413220 if you think you're brave enough.
91 self.deaths_count = self.prng.rand_uint16() % 3 88 self.deaths_count = self.prng.rand_uint16() % 3
92 self.next_bonus = self.prng.rand_uint16() % 8 89 self.next_bonus = self.prng.rand_uint16() % 8
93 90
94 self.last_keystate = 0 91 self.last_keystate = 0
209 self.msg_runner = MSGRunner(self.msg, sub, self) 206 self.msg_runner = MSGRunner(self.msg, sub, self)
210 self.msg_runner.run_iteration() 207 self.msg_runner.run_iteration()
211 208
212 209
213 def new_label(self, pos, text): 210 def new_label(self, pos, text):
214 label = Text(pos, self.ascii_wrapper, text=text, xspacing=8, shift=48) 211 label = Text(pos, self.interface.ascii_wrapper, text=text, xspacing=8, shift=48)
215 label.set_timeout(60, effect='move') 212 label.set_timeout(60, effect='move')
216 self.labels.append(label) 213 self.labels.append(label)
217 return label 214 return label
218 215
219 216
220 def new_hint(self, hint): 217 def new_hint(self, hint):
221 pos = hint['Pos'] 218 pos = hint['Pos']
222 #TODO: Scale 219 #TODO: Scale
223 220
224 pos = pos[0] + 192, pos[1] 221 pos = pos[0] + 192, pos[1]
225 label = Text(pos, self.ascii_wrapper, text=hint['Text'], align=hint['Align']) 222 label = Text(pos, self.interface.ascii_wrapper, text=hint['Text'], align=hint['Align'])
226 label.set_timeout(hint['Time']) 223 label.set_timeout(hint['Time'])
227 label.set_alpha(hint['Alpha']) 224 label.set_alpha(hint['Alpha'])
228 label.set_color(hint['Color'], text=False) 225 label.set_color(hint['Color'], text=False)
229 self.labels.append(label) 226 self.labels.append(label)
230 return label 227 return label