How to use the tcod.console_clear function in tcod

To help you get started, we’ve selected a few tcod examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eyeCube / Softly-Roguelike / src / rogue.py View on Github external
def render_gameArea(pc) :
    con = Rogue.map.render_gameArea(pc, view_x(),view_y(),view_w(),view_h() )
    libtcod.console_clear(con_game()) # WHY ARE WE DOING THIS?
    libtcod.console_blit(con, view_x(),view_y(),view_w(),view_h(),
                         con_game(), view_port_x(),view_port_y())
#@debug.printr
github adonutwithsprinklez / RoguelikeMe / src / DisplayClass.py View on Github external
quest_console, 0, 0, self.panelInfo["QuestScreen"][
                "ScreenWidth"], self.panelInfo["QuestScreen"]["ScreenHeight"],
            0, self.panelInfo["QuestScreen"]["StartX"], self.panelInfo["QuestScreen"]["StartY"])
        libtcod.console_blit(
            toast_console, 0, 0, self.panelInfo["ToastScreen"][
                "ScreenWidth"], self.panelInfo["ToastScreen"]["ScreenHeight"],
            0, self.panelInfo["ToastScreen"]["StartX"], self.panelInfo["ToastScreen"]["StartY"])

        # Update Panels
        libtcod.console_flush()

        # Clear Panels
        libtcod.console_clear(map_console)
        libtcod.console_clear(hud_console)
        libtcod.console_clear(quest_console)
        libtcod.console_clear(toast_console)
github Wolfenswan / RoguelikeTut-TCOD / rendering / render_main.py View on Github external
def render_map_screen(game, fov_map, debug=False):
    con = game.map_panel
    entities = game.entities

    # Render game map #
    tcod.console_clear(con)
    render_map_centered_on_player(game, con, fov_map, debug=debug)

    # Draw all entities #
    entities_in_render_order = sorted(entities, key=lambda x: x.render_order.value)
    for entity in entities_in_render_order:
        draw_entity(game, con, entity, fov_map, debug=debug)

    if game.state == GameStates.CURSOR_ACTIVE:
        draw_entity(game, con, game.cursor, fov_map, debug=debug)

    draw_console_borders(con ,color=colors.white)
    #game.con.blit(game.map_panel, width=cfg.MAP_SCREEN_WIDTH, height=cfg.MAP_SCREEN_HEIGHT)
    tcod.console_blit(con, 0, 0, cfg.MAP_SCREEN_WIDTH, cfg.MAP_SCREEN_HEIGHT, 0, 0, 0)
github ChadAMiller / roguelike-2019 / render_functions.py View on Github external
# Draw all entities in the list
    visible_entities = [e for e in game_map.entities if e.render_order != RenderOrder.INVISIBLE]
    entities_in_render_order = sorted(visible_entities, key=lambda x: x.render_order.value)

    for entity in entities_in_render_order:
        if game_state == GameStates.TARGETING and targeting_item.valid_target(mouse, fov_map, entity) and entity.distance(mouse.cx, mouse.cy) <= targeting_item.item.targeting_radius:
            libtcod.console_set_default_foreground(con, libtcod.darkest_red)
            libtcod.console_put_char(con, entity.x, entity.y, entity.char, libtcod.BKGND_NONE)
        else:
            draw_entity(con, entity, fov_map, game_map)

    libtcod.console_blit(con, 0, 0, screen_width, screen_height, 0, 0, 0)

    libtcod.console_set_default_background(panel, libtcod.black)
    libtcod.console_clear(panel)

    # Print the game messages, one at a time
    y = 1
    for message in message_log.messages:
        libtcod.console_set_default_foreground(panel, message.color)
        libtcod.console_print_ex(panel, message_log.x, y, libtcod.BKGND_NONE, libtcod.LEFT, message.text)
        y += 1

    render_bar(panel, 1, 1, bar_width, 'HP', player.fighter.hp, player.fighter.max_hp, libtcod.light_red, libtcod.darker_red)
    libtcod.console_print_ex(panel, 1, 3, libtcod.BKGND_NONE, libtcod.LEFT, '{}'.format(game_map.name))

    libtcod.console_set_default_foreground(panel, libtcod.light_gray)
    libtcod.console_print_ex(panel, 1, 0, libtcod.BKGND_NONE, libtcod.LEFT, get_names_under_mouse(mouse, game_map.entities, fov_map))

    libtcod.console_blit(panel, 0, 0, screen_width, panel_height, 0, 0, panel_y)
github eyeCube / Softly-Roguelike / orangio.py View on Github external
def update_render_text(self):
        tcod.console_clear(self.console)
        tcod.console_print_ex(
            self.console,0,0,
            tcod.BKGND_NONE,tcod.LEFT,
            self.text )
        self.blit_console()
github libtcod / python-tcod / examples / samples_libtcodpy.py View on Github external
def render_colors(first, key, mouse):
    global tc_cols, tc_dirr, tc_dirg, tc_dirb, tc_fast

    TOPLEFT = 0
    TOPRIGHT = 1
    BOTTOMLEFT = 2
    BOTTOMRIGHT = 3
    if first:
        libtcod.sys_set_fps(0)
        libtcod.console_clear(sample_console)
        tc_fast = False
    for c in range(4):
        # move each corner color
        component=libtcod.random_get_int(None, 0, 2)
        if component == 0:
            tc_cols[c].r += 5 * tc_dirr[c]
            if tc_cols[c].r == 255:
                tc_dirr[c] = -1
            elif tc_cols[c].r == 0:
                tc_dirr[c] = 1
        elif component == 1:
            tc_cols[c].g += 5 * tc_dirg[c]
            if tc_cols[c].g == 255:
                tc_dirg[c] = -1
            elif tc_cols[c].g == 0:
                tc_dirg[c] = 1
github eyeCube / Softly-Roguelike / src / orangio.py View on Github external
def update_render_text(self):
        tcod.console_clear(self.console)
        tcod.console_print_ex(
            self.console,0,0,
            tcod.BKGND_NONE,tcod.LEFT,
            self.text )
        self.blit_console()
github eyeCube / Softly-Roguelike / src / rogue.py View on Github external
def clear_final():
    libtcod.console_clear(con_final())
#@debug.printr
github BraininaBowl / RoguelikePy2019 / engine.py View on Github external
#            elif game_state == GameStates.DROP_INVENTORY:
#                player_turn_results.extend(player.inventory.drop_item(item))

#        if toggle_log:
#            if constants['panel_height'] == constants['screen_height']:
#                constants['panel_height'] = 5
#            else:
#                constants['panel_height'] = constants['screen_height']

        if take_stairs and game_state == GameStates.PLAYERS_TURN:
            for entity in entities:
                if entity.stairs and entity.x == player.x and entity.y == player.y:
                    entities = game_map.next_floor(player, message_log, constants)
                    fov_map = initialize_fov(game_map)
                    fov_recompute = True
                    libtcod.console_clear(con)
                    cam_x, cam_y = update_cam(player, constants)
                    break
            else:
                message_log.add_message(Message('There are no stairs here.', colors.get('red')))

        if level_up:
            if level_up == 'hp':
                player.fighter.base_max_hp += 20
                player.fighter.hp += 20
            elif level_up == 'str':
                player.fighter.base_power += 1
            elif level_up == 'def':
                player.fighter.base_defense += 1

            game_state = previous_game_state