added roc_main.py
This commit is contained in:
parent
deaa55d535
commit
ba7492dd28
1 changed files with 64 additions and 0 deletions
64
roc_main.py
Executable file
64
roc_main.py
Executable file
|
@ -0,0 +1,64 @@
|
|||
import pygame
|
||||
from pygame.locals import *
|
||||
import gamedata
|
||||
import gametimer
|
||||
import video
|
||||
import shader
|
||||
import inputs
|
||||
import models
|
||||
from OpenGL.GL import *
|
||||
|
||||
def test_frame():
|
||||
# pink triangle
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 0.0, 0.5, 1.0)
|
||||
glVertex3f( 20.0, 50.0, 1.0)
|
||||
glVertex3f( 20.0, 600.0, 1.0)
|
||||
glVertex3f( 400.0, 50.0, 1.0)
|
||||
glEnd()
|
||||
|
||||
# yellow square
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 1.0, 0.0, 1.0)
|
||||
glVertex3f( 150.0, 20.0, -50.0)
|
||||
glVertex3f( 150.0, 400.0, -50.0)
|
||||
glVertex3f( 360.0, 20.0, -50.0)
|
||||
glVertex3f( 360.0, 400.0, -50.0)
|
||||
glEnd()
|
||||
|
||||
# texture test
|
||||
mdl = models.mgr.create("m_test")
|
||||
mdl.render()
|
||||
|
||||
|
||||
|
||||
def mainloop():
|
||||
|
||||
gametimer.start_loop()
|
||||
while True:
|
||||
events = pygame.event.get()
|
||||
gametimer.next_frame()
|
||||
pygame.event.pump()
|
||||
for ev in events:
|
||||
if ev.type == QUIT:
|
||||
inputs.add_command('exit')
|
||||
break
|
||||
elif ev.type == KEYUP:
|
||||
inputs.keyup(ev.key)
|
||||
elif ev.type == KEYDOWN:
|
||||
inputs.keydown(ev.key)
|
||||
#elif ev.type == VIDEOEXPOSE:
|
||||
# video.force_redraw()
|
||||
elif ev.type in (MOUSEBUTTONDOWN, MOUSEBUTTONUP):
|
||||
pass
|
||||
|
||||
if 'exit' in inputs.commands:
|
||||
break
|
||||
|
||||
video.predraw()
|
||||
|
||||
test_frame()
|
||||
|
||||
video.next_frame()
|
Loading…
Add table
Reference in a new issue