# HG changeset patch # User Emmanuel Gil Peyrot # Date 1371045806 -7200 # Node ID 608468be7a934e679cbba2c92c170748c1ea41a5 # Parent c689ff1743bf4355d6ed8fe5988318731052e60a Move ascii_wrapper to the interface, as it is game-dependent. diff --git a/pytouhou/game/game.py b/pytouhou/game/game.py --- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -84,9 +84,6 @@ class Game(object): self.spellcard_effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,)) self.spellcard_effect = None - #TODO: better place? - self.ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',)) - # See 102h.exe@0x413220 if you think you're brave enough. self.deaths_count = self.prng.rand_uint16() % 3 self.next_bonus = self.prng.rand_uint16() % 8 @@ -211,7 +208,7 @@ class Game(object): def new_label(self, pos, text): - label = Text(pos, self.ascii_wrapper, text=text, xspacing=8, shift=48) + label = Text(pos, self.interface.ascii_wrapper, text=text, xspacing=8, shift=48) label.set_timeout(60, effect='move') self.labels.append(label) return label @@ -222,7 +219,7 @@ class Game(object): #TODO: Scale pos = pos[0] + 192, pos[1] - label = Text(pos, self.ascii_wrapper, text=hint['Text'], align=hint['Align']) + label = Text(pos, self.interface.ascii_wrapper, text=hint['Text'], align=hint['Align']) label.set_timeout(hint['Time']) label.set_alpha(hint['Alpha']) label.set_color(hint['Color'], text=False) diff --git a/pytouhou/games/eosd.py b/pytouhou/games/eosd.py --- a/pytouhou/games/eosd.py +++ b/pytouhou/games/eosd.py @@ -105,7 +105,7 @@ class EoSDInterface(object): def __init__(self, game, resource_loader): self.game = game front = resource_loader.get_anm_wrapper(('front.anm',)) - ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',)) + self.ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',)) self.width = 640 self.height = 480 @@ -121,25 +121,25 @@ class EoSDInterface(object): for item in self.items: item.sprite.allow_dest_offset = True #XXX - self.level_start = [Text((176, 200), ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location. + self.level_start = [Text((176, 200), self.ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location. self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120) self.level_start[0].set_color('yellow') #TODO: use the system text for the stage name, and the song name. self.labels = { - 'highscore': Text((500, 58), ascii_wrapper, front, text='0'), - 'score': Text((500, 82), ascii_wrapper, front, text='0'), + 'highscore': Text((500, 58), self.ascii_wrapper, front, text='0'), + 'score': Text((500, 82), self.ascii_wrapper, front, text='0'), 'player': Counter((500, 122), front, front, script=16, value=0), 'bombs': Counter((500, 146), front, front, script=17, value=0), - 'power': Text((500, 186), ascii_wrapper, front, text='0'), - 'graze': Text((500, 206), ascii_wrapper, front, text='0'), - 'points': Text((500, 226), ascii_wrapper, front, text='0'), - 'framerate': Text((512, 464), ascii_wrapper, front), - 'debug?': Text((0, 464), ascii_wrapper, front), + 'power': Text((500, 186), self.ascii_wrapper, front, text='0'), + 'graze': Text((500, 206), self.ascii_wrapper, front, text='0'), + 'points': Text((500, 226), self.ascii_wrapper, front, text='0'), + 'framerate': Text((512, 464), self.ascii_wrapper, front), + 'debug?': Text((0, 464), self.ascii_wrapper, front), # Only when there is a boss. - 'boss_lives': Text((80, 16), ascii_wrapper), - 'timeout': Text((384, 16), ascii_wrapper), + 'boss_lives': Text((80, 16), self.ascii_wrapper), + 'timeout': Text((384, 16), self.ascii_wrapper), } self.labels['boss_lives'].set_color('yellow')