diff gamelib/gamegui.py @ 53:655a6912e0ae

Split gui stuff out of main.py
author Neil Muller <drnlmuller@gmail.com>
date Mon, 07 May 2012 22:10:26 +0200
parents
children 78dfd429b9a6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/gamegui.py	Mon May 07 22:10:26 2012 +0200
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4
+
+"""Gui for the actual game"""
+
+from gamelib.gui_base import Window
+from gamelib.gui import BigButton
+from gamelib.engine import PopWindow
+from gamelib.constants import WIDTH
+
+
+class ExitGameButton(BigButton):
+
+    def __init__(self):
+        super(ExitGameButton, self).__init__(((WIDTH - 128), 10), 'Exit')
+
+    def on_click(self):
+        PopWindow.post()
+
+
+class GameWindow(Window):
+    """Main window for the game"""
+
+    def __init__(self, screen):
+        super(GameWindow, self).__init__(screen)
+        exit = ExitGameButton()
+        self.add_child(exit)