Mercurial > touhou
comparison pytouhou/game/text.py @ 384:690b5faaa0e6
Make rendering of multiple-sprites elements work like single-sprites.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 02 Oct 2012 13:27:05 +0200 |
parents | f1649d6c6397 |
children | e1f5dcd4b83e |
comparison
equal
deleted
inserted
replaced
383:0537af9125a7 | 384:690b5faaa0e6 |
---|---|
64 anm_runner = ANMRunner(anm_wrapper, ref_script, self.ref_sprite) | 64 anm_runner = ANMRunner(anm_wrapper, ref_script, self.ref_sprite) |
65 anm_runner.run_frame() | 65 anm_runner.run_frame() |
66 self.ref_sprite.corner_relative_placement = True #TODO: perhaps not right | 66 self.ref_sprite.corner_relative_placement = True #TODO: perhaps not right |
67 | 67 |
68 | 68 |
69 def objects(self): | |
70 return self.glyphes | |
71 | |
72 | |
73 def set_length(self, length): | 69 def set_length(self, length): |
74 current_length = len(self.glyphes) | 70 current_length = len(self.glyphes) |
75 if length > current_length: | 71 if length > current_length: |
76 self.glyphes.extend(Glyph(copy(self.ref_sprite), | 72 self.glyphes.extend(Glyph(copy(self.ref_sprite), |
77 (self.x + self.xspacing * i, self.y)) | 73 (self.x + self.xspacing * i, self.y)) |
95 xspacing=xspacing, back_script=back_script) | 91 xspacing=xspacing, back_script=back_script) |
96 self.text = '' | 92 self.text = '' |
97 self.shift = shift | 93 self.shift = shift |
98 | 94 |
99 self.set_text(text) | 95 self.set_text(text) |
96 | |
97 | |
98 @property | |
99 def objects(self): | |
100 return self.glyphes + [self] | |
100 | 101 |
101 | 102 |
102 def set_text(self, text): | 103 def set_text(self, text): |
103 if text == self.text: | 104 if text == self.text: |
104 return | 105 return |
142 | 143 |
143 self.value = value | 144 self.value = value |
144 self.set_value(value) | 145 self.set_value(value) |
145 | 146 |
146 | 147 |
148 @property | |
149 def objects(self): | |
150 return [self] + self.glyphes | |
151 | |
152 | |
147 def set_value(self, value): | 153 def set_value(self, value): |
148 if value < 0: | 154 if value < 0: |
149 value = 0 | 155 value = 0 |
150 if value == self.value: | 156 if value == self.value: |
151 return | 157 return |
161 self.sprite = Sprite() | 167 self.sprite = Sprite() |
162 self.anmrunner = ANMRunner(anm_wrapper, 21, self.sprite) | 168 self.anmrunner = ANMRunner(anm_wrapper, 21, self.sprite) |
163 self.anmrunner.run_frame() | 169 self.anmrunner.run_frame() |
164 self.removed = False | 170 self.removed = False |
165 self.sprite.corner_relative_placement = True #TODO: perhaps not right | 171 self.sprite.corner_relative_placement = True #TODO: perhaps not right |
172 self.objects = [self] | |
166 | 173 |
167 self.x, self.y = pos | 174 self.x, self.y = pos |
168 self.max_length = max_length | 175 self.max_length = max_length |
169 self.maximum = maximum | 176 self.maximum = maximum |
170 | 177 |