Source

Fat x Fast / FatxFast / gui / hud / hud.py

from FatxFast.gui.hud.frame import Frame
from FatxFast.gui.hud.globalhud import GlobalHud
from FatxFast.gui.hud.gameframe import GameFrame
from FatxFast.gui.boxwidget import BoxWidget
from FatxFast.graphics import SCREENSIZE
from FatxFast.tilemap.editor.tile import TILEWIDTH, TILEHEIGHT
from FatxFast.gui.hud.minimapframe import MiniMapFrame
from FatxFast.gui.hud.innerhud import InnerHud

class GameHud(Frame):
    
    def __init__(self, game, **kwargs):
        super(GameHud, self).__init__(game, **kwargs)
        self.game.add_widget("game", self)
        self._hud = GlobalHud(game,**self.fetch_template("gamebar"))
        self.add_widget("global-hud", self._hud)
        self._mmap = MiniMapFrame(game, **self.fetch_template("minimap"))
        self.add_widget("minimap", self._mmap)
        self._inner_hud = InnerHud(game, **self.fetch_template("innerhud"))
        self.add_widget("innerhud", self._inner_hud)

    def add_player(self, player, camera):
        self._inner_hud.add_player(player, camera)
        if len(self.game.players) > 1 and not self._mmap.flipped:
            self._mmap.toggle_position()

    def remove_players(self):
        self._inner_hud.remove_players()