comparison pytouhou/games/eosd.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
103 103
104 class EoSDInterface(object): 104 class EoSDInterface(object):
105 def __init__(self, game, resource_loader): 105 def __init__(self, game, resource_loader):
106 self.game = game 106 self.game = game
107 front = resource_loader.get_anm_wrapper(('front.anm',)) 107 front = resource_loader.get_anm_wrapper(('front.anm',))
108 ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',)) 108 self.ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',))
109 109
110 self.width = 640 110 self.width = 640
111 self.height = 480 111 self.height = 480
112 self.game_pos = (32, 16) 112 self.game_pos = (32, 16)
113 113
119 [Effect((0, 0), 5, front)] + 119 [Effect((0, 0), 5, front)] +
120 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)]) 120 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)])
121 for item in self.items: 121 for item in self.items:
122 item.sprite.allow_dest_offset = True #XXX 122 item.sprite.allow_dest_offset = True #XXX
123 123
124 self.level_start = [Text((176, 200), ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location. 124 self.level_start = [Text((176, 200), self.ascii_wrapper, text='STAGE %d' % game.stage)] #TODO: find the exact location.
125 self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120) 125 self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120)
126 self.level_start[0].set_color('yellow') 126 self.level_start[0].set_color('yellow')
127 #TODO: use the system text for the stage name, and the song name. 127 #TODO: use the system text for the stage name, and the song name.
128 128
129 self.labels = { 129 self.labels = {
130 'highscore': Text((500, 58), ascii_wrapper, front, text='0'), 130 'highscore': Text((500, 58), self.ascii_wrapper, front, text='0'),
131 'score': Text((500, 82), ascii_wrapper, front, text='0'), 131 'score': Text((500, 82), self.ascii_wrapper, front, text='0'),
132 'player': Counter((500, 122), front, front, script=16, value=0), 132 'player': Counter((500, 122), front, front, script=16, value=0),
133 'bombs': Counter((500, 146), front, front, script=17, value=0), 133 'bombs': Counter((500, 146), front, front, script=17, value=0),
134 'power': Text((500, 186), ascii_wrapper, front, text='0'), 134 'power': Text((500, 186), self.ascii_wrapper, front, text='0'),
135 'graze': Text((500, 206), ascii_wrapper, front, text='0'), 135 'graze': Text((500, 206), self.ascii_wrapper, front, text='0'),
136 'points': Text((500, 226), ascii_wrapper, front, text='0'), 136 'points': Text((500, 226), self.ascii_wrapper, front, text='0'),
137 'framerate': Text((512, 464), ascii_wrapper, front), 137 'framerate': Text((512, 464), self.ascii_wrapper, front),
138 'debug?': Text((0, 464), ascii_wrapper, front), 138 'debug?': Text((0, 464), self.ascii_wrapper, front),
139 139
140 # Only when there is a boss. 140 # Only when there is a boss.
141 'boss_lives': Text((80, 16), ascii_wrapper), 141 'boss_lives': Text((80, 16), self.ascii_wrapper),
142 'timeout': Text((384, 16), ascii_wrapper), 142 'timeout': Text((384, 16), self.ascii_wrapper),
143 } 143 }
144 self.labels['boss_lives'].set_color('yellow') 144 self.labels['boss_lives'].set_color('yellow')
145 145
146 self.boss_items = [ 146 self.boss_items = [
147 Effect((0, 0), 19, front), # Enemy 147 Effect((0, 0), 19, front), # Enemy