aboutsummaryrefslogblamecommitdiff
path: root/run.py
blob: 88afaad2406eb3a9cbf8d32df3080895ffa92c82 (plain) (tree)












































                                                                           
import pygame
import sys
import helpers

pygame.init()

size = width, height = 1024, 600

screen = pygame.display.set_mode(size)
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((250, 250, 250))

for key_name in helpers.keys:
    key = helpers.keys[key_name]
    key.draw(background)

screen.blit(background, (0, 0))
pygame.display.flip()

contexts = [
    'normal'
]

context = 'normal'

while 1:
    event = pygame.event.wait()
    if event.type == pygame.QUIT or (
            event.type == pygame.KEYDOWN and 
            event.mod  == 4160 and
            event.key  == pygame.K_c):
        pygame.quit()
        sys.exit()

    if context == 'normal':
        if event.type == pygame.KEYDOWN and event.key in helpers.keys:
            helpers.keys[event.key].do_actions()
        if event.type == pygame.MOUSEBUTTONUP:
            for key in helpers.keys:
                if helpers.keys[key].collidepoint(pygame.mouse.get_pos()): 
                    helpers.keys[key].do_actions()

    pygame.display.flip()