Display a blank window
authorStefano Rivera <stefano@rivera.za.net>
Sun, 11 May 2014 14:21:52 +0000 (16:21 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Sun, 11 May 2014 14:21:52 +0000 (16:21 +0200)
naja/__main__.py
naja/engine.py [new file with mode: 0644]

index 1a5050b7abf39ec221870957c370615bb0029c81..cd53e4a3667e37bb0f7fe98a40934dcdc26eefd8 100644 (file)
@@ -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 (file)
index 0000000..d509ec2
--- /dev/null
@@ -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()