def _render_lines(self): """ Render the lines which make up the structure of the pokedex. """ libtcod.console_set_default_foreground(self.console, settings.POKEDEX_LINE_COLOR) libtcod.console_hline(self.console, 0, PokedexRenderer.header_height, PokedexRenderer.width) for i in range(PokedexRenderer.column_width, PokedexRenderer.width, PokedexRenderer.column_width): libtcod.console_vline(self.console, i, PokedexRenderer.header_height + 1, PokedexRenderer.column_height)
def render_bar(panel, x, y, total_width, name, value, maximum, bar_color, back_color): bar_width = int(float(value) / maximum * total_width) tc.console_set_default_background(panel, back_color) tc.console_rect(panel, x + 16, y + 1, total_width, 1, False, tc.BKGND_SCREEN) tc.console_set_default_background(panel, bar_color) if bar_width > 0: tc.console_rect(panel, x + 16, y + 1, bar_width, 1, False, tc.BKGND_SCREEN) panel.default_fg = tc.white tc.console_print_ex(panel, int(x + total_width / 2) + 16, y + 1, tc.BKGND_NONE, tc.CENTER, '{0}: {1}/{2}'.format(name, value, maximum)) tc.console_hline(panel, x - 1, y - 1, 133) tc.console_hline(panel, x - 1, y + 8, 133) tc.console_vline(panel, x + 37, y, 8)
def draw_inventory(con, inv: CInventory): i_w, i_h = 19, 20 i_x = (gv.map_width - i_w - 2) // 2 i_y = (gv.map_height - i_h - 2) // 2 libtcod.console_rect(con, 1, 1, i_w, i_h, True) # print tabs libtcod.console_print( con, 1, 1, ' A ' + chr(179) + ' C ' + chr(179) + ' E ' + chr(179) + ' G ' + chr(179) + ' Q ') libtcod.console_hline(con, 1, 2, -1 + inv.x * 4) libtcod.console_put_char(con, inv.x * 4, 2, 217) libtcod.console_put_char(con, (inv.x + 1) * 4, 2, 192) libtcod.console_hline(con, (inv.x + 1) * 4 + 1, 2, 20 - (inv.x + 1) * 4) libtcod.console_put_char(con, 0, 0, 218) libtcod.console_hline(con, 1, 0, 20) libtcod.console_put_char(con, 1 + i_w, 0, 191) libtcod.console_vline(con, 0, 1, 20) libtcod.console_vline(con, 1 + i_w, 1, 20) libtcod.console_put_char(con, 0, 1 + i_h, 192) libtcod.console_hline(con, 1, 1 + i_h, 20) libtcod.console_put_char(con, 1 + i_w, 1 + i_h, 217) i = 0 s = "" for item in inv.items: if item.type in inv.tabs[inv.x]: if i == inv.y: libtcod.console_set_default_foreground(con, libtcod.green) if item.equipped: s = "(E)" else: s = "" libtcod.console_print(con, 1, 3 + i, "{0:15} {1}".format(item.me.name, s)) libtcod.console_set_default_foreground(con, libtcod.white) i += 1 libtcod.console_blit(con, -i_x, -i_y, i_w + i_x + 2, i_h + i_y + 2, 0, 0, 0)
def test_console_lines(console): libtcodpy.console_hline(console, 0, 0, 4) libtcodpy.console_vline(console, 0, 0, 4)
def _render_lines(self): """ Renders the lines which separate sections of the screen. """ libtcod.console_set_default_foreground(self.console, settings.LINE_COLOR) libtcod.console_hline(self.console, 0, BattleRenderer.top_section_height, settings.SCREEN_WIDTH)
def hline(self, x, y, length, flag=tcod.BKGND_NONE): tcod.console_hline(self._c, x, y, length, flag)