Mercurial > pyntnclick
comparison tools/rect_drawer.py @ 279:c67a4a4d78f6
Compensate for offset in rect_drawer
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Fri, 27 Aug 2010 22:12:03 +0200 |
parents | 75f4ee46ac58 |
children | 776bcf563ea0 |
comparison
equal
deleted
inserted
replaced
278:8e27efd331aa | 279:c67a4a4d78f6 |
---|---|
83 if self.state.current_detail: | 83 if self.state.current_detail: |
84 w, h = self.state.current_detail.get_detail_size() | 84 w, h = self.state.current_detail.get_detail_size() |
85 rect = pygame.rect.Rect(0, 0, w, h) | 85 rect = pygame.rect.Rect(0, 0, w, h) |
86 self.close_button.rect.midbottom = rect.midbottom | 86 self.close_button.rect.midbottom = rect.midbottom |
87 self.add(self.close_button) | 87 self.add(self.close_button) |
88 | 88 self.offset = (0, 0) |
89 else: | |
90 self.offset = (-self.state.current_scene.OFFSET[0], - self.state.current_scene.OFFSET[1]) | |
89 self.draw_rects = True | 91 self.draw_rects = True |
90 self.draw_things = True | 92 self.draw_things = True |
91 self.draw_images = True | 93 self.draw_images = True |
92 self.draw_toolbar = True | 94 self.draw_toolbar = True |
93 | 95 |
161 | 163 |
162 def print_objs(self): | 164 def print_objs(self): |
163 d = self._make_dict() | 165 d = self._make_dict() |
164 for (num, col) in enumerate(d): | 166 for (num, col) in enumerate(d): |
165 print 'Rect %d : ' % num | 167 print 'Rect %d : ' % num |
166 for r in d[col]: | 168 for rect in d[col]: |
169 r = rect.move(self.offset) | |
167 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) | 170 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) |
168 print | 171 print |
169 for i, image in enumerate(self.images): | 172 for i, image in enumerate(self.images): |
170 print 'Image %d' % i | 173 print 'Image %d' % i |
171 r = image.rect | 174 rect = image.rect |
175 r = rect.move(self.offset) | |
172 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) | 176 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) |
173 print | 177 print |
174 | 178 |
175 def image_load(self): | 179 def image_load(self): |
176 image_path= '%s/Resources/images/%s' % (script_path, self.state.current_scene.FOLDER) | 180 image_path= '%s/Resources/images/%s' % (script_path, self.state.current_scene.FOLDER) |