Example #1
0
 def render(self, console: Console) -> None:
     console.draw_frame(0, 40, self.menu_width,self.menu_height,"MENU", True)
Example #2
0
    def render_playerinfo(self,
                          console: Console,
                          gui_x: int,
                          gui_y: int,
                          draw_frame: bool = False) -> None:
        """
        Handles the GUI about players status.
        """
        render_character_name(console=console,
                              x=gui_x,
                              y=gui_y,
                              character=self.player)

        render_health_bar(
            console=console,
            x=gui_x,
            y=gui_y + 2,
            current_value=self.player.status.hp,
            maximum_value=self.player.status.max_hp,
            total_width=26,
        )

        render_mana_bar(
            console=console,
            x=gui_x,
            y=gui_y + 3,
            current_value=self.player.status.mp,
            maximum_value=self.player.status.max_mp,
            total_width=26,
        )

        render_character_status(console=console,
                                x=gui_x,
                                y=gui_y + 5,
                                character=self.player)

        render_character_state(console=console,
                               x=gui_x,
                               y=gui_y + 14,
                               character=self.player)

        if draw_frame:
            # If the border goes across the game screen it will not be displayed.
            # TODO: Most of the values are hard-coded.

            # border for status gui
            console.draw_frame(x=gui_x - 1,
                               y=gui_y - 1,
                               width=28,
                               height=15,
                               title="Player Status",
                               clear=False,
                               fg=(255, 255, 255),
                               bg=(0, 0, 0))
            # border for state gui
            console.draw_frame(x=gui_x - 1,
                               y=gui_y + 14,
                               width=28,
                               height=8,
                               title="Status Effect",
                               clear=False,
                               fg=(255, 255, 255),
                               bg=(0, 0, 0))