Mercurial > rinkhals
annotate gamelib/mainmenu.py @ 5:67b79658b047
Refactor and simplify menu.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 13:04:24 +0000 |
parents | e8ddbc95cbf3 |
children | c0abad23a055 |
rev | line source |
---|---|
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
1 """Main menu.""" |
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
2 |
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
3 from pgu import gui |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
4 import pygame |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
5 import constants |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
6 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
7 class MainMenu(gui.Table): |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
8 def __init__(self,**params): |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
9 gui.Table.__init__(self,**params) |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
10 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
11 def fullscreen_changed(btn): |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
12 pygame.display.toggle_fullscreen() |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
13 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
14 fg = (255,255,255) |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
15 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
16 self.tr() |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
17 self.td(gui.Label(constants.NAME, color=fg), colspan=2) |
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
18 |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
19 self.tr() |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
20 self.td(gui.Label("Start", color=fg), align=1) |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
21 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
22 btn = gui.Switch(value=False,name='fullscreen') |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
23 btn.connect(gui.CHANGE, fullscreen_changed, btn) |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
24 |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
25 self.tr() |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
26 self.td(gui.Label("Full Screen: ",color=fg),align=1) |
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
27 self.td(btn) |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
28 |
4
e8ddbc95cbf3
Silly (and broken) first stab at menu thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
29 self.tr() |
5
67b79658b047
Refactor and simplify menu.
Simon Cross <hodgestar@gmail.com>
parents:
4
diff
changeset
|
30 self.td(gui.Label("Quit", color=fg), align=1) |