blob: 69494d76a793de54d68e7f3d19ccdd6fc44b9b96 (
plain) (
tree)
|
|
import pygame
import pydub
import sys
import helpers
pygame.mixer.pre_init(frequency = 44100)
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))
helpers.parse_config()
for key_name in helpers.Mapping.KEYS:
key = helpers.Mapping.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.Mapping.KEYS:
helpers.Mapping.KEYS[event.key].do_actions()
if event.type == pygame.MOUSEBUTTONUP:
for key in helpers.Mapping.KEYS:
if helpers.Mapping.KEYS[key].collidepoint(pygame.mouse.get_pos()):
helpers.Mapping.KEYS[key].do_actions()
pygame.display.flip()
|