-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshapes.py
More file actions
28 lines (23 loc) · 685 Bytes
/
shapes.py
File metadata and controls
28 lines (23 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from OpenGL.GL import *
class Rectangle:
def __init__(self, x, y, length, width):
self.left = x - length / 2
self.right = x + length / 2
self.top = y + width / 2
self.bottom = y - width / 2
self.x = x
self.y = y
def draw(self):
glLoadIdentity()
glBegin(GL_QUADS)
glVertex(self.left, self.bottom, 0) # Left - Bottom
glVertex(self.right, self.bottom, 0)
glVertex(self.right, self.top, 0)
glVertex(self.left, self.top, 0)
glEnd()
class Circle:
# noinspection PyShadowingNames
def __init__(self, x, y, r):
self.x = x
self.y = y
self.r = r