Mercurial > pyntnclick
comparison tools/rect_drawer.py @ 321:e5f3a97ee812
Fix rect drawing bug
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sat, 28 Aug 2010 13:02:40 +0200 |
parents | c295b06b27f8 |
children | 0630a37cb371 |
comparison
equal
deleted
inserted
replaced
320:c295b06b27f8 | 321:e5f3a97ee812 |
---|---|
93 self.draw_toolbar = True | 93 self.draw_toolbar = True |
94 | 94 |
95 def find_intersecting_things(self): | 95 def find_intersecting_things(self): |
96 """Parse the things in the scene for overlaps""" | 96 """Parse the things in the scene for overlaps""" |
97 | 97 |
98 | |
99 def find_intersecting_rects(self, d): | 98 def find_intersecting_rects(self, d): |
100 """Find if any rect collections intersect""" | 99 """Find if any rect collections intersect""" |
101 # I loath N^X brute search algorithm's, but whatever, hey | 100 # I loath N^X brute search algorithm's, but whatever, hey |
102 if self.state.current_detail: | 101 if self.state.current_detail: |
103 scene = self.state.current_detail | 102 scene = self.state.current_detail |
182 self.state.current_scene.draw_background(surface) | 181 self.state.current_scene.draw_background(surface) |
183 if self.mode == 'draw' and self.start_pos and self.draw_rects: | 182 if self.mode == 'draw' and self.start_pos and self.draw_rects: |
184 rect = pygame.rect.Rect(self.start_pos[0], self.start_pos[1], | 183 rect = pygame.rect.Rect(self.start_pos[0], self.start_pos[1], |
185 self.end_pos[0] - self.start_pos[0], | 184 self.end_pos[0] - self.start_pos[0], |
186 self.end_pos[1] - self.start_pos[1]) | 185 self.end_pos[1] - self.start_pos[1]) |
186 rect.normalize() | |
187 frame_rect(surface, self.rect_color, rect, self.draw_thick) | 187 frame_rect(surface, self.rect_color, rect, self.draw_thick) |
188 if self.draw_rects: | 188 if self.draw_rects: |
189 for (col, rect) in self.rects: | 189 for (col, rect) in self.rects: |
190 frame_rect(surface, col, rect, self.rect_thick) | 190 frame_rect(surface, col, rect, self.rect_thick) |
191 if self.draw_images: | 191 if self.draw_images: |