Matt Low
5dfd84a2f6
Moved rendering of separating axes to function Calculate overlaps instead of binary collision, write min distance to resolve collision
42 lines
734 B
Python
42 lines
734 B
Python
import pygame
|
|
from .math import sub
|
|
|
|
WIDTH = 1280
|
|
HEIGHT = 720
|
|
|
|
surface = None
|
|
screen = None
|
|
|
|
def init():
|
|
pygame.display.set_caption("Geom Demo")
|
|
pygame.mouse.set_visible(False)
|
|
pygame.key.set_repeat(500, 60)
|
|
global surface
|
|
global screen
|
|
|
|
surface = pygame.display.set_mode((WIDTH, HEIGHT))
|
|
|
|
from . import draw
|
|
draw.init()
|
|
|
|
from .screen import Screen
|
|
screen = Screen()
|
|
|
|
|
|
def loop():
|
|
for event in pygame.event.get(pygame.QUIT):
|
|
return False
|
|
|
|
surface.fill((0, 0, 0))
|
|
|
|
screen.render(surface)
|
|
|
|
pygame.display.update()
|
|
return True
|
|
|
|
def get_cursor_pos():
|
|
return sub(*pygame.mouse.get_pos(), WIDTH / 2, HEIGHT / 2)
|
|
|
|
def get_inputs():
|
|
return pygame.key.get_pressed()
|