Mercurial > mamba
view mamba/__main__.py @ 267:1e8dca95c48a
Hook up hot-keys in editor for jerith
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Thu, 15 Sep 2011 12:54:16 +0200 |
parents | bea4857487de |
children | fba74abad7b7 |
line wrap: on
line source
"""Main module for the game""" import sys import pygame from pygame.locals import SWSURFACE from mamba.constants import SCREEN, NAME from mamba.options import options, parse_args, check_args from mamba.engine import Engine from mamba.gamestate import load_state, load_levels from mamba.sound import SoundSystem from mamba.habitats.mainmenu import MainMenu from mamba.habitats.level import LevelHabitat from mamba.habitats.editor import EditorHabitat def main(): """Launch the currently unnamed mamab game""" parse_args(sys.argv) if not check_args(): sys.exit(1) SoundSystem(options.sound) pygame.display.init() pygame.font.init() pygame.display.set_mode(SCREEN, SWSURFACE) pygame.display.set_caption(NAME) load_state() load_levels() if options.edit: start = EditorHabitat(options.level) elif options.level is not None: start = LevelHabitat(options.level) else: start = MainMenu() engine = Engine() engine.set_habitat(start) engine.run() engine.set_habitat(None) # clear habitat