Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/MAFH2/MafhGameManager.py
blob: 58197c2044b239fc699275f5f2a1725e95065ad2 (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
import pygame

from fortuneengine.GameEngineElement import GameEngineElement

from TermBox import TermBox
from Dungeon import Dungeon

class MafhGameManager(GameEngineElement):
    def __init__(self):
        GameEngineElement.__init__(self, has_draw=False, has_event=True)
        self.add_to_engine()

        game_size_ratio_x = self.game_engine.width/1200.0
        game_size_ratio_y = self.game_engine.height/900.0

        term_width_offset = game_size_ratio_x * 200
        term_height = game_size_ratio_y * 200
        term_height_offset = game_size_ratio_y * 700
        term_width = game_size_ratio_x * 1000

        """
        term_width_offset = self.game_engine.width/4
        term_height = self.game_engine.height/6
        term_height_offset = self.game_engine.height - term_height
        term_width = self.game_engine.width - term_width_offset
        """

        self.game_engine.add_object('mesg', TermBox(term_width_offset, term_height_offset,term_width,term_height,5) )
        self.game_engine.get_object('mesg').add_line("Welcome to Fortune Hunter")

        self.game_engine.add_object('dungeon', Dungeon( self.game_engine.get_object('profile').dungeon_id))

    def event_handler(self, event):
        if event.type == pygame.KEYDOWN:
            newKey=pygame.key.name(event.key)

            if newKey=='escape':
                print "SHOW Pause Menu"
                return True