-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
114 lines (94 loc) · 1.86 KB
/
main.py
File metadata and controls
114 lines (94 loc) · 1.86 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
from settings import *
import pygame
pygame.init()
#window class
class Window:
def __init__(self, name : str, bg_color : Vector3, size : Vector2):
self.name = name
self.bg_color = bg_color
self.size = size
print("Testing Engine")
def update(self):
pass
def quit(self):
pygame.quit()
pygame.display.quit()
sys.exit()
size = Vector2(800,800)
bg_color = Vector3(0,0,0)
window = Window("test", bg_color, size)
running = True
keys = key.get_pressed()
#cube variables
vertices = (
(1, -1, -1),
(1, 1, -1),
(-1, 1, -1),
(-1, -1, -1),
(1, -1, 1),
(1, 1, 1),
(-1, -1, 1),
(-1, 1, 1)
)
edges = (
(0,1),
(0,3),
(0,4),
(2,1),
(2,3),
(2,7),
(6,3),
(6,4),
(6,7),
(5,1),
(5,4),
(5,7)
)
colors = (
(1,0,0),
(0,1,0),
(0,0,1),
(0,1,0),
(1,1,1),
(0,1,1),
(1,0,0),
(0,1,0),
(0,0,1),
(1,0,0),
(1,1,1),
(0,1,1),
)
surfaces = (
(0,1,2,3),
(3,2,7,6),
(6,7,5,4),
(4,5,1,0),
(1,5,7,2),
(4,0,3,6)
)
model = Model.Cube(vertices, edges, surfaces, colors)
help = Help()
#setup window
screen = display.set_mode(window.size, DOUBLEBUF|OPENGL) #create window variable
display.set_caption(window.name) #set window title
screen.fill(window.bg_color) #set window color
display.flip() #update display
#setup camera
gluPerspective(45, (size[0]/size[1]), 0.1, 50.0)
#setup cube
glTranslatef(0,0,-5)
while running:
keys = key.get_pressed()
window.update()
#rotate cube
glRotatef(1,3,1,1)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
model.create()
display.flip()
time.wait(10)
for event in pygame.event.get():
if keys[K_ESCAPE]:
window.quit()
# Check for QUIT event
if event.type == pygame.QUIT:
running = False