-import tabakrolletjie.__main__
+from tabakrolletjie.main import main
+
if __name__ == "__main__":
- tabakrolletjie.__main__.main()
+ main()
-import yourgameshortname.main
+from tabakrolletjie.main import main
+
if __name__ == "__main__":
- yourgameshortname.main.main()
+ main()
+++ /dev/null
-
-def main():
- """ your app starts here
- """
+""" Engine for moving controll scenes and tranistions between them.
+"""
+
+import pygame.display
+import pygame.event
+import pygame.time
+
+import pygame.locals as pgl
+
+from .constants import FPS
+
+
+class Engine(object):
+ def __init__(self, screen, scene):
+ self._screen = screen
+ self._scene = scene
+
+ def run(self):
+ clock = pygame.time.Clock()
+
+ while True:
+ events = pygame.event.get()
+ for ev in events:
+ if ev.type == pgl.QUIT:
+ return
+ else:
+ pass # TODO: send to scene
+
+ # TODO: render scene
+ pygame.display.flip()
+
+ clock.tick(FPS)
--- /dev/null
+""" Run tabakrolletjie.
+"""
+
+import pygame
+import pygame.locals as pgl
+
+from .constants import SCREEN_SIZE, TITLE
+from .engine import Engine
+from .scenes.menu import MenuScene
+
+
+def main():
+ pygame.display.init()
+ pygame.font.init()
+
+ pygame.display.set_mode(SCREEN_SIZE, pgl.SWSURFACE)
+ pygame.display.set_caption(TITLE)
+ # TODO: set an icon
+
+ screen = pygame.display.get_surface()
+ scene = MenuScene()
+ engine = Engine(screen, scene)
+
+ engine.run()
+""" Menu scene. """
+
+class MenuScene(object):
+ pass