Mercurial > boomslang
annotate gamelib/main.py @ 106:da547e148532
Some (slightly) better cursor handling.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 24 Aug 2010 13:53:49 +0200 |
parents | 65976205fc2d |
children | 5213b45fcc7e |
rev | line source |
---|---|
0
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
1 '''Game main module. |
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
2 |
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
3 Contains the entry point used by the run_game.py script. |
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
4 |
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
5 ''' |
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
6 |
102 | 7 # Albow looks for stuff in os.path[0], which isn't always where it expects. |
8 # The following horribleness fixes this. | |
9 import sys | |
10 import os.path | |
11 right_path = os.path.dirname(os.path.dirname(__file__)) | |
12 sys.path.insert(0, right_path) | |
13 | |
17 | 14 import pygame |
37 | 15 from pygame.locals import SWSURFACE |
17 | 16 from albow.dialogs import alert |
17 from albow.shell import Shell | |
26
0a68d137f509
Initial inventory palette thing.
Jeremy Thurgood <firxen@gmail.com>
parents:
25
diff
changeset
|
18 |
17 | 19 from menu import MenuScreen |
24
9d5de13e2ac3
Add a game screen. So far, the game content looks a *lot* like the main menu.
Jeremy Thurgood <firxen@gmail.com>
parents:
20
diff
changeset
|
20 from gamescreen import GameScreen |
105
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
102
diff
changeset
|
21 from constants import SCREEN, FRAME_RATE |
17 | 22 |
23 class MainShell(Shell): | |
24 def __init__(self, display): | |
25 Shell.__init__(self, display) | |
26 self.menu_screen = MenuScreen(self) | |
24
9d5de13e2ac3
Add a game screen. So far, the game content looks a *lot* like the main menu.
Jeremy Thurgood <firxen@gmail.com>
parents:
20
diff
changeset
|
27 self.game_screen = GameScreen(self) |
105
65976205fc2d
Rough Stab at basic animation support
Neil Muller <neil@dip.sun.ac.za>
parents:
102
diff
changeset
|
28 self.set_timer(FRAME_RATE) |
17 | 29 self.show_screen(self.menu_screen) |
30 | |
0
f2c3b516741b
Theme is 'Caught'. Start with Skellington 1.9.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
diff
changeset
|
31 def main(): |
25
f9e697e0c6ba
Don't initialise the entire pygame
Stefano Rivera <stefano@rivera.za.net>
parents:
24
diff
changeset
|
32 pygame.display.init() |
f9e697e0c6ba
Don't initialise the entire pygame
Stefano Rivera <stefano@rivera.za.net>
parents:
24
diff
changeset
|
33 pygame.font.init() |
37 | 34 display = pygame.display.set_mode(SCREEN, SWSURFACE) |
17 | 35 shell = MainShell(display) |
36 shell.run() | |
37 |