view gamelib/main.py @ 42:498e4732bc1f

Auto-convert unix / http path separators to platform appropriate ones -- we should now just be able to use slash as the path separator through-out our own code.
author Simon Cross <hodgestar@gmail.com>
date Mon, 31 Aug 2009 16:48:47 +0000
parents 5d58a5b13731
children 2afdccfb9c67
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
from pgu import gui
from pygame.locals import SWSURFACE

from mainmenu import MainMenu
from engine import Engine, MainMenuState
import constants

def create_menu_app():
    """Create the menu app."""
    app = gui.App()
    main_menu = MainMenu()

    c = gui.Container(align=0, valign=0)
    c.add(main_menu, 0, 0)

    app.init(c)
    return app

def main():
    """Main script."""
    screen = pygame.display.set_mode(constants.SCREEN, SWSURFACE)
    main_menu_app = create_menu_app()
    engine = Engine(main_menu_app)
    engine.run(MainMenuState(engine), screen)