This repository has been archived on 2019-12-09. You can view files and clone it, but cannot push or open issues or pull requests.
pacman2/engine/servers/graphics.py

24 lines
649 B
Python
Raw Normal View History

2019-11-23 10:46:25 +01:00
from .server import Server
from pygame import display
class GraphicsServer(Server):
def __init__(self, size=(640, 480)):
super().__init__()
display.init()
self.window = display.set_mode(size)
def register_component(self, component):
super().register_component(component)
self._components.sort(key=lambda e: e.z)
def step(self):
for component in self._components:
self.window.blit(component.surf,
(component.parent.x, component.parent.y))
display.flip()
def resize(self, new_size):
self.window = display.set_mode(new_size)