| 67 | glColor4f(0.0, 0.0, 0.0, 1.0) |
| 68 | |
| 69 | class Rectangle: |
| 70 | # (x, y) is the top left corner |
| 71 | def __init__(self, x, y, width, height): |
| 72 | self.left = x |
| 73 | self.right = x + width |
| 74 | self.top = y |
| 75 | self.bottom = y - height |
| 76 | |
| 77 | def move_down(self, amount): |
| 78 | self.top -= amount |
| 79 | self.bottom -= amount |
| 80 | |
| 81 | @property |
| 82 | def width(self): |
| 83 | return self.right - self.left |
| 84 | @property |
| 85 | def height(self): |
| 86 | return self.top - self.bottom |
| 87 | |
| 88 | @property |
| 89 | def center(self): |
| 90 | return [(self.left+self.right) / 2, (self.top+self.bottom) / 2] |
| 91 | |
| 92 | @property |
| 93 | def top_left(self): |
| 94 | return [self.left, self.top] |
| 95 | |
| 96 | def contains(self, x, y): |
| 97 | return self.left <= x <= self.right and self.top >= y >= self.bottom |
| 98 | |
| 99 | def get_inset_rectangle(self, border): |
| 100 | return Rectangle(self.left + border, self.top - border, self.width - 2*border, self.height - 2*border) |
| 101 | |
| 102 | def __repr__(self): |
| 103 | return "(Left: "+str(self.left)+", Right: "+str(self.right)+", Top: "+str(self.top)+", Bottom: "+str(self.bottom)+")" |
| 104 | |
| 105 | class Label: |
| 106 | def __init__(self): |
no outgoing calls
no test coverage detected