From 4168e9307ee78634e1bf7e945ab661204a91d9a0 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 11 May 2014 16:21:52 +0200 Subject: [PATCH] Display a blank window --- naja/__main__.py | 10 +++++++++- naja/engine.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 naja/engine.py 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() -- 2.34.1