comparison pytouhou/games/eosd.py @ 322:4e8192aadcaa

Give a better interface for text handling.
author Thibaut Girka <thib@sitedethib.com>
date Thu, 24 May 2012 20:23:57 +0200
parents 61adb5453e46
children 2fcdb8966957
comparison
equal deleted inserted replaced
321:61adb5453e46 322:4e8192aadcaa
114 bullet_types, laser_types, item_types, nb_bullets_max, 114 bullet_types, laser_types, item_types, nb_bullets_max,
115 width, height, prng, interface) 115 width, height, prng, interface)
116 116
117 117
118 118
119 class EoSDInterface(Game): 119 class EoSDInterface(object):
120 def __init__(self, states, resource_loader): 120 def __init__(self, states, resource_loader):
121 self.states = states 121 self.states = states
122 front = resource_loader.get_anm_wrapper(('front.anm',)) 122 front = resource_loader.get_anm_wrapper(('front.anm',))
123 ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',)) 123 ascii_wrapper = resource_loader.get_anm_wrapper(('ascii.anm',))
124 124
135 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)]) 135 [Effect((0, 0), i, front) for i in range(5) + range(9, 16)])
136 for item in self.items: 136 for item in self.items:
137 item.sprite.allow_dest_offset = True #XXX 137 item.sprite.allow_dest_offset = True #XXX
138 138
139 self.labels = { 139 self.labels = {
140 'highscore': Text((500, 58), '0', front, ascii_wrapper), 140 'highscore': Text((500, 58), ascii_wrapper, front, text='0'),
141 'score': Text((500, 82), '0', front, ascii_wrapper), 141 'score': Text((500, 82), ascii_wrapper, front, text='0'),
142 'player': Text((500, 122), 'star star', front, ascii_wrapper), 142 'player': Text((500, 122), ascii_wrapper, front, text='TODO'),
143 'bombs': Text((500, 146), 'star star', front, ascii_wrapper), 143 'bombs': Text((500, 146), ascii_wrapper, front, text='TODO'),
144 'power': Text((500, 186), '0', front, ascii_wrapper), 144 'power': Text((500, 186), ascii_wrapper, front, text='0'),
145 'graze': Text((500, 206), '0', front, ascii_wrapper), 145 'graze': Text((500, 206), ascii_wrapper, front, text='0'),
146 'points': Text((500, 226), '0', front, ascii_wrapper), 146 'points': Text((500, 226), ascii_wrapper, front, text='0'),
147 'framerate': Text((512, 464), '', front, ascii_wrapper), 147 'framerate': Text((512, 464), ascii_wrapper, front),
148 'debug?': Text((0, 464), '', front, ascii_wrapper), 148 'debug?': Text((0, 464), ascii_wrapper, front),
149 } 149 }
150 150
151 151
152 def update(self): 152 def update(self):
153 for elem in self.items: 153 for elem in self.items: