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)
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()
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)
def setup_projection(self): default_perspective( self.view_w, self.view_h, self.view_x, self.view_y )
def resizeGL(self, width, height): QGLWidget.resizeGL(self,width,height) default_perspective(width, height) self.mouse_center = (width / 2, height / 2)