Beispiel #1
0
#pygame.mixer.pre_init(22050, -16, 2, 512) # Small buffer for less sound lag
pygame.init()
pygame.display.set_caption("AOWCLONE")
main_gui = GUI(RESOLUTION)
main_gui.set_screen(windows.game_window.GameWindow())
clock = pygame.time.Clock()

# The main game loop
while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.display.quit()
            sys.exit()
        # End if q is pressed
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_q or event.key == pygame.K_ESCAPE:
                pygame.display.quit()
                sys.exit()
            else:
                main_gui.on_button_press(event)
        # Respond to clicks
        elif event.type == pygame.MOUSEBUTTONUP:
            main_gui.on_click(event)
    
    main_gui.update()
    main_gui.draw()
    pygame.display.flip()
    clock.tick(60)
    #~ print(clock.get_fps())