Ejemplo n.º 1
0
    def object_destroyed(self, obj):
        obj.destroyed = True

        if (obj.target):
            self.targets -= 1

        self.score += obj.score

        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        glLoadIdentity()

        controller = GLController.get_instance()

        default_perspective(controller.width(), controller.height())

        self.level.camera.put_in_position()

        pos = map(int, gluProject(*obj.shape.position)[0:2])
        pos[1] = controller.height() - pos[1]

        glPopMatrix()

        controller.push_screen('MovingMessage', 'Show_Score',
                               '+' + str(obj.score), pos)
Ejemplo n.º 2
0
    def draw(self):
        default_perspective(self.controller.width(), self.controller.height())

        self.camera.put_in_position()

        if (self.has_skybox):
            self.draw_skybox(self.camera.pos)

        for obj in self.all_objects():
            obj.draw()
Ejemplo n.º 3
0
    def draw(self):
        default_perspective(self.controller.width(), self.controller.height())
        
        self.camera.put_in_position()
        
        if (self.has_skybox):
            self.draw_skybox(self.camera.pos)

        for obj in self.all_objects():
            obj.draw()
Ejemplo n.º 4
0
 def object_destroyed(self, obj):
     obj.destroyed = True
     
     if (obj.target):
         self.targets -= 1
     
     self.score += obj.score
            
     glMatrixMode(GL_MODELVIEW)
     glPushMatrix()
     glLoadIdentity()
     
     controller = GLController.get_instance()
     
     default_perspective(controller.width(), controller.height())
     
     self.level.camera.put_in_position()
     
     pos = map(int, gluProject(*obj.shape.position)[0:2])
     pos[1] = controller.height() - pos[1]
     
     glPopMatrix()
     
     controller.push_screen('MovingMessage','Show_Score','+'+str(obj.score),pos)
Ejemplo n.º 5
0
 def setup_projection(self):
     default_perspective(
         self.view_w, self.view_h,
         self.view_x, self.view_y
     )
Ejemplo n.º 6
0
 def resizeGL(self, width, height):
     QGLWidget.resizeGL(self,width,height)
     default_perspective(width, height)
     
     self.mouse_center = (width / 2, height / 2)