Ejemplo n.º 1
0
    def __init__(self, graphicsEngine):
        self.graphicsEngine = graphicsEngine
        self.state = GUI_STATS

        self.background = pygame.image.load(g.dataPath + '/gui/bg_ingame.png')
        g.guiSurface.blit(self.background, (0, 0))

        # events
        self.pressedKeys = []

        # inventory boxes
        self.inventoryBoxes = []
        for y in range(0, 3):
            for x in range(0, 3):
                self.inventoryBoxes.append(pygame.Rect((524 + x*(66+24) + 1, 90 + y*(66+24) + 1, 64, 64)))

        self.emptySlotSurface = pygame.image.load(g.dataPath + '/gui/empty_slot.png').convert_alpha()

        # spellbook boxes
        # inventory boxes
        self.spellbookBoxes = []
        for y in range(0, 3):
            for x in range(0, 3):
                self.spellbookBoxes.append(pygame.Rect((524 + x*(66+24) + 1, 90 + y*(66+24) + 1, 64, 64)))

        # inventory tooltip
        self.tooltipRect = pygame.Rect((0, 0, 128, 64))

        # game GUIs
        self.mapEditorGUI = MapEditorGUI(g.guiSurface)
        self.itemEditorGUI = ItemEditorGUI(g.guiSurface)
        self.spellEditorGUI = SpellEditorGUI(g.guiSurface)
        self.npcEditorGUI = NPCEditorGUI(g.guiSurface)

        # GUI
        self.app = gui.App()

        self.guiContainer = GUIContainer(self, align=-1, valign=-1)
        self.guiContainer.updateEngines()

        self.app.init(self.guiContainer)

        # dialogs
        self.quitDialog = QuitDialog()

        # dirty
        self.isDirty = True

        # init
        self.itemSprites = []
        self.spellSprites = []
        self.loadSprites()