Esempio n. 1
0
 def enable(self):
     if self.gl_light is not None:
         x, y, z = self.transform.position
         gl_position = (x, y, -z, int(not self.directional))
         OpenGLRenderer.enablelight(self.gl_light, self.ambient,
                                    self.diffuse, self.specular,
                                    self.spot_direction, gl_position)
Esempio n. 2
0
 def _renderloop(self):
     OpenGLRenderer.clearscreen()
     if GameObject._camera: GameObject._camera.push()
     for light in GameObject._lights: light.enable()
     map(GameObject.render, GameObject._gameobjects)
     if GameObject._camera: GameObject._camera.pop()
     OpenGLRenderer.flip()
Esempio n. 3
0
 def enable(self):
     if self.gl_light is not None:
         x, y, z = self.transform.position
         gl_position = (x, y, -z, int(not self.directional))
         OpenGLRenderer.enablelight(self.gl_light, self.ambient,
                                    self.diffuse, self.specular,
                                    self.spot_direction, gl_position)
Esempio n. 4
0
 def _renderloop(self):
     OpenGLRenderer.clearscreen()
     if GameObject._camera: GameObject._camera.push()
     for light in GameObject._lights:
         light.enable()
     map(GameObject.render, GameObject._gameobjects)
     if GameObject._camera: GameObject._camera.pop()
     OpenGLRenderer.flip()
Esempio n. 5
0
 def mainloop(self, fps=60):
     """
     Starts the mainloop of the game
     """
     OpenGLRenderer.init(self.screen_size, self.fullscreen)
     OpenGLRenderer.set_window_title(self.title)        
     OpenGLRenderer.set_window_icon(self.icon)
     try: self._mainloop(fps)
     finally: OpenGLRenderer.quit()
Esempio n. 6
0
 def __init__(self, ambient=(0, 0, 0, 1), diffuse=(1, 1, 1, 1),
              specular=(1, 1, 1, 1), spot_direction=(0, 0, 1)):
     Component.__init__(self)
     self.gl_light = OpenGLRenderer.getnextlight()
     self.ambient = ambient
     self.diffuse = diffuse
     self.specular = specular
     self.spot_direction = spot_direction + (0,)
     self.directional = False
Esempio n. 7
0
 def mainloop(self, fps=60):
     """
     Starts the mainloop of the game
     """
     OpenGLRenderer.init(self.screen_size, self.fullscreen)
     OpenGLRenderer.set_window_title(self.title)
     OpenGLRenderer.set_window_icon(self.icon)
     try:
         self._mainloop(fps)
     finally:
         OpenGLRenderer.quit()
Esempio n. 8
0
 def __init__(self,
              ambient=(0, 0, 0, 1),
              diffuse=(1, 1, 1, 1),
              specular=(1, 1, 1, 1),
              spot_direction=(0, 0, 1)):
     Component.__init__(self)
     self.gl_light = OpenGLRenderer.getnextlight()
     self.ambient = ambient
     self.diffuse = diffuse
     self.specular = specular
     self.spot_direction = spot_direction + (0, )
     self.directional = False
Esempio n. 9
0
 def render(self):
     OpenGLRenderer.render(self)
Esempio n. 10
0
 def disable(self):
     if self.gl_light is not None:
         OpenGLRenderer.disable(self.gl_light)
Esempio n. 11
0
 def render(self):
     OpenGLRenderer.render(self)
Esempio n. 12
0
 def disable(self):
     if self.gl_light is not None:
         OpenGLRenderer.disable(self.gl_light)