Exemplo n.º 1
0
def start_game():
    ge.add_object('manager', MafhGameManager() )

def menu_screen():
    ge.add_object('menu', GameMenuHolder( menu_called, MENU_PATH + "mafh_splash.gif", width=ge.width, height=ge.height))
    ge.get_object('menu').show_menu('title')

def menu_called(id, menu):
    if id == 'new':
        #ge.get_object('menu').remove_from_engine()
        menu.remove_from_engine()
        ge.remove_object('menu')

        if not ge.has_object('profile'):
            ge.add_object( 'profile',
                #Profile( name_entry_cb=lambda: ge.add_object('comic', Comic(FMC_PATH+"FMC1/",None,start_game)) ) )
                Profile( name_entry_cb=start_game  ))

    elif id == 'controls':
        menu.remove_from_engine()
        ge.remove_object('menu')
        ge.add_object('comic', Comic(TOUR_PATH+"setup/",None,menu_screen))
    else:
        print "MENU CALLED %s" % id

# Build menu and add to engine.  Then show menu
menu_screen()

# Start event loop
ge.start_main_loop()
Exemplo n.º 2
0
                  "--height",
                  dest="height",
                  help="window height",
                  metavar="HEIGHT",
                  default=480,
                  type="int")

parser.add_option("-f",
                  "--font",
                  dest="font",
                  help="font size",
                  metavar="SIZE",
                  default=20,
                  type="int")

parser.add_option("-d",
                  "--difficulty",
                  dest="difficulty",
                  help="difficulty level",
                  metavar="DIFFICULTY",
                  default=0,
                  type="int")

(opts, args) = parser.parse_args()

ge = GameEngine(width=opts.width, height=opts.height, always_draw=False)
ge.add_object('font', font.SysFont(font.get_default_font(), opts.font))
ge.add_object('main', LemonadeMain(opts.difficulty))
ge.add_object('gui', LemonadeGui())
ge.start_main_loop()