Mercurial > sypikslang
view gamelib/main.py @ 80:a40a76012bd7
Refactor message handling so we can deal with in the gui
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Wed, 09 May 2012 12:08:44 +0200 |
parents | a253fae32a6f |
children | 74ce25ec2073 |
line wrap: on
line source
'''Game main module. Contains the entry point used by the run_game.py script. Feel free to put all your game code here, or in other modules in this "gamelib" package. ''' import pygame import optparse import sys from gamelib.engine import Engine from gamelib.mainmenu import MainMenu from gamelib.constants import SCREEN, FREQ, BITSIZE, CHANNELS, BUFFER def parse_args(args): parser = optparse.OptionParser() parser.add_option('--no-sound', action="store_false", default=True, dest="sound", help="disable sound") return parser.parse_args(args) def main(): opts, args = parse_args(sys.argv) pygame.display.init() pygame.font.init() if opts.sound: pygame.mixer.init(FREQ, BITSIZE, CHANNELS, BUFFER) screen = pygame.display.set_mode(SCREEN) engine = Engine(screen) window = MainMenu(screen) engine.run(window)