2020-11-13 07:46:31 -07:00
|
|
|
import pygame
|
2020-11-14 10:15:47 -07:00
|
|
|
from .math import sub
|
2020-11-13 07:46:31 -07:00
|
|
|
|
|
|
|
WIDTH = 1280
|
|
|
|
HEIGHT = 720
|
|
|
|
|
|
|
|
surface = None
|
|
|
|
screen = None
|
|
|
|
|
|
|
|
def init():
|
|
|
|
pygame.display.set_caption("Geom Demo")
|
|
|
|
pygame.mouse.set_visible(False)
|
2020-11-14 10:15:47 -07:00
|
|
|
pygame.key.set_repeat(500, 60)
|
2020-11-13 07:46:31 -07:00
|
|
|
global surface
|
|
|
|
global screen
|
|
|
|
|
|
|
|
surface = pygame.display.set_mode((WIDTH, HEIGHT))
|
2020-11-14 10:15:47 -07:00
|
|
|
|
|
|
|
from . import draw
|
|
|
|
draw.init()
|
2020-11-13 07:46:31 -07:00
|
|
|
|
|
|
|
from .screen import Screen
|
|
|
|
screen = Screen()
|
|
|
|
|
|
|
|
|
|
|
|
def loop():
|
2020-11-14 10:15:47 -07:00
|
|
|
for event in pygame.event.get(pygame.QUIT):
|
2020-11-13 07:46:31 -07:00
|
|
|
return False
|
|
|
|
|
|
|
|
surface.fill((0, 0, 0))
|
|
|
|
|
|
|
|
screen.render(surface)
|
|
|
|
|
|
|
|
pygame.display.update()
|
|
|
|
return True
|
2020-11-14 10:15:47 -07:00
|
|
|
|
|
|
|
def get_cursor_pos():
|
|
|
|
return sub(*pygame.mouse.get_pos(), WIDTH / 2, HEIGHT / 2)
|
2020-11-14 13:24:44 -07:00
|
|
|
|
|
|
|
def get_inputs():
|
|
|
|
return pygame.key.get_pressed()
|