Mercurial > sypikslang
annotate 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 |
rev | line source |
---|---|
53
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
3 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
4 """Gui for the actual game""" |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
5 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
6 from gamelib.gui_base import Window |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
7 from gamelib.gui import BigButton |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
8 from gamelib.engine import PopWindow |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
9 from gamelib.constants import WIDTH |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
10 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
11 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
12 class ExitGameButton(BigButton): |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
13 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
14 def __init__(self): |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
15 super(ExitGameButton, self).__init__(((WIDTH - 128), 10), 'Exit') |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
16 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
17 def on_click(self): |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
18 PopWindow.post() |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
19 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
20 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
21 class GameWindow(Window): |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
22 """Main window for the game""" |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
23 |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
24 def __init__(self, screen): |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
25 super(GameWindow, self).__init__(screen) |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
26 exit = ExitGameButton() |
655a6912e0ae
Split gui stuff out of main.py
Neil Muller <drnlmuller@gmail.com>
parents:
diff
changeset
|
27 self.add_child(exit) |