예제 #1
0
파일: box.py 프로젝트: TheoTomalty/colossus
class Box(Surface):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.button_bar = Surface(parent=self,
                                  position=(0,
                                            self.height - flags.square_size),
                                  size=(flags.bar_size, flags.square_size))
        self.body = Page(self)
        self.buttons = []

        for i in range(flags.bar_squares):
            self.buttons.append(
                Button(parent=self.button_bar,
                       position=(i * flags.square_size, 0)))

    def initialize(self):
        self.body.initialize()

        for button in self.buttons:
            button.print()

        self.button_bar.print()
        self.print()

    def mouse(self, coords, pressed=False):
        for button in self.buttons:
            if button.contains(coords):
                button.mouse(pressed=pressed)
            elif button.is_hovered or button.is_pressed:
                button.clear()
예제 #2
0
                ry = 0.0
            elif event.key == pygame.K_UP and rz < 0:
                rz = 0.0
            elif event.key == pygame.K_DOWN and rz > 0:
                rz = 0.0
            elif event.key == pygame.K_MINUS:
                sim.step(0.2)
                print(plane.position)
    
    #glPushMatrix()
    glLoadIdentity()
    glTranslatef(tx*1000, ty*1000, tz*1000)
    glRotatef(ry*1, 0, 1, 0)
    glRotatef(rz*1, 1, 0, 0)
    
    glMultMatrixf(view_mat)
    
    glGetFloatv(GL_MODELVIEW_MATRIX, view_mat)
    
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    #Pyramid()
    
    for piece in sim.pieces:
        piece.draw()
    
    airplane.draw()
    surface.print()
    #glPopMatrix()
    
    pygame.display.flip()