Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/states/MenuState.py
blob: 35074d5ba4c6854e158c255233aac403ff0b5f96 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import states.GameState
from states.GameState import CGameState
import api.MultiLabel
from api.MultiLabel import CMultiLabel
import api.Game
from api.Game import CGame
import api.Button
from api.Button import CButton
import states.CreditsState
from CreditsState import *
import api.Image as Image

import states.Area1Game1
from states.Area1Game1 import CArea1Game1

import pygame

class CMenuState(CGameState):
    
    mBackground = None
    mInstructions = None
    #mX = 10
    mButtonPlay = None
        
    #def __init__(self):
    #    '''
    #    Constructor
    #    '''
        
    def init(self):
        CGameState.init(self)
        self.mInstructions = CMultiLabel()
        CGame().addChild(self.mInstructions)
        #print self.mX
        
        self.mButtonPlay = CButton()
        #TODO: Create a function to create image.
        self.mButtonPlay.bgColor = (0x99, 0x99, 0x66)
        self.mButtonPlay.font = pygame.font.Font('assets/fonts/fipps.ttf', 20)
        self.mButtonPlay.center = (110, 420)
        self.mButtonPlay.size = (200, 40)  
        self.mButtonPlay.text = "JUGAR"
        CGame().addChild(self.mButtonPlay)
        
        self.mBackground = Image.loadImage('assets/images/back_menu.png', False)
        CGame().setBackground(self.mBackground)
        
    def update(self):
        #print "menu update"
        CGameState.update(self)
        
        if self.mButtonPlay.clicked:
            print "clicked menu"
            #cs = CHelpState()
            a1g1 = CArea1Game1()
            CGame().setState(a1g1)
        
    #def render(self):
    #    CGameState.render(self)
    #    print "CMenuState render"
        
    def destroy(self):
        CGameState.destroy(self)
        #self.mInstructions.destroy()
        self.mInstructions = None
        CGame().removeChild(self.mButtonPlay)
        #self.mButtonPlay.destroy()
        self.mButtonPlay = None
        self.mBackground = None
        print "CMenuState destroy"
        
    def doEvents(self, aEvent):
        print aEvent.type