From: Stefano Rivera Date: Sun, 11 May 2014 14:21:52 +0000 (+0200) Subject: Display a blank window X-Git-Tag: 0.1~433 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=4168e9307ee78634e1bf7e945ab661204a91d9a0;p=naja.git Display a blank window --- diff --git a/naja/__main__.py b/naja/__main__.py index 1a5050b..cd53e4a 100644 --- a/naja/__main__.py +++ b/naja/__main__.py @@ -1,7 +1,10 @@ import sys import pygame +import pygame.locals as pgl +from naja.constants import SCREEN +from naja.engine import Engine from naja.options import parse_args @@ -11,4 +14,9 @@ def main(): pygame.display.init() pygame.font.init() - raise NotImplementedError("Sorry, we haven't written a game yet.") + pygame.display.set_mode(SCREEN, pgl.SWSURFACE) + pygame.display.set_caption('Naja') + + screen = pygame.display.get_surface() + engine = Engine(screen) + engine.run() diff --git a/naja/engine.py b/naja/engine.py new file mode 100644 index 0000000..d509ec2 --- /dev/null +++ b/naja/engine.py @@ -0,0 +1,15 @@ +import pygame +import pygame.locals as pgl + + +class Engine(object): + def __init__(self, surface): + self._surface = surface + + def run(self): + while True: + for ev in pygame.event.get(): + if ev.type == pgl.QUIT: + return + # TODO: work + pygame.display.flip()