Mercurial > rinkhals
comparison gamelib/main.py @ 591:6b21b2140262 1.5.x
Merge r594 and r595 from trunk.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 28 Nov 2009 23:27:38 +0000 |
parents | 36e1939c732a |
children |
comparison
equal
deleted
inserted
replaced
588:e13f9380242b | 591:6b21b2140262 |
---|---|
10 | 10 |
11 import pygame | 11 import pygame |
12 from pgu import gui | 12 from pgu import gui |
13 from pygame.locals import SWSURFACE, SRCALPHA | 13 from pygame.locals import SWSURFACE, SRCALPHA |
14 | 14 |
15 #from engine import Engine, MainMenuState | 15 import sound |
16 from sound import init_sound | |
17 import constants | 16 import constants |
18 from config import config | 17 from config import config |
19 import data | 18 import data |
20 from misc import WarnDialog | 19 from misc import WarnDialog |
21 | 20 |
45 """Run some sanity checks, and complain if they fail""" | 44 """Run some sanity checks, and complain if they fail""" |
46 try: | 45 try: |
47 pygame.Surface((100, 100), flags=SRCALPHA) | 46 pygame.Surface((100, 100), flags=SRCALPHA) |
48 except Exception, e: | 47 except Exception, e: |
49 complaint_dialog("Unable to create a suitable screen, please check your display settings") | 48 complaint_dialog("Unable to create a suitable screen, please check your display settings") |
49 if sound.SOUND_INITIALIZED: | |
50 try: | |
51 sound.play_sound('silence.ogg') | |
52 sound.background_music('silence.ogg') | |
53 except pygame.error: | |
54 complaint_dialog('Error trying to play sound. Please run with --no-sound') | |
55 sound.stop_background_music() | |
50 | 56 |
51 def main(): | 57 def main(): |
52 """Main script.""" | 58 """Main script.""" |
53 config.configure(sys.argv[1:]) | 59 config.configure(sys.argv[1:]) |
54 init_sound() | 60 sound.init_sound() |
55 sanity_check() | 61 sanity_check() |
56 screen = pygame.display.set_mode(constants.SCREEN, SWSURFACE) | 62 screen = pygame.display.set_mode(constants.SCREEN, SWSURFACE) |
57 pygame.display.set_icon(pygame.image.load( | 63 pygame.display.set_icon(pygame.image.load( |
58 data.filepath('icons/foxassault24x24.png'))) | 64 data.filepath('icons/foxassault24x24.png'))) |
59 main_app = create_main_app(screen) | 65 main_app = create_main_app(screen) |