Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/MAFH2/MafhActivity.py
blob: 584d83db5d57797538108c6361ccf4c36357e351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
from fortuneengine.GameEngine import GameEngine
from MafhGameMenu import GameMenuHolder
from constants import MENU_PATH, FMC_PATH, TOUR_PATH

from Comic import Comic
from Profile import Profile
from MafhGameManager import MafhGameManager

ge = GameEngine(width=1200, height=900, always_draw=True, fps_cap=15)

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()