Esempio n. 1
0
import sys, pygame
from gui import GUI
import windows.game_window

RESOLUTION = pygame.Rect(0, 0, 800, 600)
BG_COLOR = (32, 32, 32)

# Initialize everything
#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)