Example #1
0
 def move(self, new):
     libtcod.console_set_char_foreground(0, self.x + self.cursor_pos,
                                         self.y, WHITE)
     libtcod.console_set_char_background(0, self.x + self.cursor_pos,
                                         self.y, BLACK)
     self.flush = True
     self.putCursor(new)
Example #2
0
def render_mouse(mouse_window, mouse, screen_width, screen_height, fov_map):
    """
    Create a 'X'in mouse_window under mouse while in FOV

    :param mouse_window:
    :param mouse:
    :param screen_width:
    :param screen_height:
    :param fov_map:
    :return:
    """
    #todo change map_is_in_fov
    if libtcod.map_is_in_fov(fov_map, mouse.cx, mouse.cy):
        #todo update all console to new tcod console commands
        libtcod.console_set_char_foreground(mouse_window, mouse.cx, mouse.cy, libtcod.yellow)
        libtcod.console_set_char(mouse_window, mouse.cx, mouse.cy, 'X')
        libtcod.console_blit(mouse_window, 0, 0, screen_width, screen_height, 0, 0, 0, 1, 0)
        libtcod.console.Console.clear(mouse_window)
Example #3
0
File: render.py Project: cpiod/1rl
def clear_cell(con, x, y, game_map):
    # print the floor of a cell
    wall = game_map.is_blocked(x, y)
    door = game_map.is_door(x, y)
    visible = game_map.is_visible(x, y)

    if visible:
        game_map.tiles[x][y].is_seen = True

    tcod.console_set_char_background(con, x, y, const.base03)
    if game_map.tiles[x][y].is_seen:
        if visible:
            tcod.console_set_char_foreground(
                con, x, y, game_map.tiles[x][y].visible_color)
        else:
            tcod.console_set_char_foreground(con, x, y,
                                             game_map.tiles[x][y].hidden_color)
        tcod.console_set_char(con, x, y, game_map.tiles[x][y].char)
    else:
        tcod.console_set_char(con, x, y, ' ')
Example #4
0
def h_draw(item):
    items = "/%:'?!])"
    monsters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if item.char in items:
        char = choice(items)
    elif item.char in monsters:
        char = choice(monsters)
    else:
        char = item.char
    colour = choice([
        tcod.color.white, tcod.color.red, tcod.color.blue, tcod.color.green,
        tcod.color.amber, tcod.color.azure, tcod.color.brass,
        tcod.color.celadon, tcod.color.copper, tcod.color.chartreuse,
        tcod.color.crimson, tcod.color.cyan, tcod.color.fuchsia,
        tcod.color.han, tcod.color.flame, tcod.color.gold, tcod.color.lime,
        tcod.color.magenta, tcod.color.orange, tcod.color.peach,
        tcod.color.pink, tcod.color.purple, tcod.color.sea,
        tcod.color.turquoise, tcod.color.violet, tcod.color.yellow
    ])
    tcod.console_put_char(con, item.location.x, item.location.y, char)
    tcod.console_set_char_foreground(con, item.location.x, item.location.y,
                                     colour)
Example #5
0
File: render.py Project: cpiod/1rl
def draw_entity(con, entity, game_map, player):
    visible = game_map.is_visible(entity.x, entity.y)
    if visible\
    or (entity.is_seen and (isinstance(entity, ent.Weapon) or isinstance(entity, ent.Feature)))\
    or (isinstance(entity, ent.Monster) and isinstance(player.active_weapon, ent.TelepathicWeapon)):
        # are visible: what is directly visible, remembered weapon and feature. When telepathic, monster are visible too
        tcod.console_set_char_background(con, entity.x, entity.y, const.base03)
        if visible:
            if (isinstance(entity, ent.Monster) and entity.confusion_date):
                tcod.console_set_char_background(con, entity.x, entity.y,
                                                 entity.visible_color)
                tcod.console_set_char_foreground(con, entity.x, entity.y,
                                                 const.base03)
            else:
                tcod.console_set_char_foreground(con, entity.x, entity.y,
                                                 entity.visible_color)
        else:
            tcod.console_set_char_foreground(con, entity.x, entity.y,
                                             entity.hidden_color)
        tcod.console_set_char(con, entity.x, entity.y, entity.char)
Example #6
0
def side_menu(con,
              header,
              options,
              width,
              screen_width,
              screen_height,
              color=libtcodpy.white):
    header_height = libtcodpy.console_get_height_rect(con, 0, 0, width,
                                                      screen_height, header)

    height = len(options) + header_height
    window = libtcodpy.console_new(width, height)

    # Print the header
    libtcodpy.console_set_default_foreground(window, libtcodpy.white)
    libtcodpy.console_print_rect_ex(
        window, 0, 0, width, height, libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        "%cInventory%c" % (libtcodpy.COLCTRL_1, libtcodpy.COLCTRL_STOP))

    y = header_height
    letter_index = ord('a')
    for option_text in options:
        text = '(' + chr(letter_index) + ') ' + option_text
        libtcodpy.console_print_ex(
            window, 0, y, libtcodpy.BKGND_NONE, libtcodpy.LEFT,
            '%c{0}%c'.format(text) %
            (libtcodpy.COLCTRL_3, libtcodpy.COLCTRL_STOP))
        libtcodpy.console_set_char_foreground(window, 0, y, color)
        libtcodpy.console_set_char_foreground(window, 1, y, color)
        libtcodpy.console_set_char_foreground(window, 2, y, color)
        y += 1
        letter_index += 1

    # Blit the contents of "window" to the root console
    x = int(screen_width / 2 - width / 2)
    y = int(screen_height / 2 - height / 2)
    libtcodpy.console_blit(window, 0, 0, width, height, 0, screen_width - 30,
                           2, 1.0, 0.7)
Example #7
0
def render_all(con, panel, entities, player, game_map, fov_map, fov_recompute,
               message_log, screen_width, screen_height, bar_width,
               panel_height, panel_y, mouse, colors, options_tutorial_enabled,
               game_state, names_list, colors_list, tick, tick_speed):

    if fov_recompute:
        # Draw all the tiles in the game map
        for y in range(game_map.height):
            for x in range(game_map.width):
                visible = libtcod.map_is_in_fov(fov_map, x, y)
                door = game_map.tiles[x][y].door
                wall = game_map.tiles[x][y].block_sight

                if door:
                    libtcod.console_set_char_foreground(
                        con, x, y, (255, 255, 255))
                    libtcod.console_set_char_background(
                        con, x, y, colors.get('light_ground'),
                        libtcod.BKGND_SET)
                    libtcod.console_set_char(con, x, y,
                                             game_map.tiles[x][y].door.char)

                elif wall:
                    #assign characters based on blitmap
                    if game_map.blitmap[x][y] in [10]:
                        #east-west walls

                        if game_map.tiles[x][
                                y -
                                1].block_sight == False and game_map.tiles[x][
                                    y + 1].empty_space:
                            #floor above, empty space below

                            libtcod.console_set_char_background(
                                con, x, y, (0, 0, 0), libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))

                        elif (game_map.tiles[x][y - 1].empty_space
                              and game_map.tiles[x][y + 1].block_sight
                              == False) or (
                                  game_map.tiles[x][y - 1].block_sight == False
                                  and game_map.tiles[x][y + 1].block_sight
                                  == False):
                            #empty space above, and floor below or floor above, floor below
                            libtcod.console_set_char_background(
                                con, x, y, colors.get('dark_ground'),
                                libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))

                        libtcod.console_set_char(con, x, y, 223)

                    elif game_map.blitmap[x][y] in [0, 1, 2, 8, 11]:
                        if game_map.tiles[x][y + 1].empty_space:
                            libtcod.console_set_char_background(
                                con, x, y, (0, 0, 0), libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))
                        else:
                            libtcod.console_set_char_background(
                                con, x, y, colors.get('dark_ground'),
                                libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))

                        libtcod.console_set_char(con, x, y, 223)

                    elif game_map.blitmap[x][y] in [3, 9]:
                        #bottom left, bottom right corners
                        if game_map.tiles[x][y + 1].empty_space:
                            libtcod.console_set_char_background(
                                con, x, y, (0, 0, 0), libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))
                        else:
                            libtcod.console_set_char_background(
                                con, x, y, colors.get('dark_ground'),
                                libtcod.BKGND_SET)
                            libtcod.console_set_char_foreground(
                                con, x, y, colors.get('light_wall'))

                        libtcod.console_set_char(con, x, y, 223)

                    elif game_map.blitmap[x][y] in [
                            4, 5, 6, 7, 12, 13, 14, 15
                    ]:
                        libtcod.console_set_char_background(
                            con, x, y, colors.get('light_wall'),
                            libtcod.BKGND_SET)
                        libtcod.console_set_char_foreground(
                            con, x, y, colors.get('light_wall'))
                        libtcod.console_set_char(con, x, y, 218)

                else:  #floor
                    libtcod.console_set_char_background(
                        con, x, y, colors.get('light_ground'),
                        libtcod.BKGND_SET)

                if visible:
                    game_map.tiles[x][y].explored = True
                else:
                    if game_map.tiles[x][y].explored:  #explored, not visible
                        bgcolor = (
                            libtcod.console_get_char_background(con, x, y) *
                            .33)
                        fgcolor = (
                            libtcod.console_get_char_foreground(con, x, y) *
                            .33)

                        libtcod.console_set_char_background(
                            con, x, y, bgcolor, libtcod.BKGND_SET)
                        libtcod.console_set_char_foreground(con, x, y, fgcolor)
                    else:
                        libtcod.console_set_char_background(
                            con, x, y, (0, 0, 0), libtcod.BKGND_SET)
                        libtcod.console_set_char_foreground(
                            con, x, y, (0, 0, 0))

    entities_in_render_order = sorted(entities,
                                      key=lambda x: x.render_order.value)

    # Draw all entities in the list
    for entity in entities_in_render_order:
        draw_entity(con, entity, fov_map, game_map, tick, tick_speed)

    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)

    libtcod.console_set_default_foreground(panel, libtcod.white)

    if game_state == GameStates.KEYTARGETING:
        if player.y >= game_map.height / 2:  #player on bottom half of the screen
            (tx, ty) = (58, 2)
        else:  #player on top half of the map
            (tx, ty) = (58, 32)

        libtcod.console_set_default_background(0, libtcod.lighter_blue)
        libtcod.console_set_default_foreground(0, libtcod.black)

        libtcod.console_print_ex(0, tx, ty, libtcod.BKGND_SET, libtcod.RIGHT,
                                 "Press [esc] to exit targeting.")

    #print mouse x/y
    #libtcod.console_print_ex(panel, 1, 0, libtcod.BKGND_NONE, libtcod.LEFT, (str(mouse.cx) + "," + str(mouse.cy)))

    if options_tutorial_enabled:
        MAP_HEIGHT = game_map.height
        MAP_WIDTH = game_map.width

        if game_map.dungeon_level < 3:
            libtcod.console_set_default_background(0, libtcod.lighter_yellow)
            libtcod.console_set_default_foreground(0, libtcod.black)

            if player.y >= MAP_HEIGHT / 2:  #player on bottom half of the screen
                (tx, ty) = (58, 2)
            else:  #player on top half of the map
                (tx, ty) = (58, MAP_HEIGHT - 2)

            if game_state != GameStates.KEYTARGETING:
                if player.turn_count < 4:
                    libtcod.console_print_ex(
                        0, tx, ty, libtcod.BKGND_SET, libtcod.RIGHT,
                        "Use the numpad or arrow keys to move.")

                elif player.turn_count < 9:
                    libtcod.console_print_ex(
                        0, tx, ty, libtcod.BKGND_SET, libtcod.RIGHT,
                        "You can move into creatures to attack with a melee ")
                    libtcod.console_print_ex(
                        0, tx, ty + 1, libtcod.BKGND_SET, libtcod.RIGHT,
                        "weapon, or press [f] to fire a ranged weapon.")

                elif player.turn_count < 14:
                    libtcod.console_print_ex(
                        0, tx, ty, libtcod.BKGND_SET, libtcod.RIGHT,
                        "Press [x] to examine creatures or items on the ground."
                    )

                else:

                    for ent in entities:
                        if not ent.name == "Player":
                            if ent.x == player.x and ent.y == player.y:
                                if ent.name == "stairs":
                                    libtcod.console_print_ex(
                                        0, tx, ty, libtcod.BKGND_SET,
                                        libtcod.RIGHT,
                                        "Press [Enter] to go down the stairs.")
                                elif ent.item:
                                    if not game_map.tiles[ent.x][ent.y].door:
                                        libtcod.console_print_ex(
                                            0, tx, ty, libtcod.BKGND_SET,
                                            libtcod.RIGHT,
                                            "Press [g] to grab an item.")

                    myneighbors = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0),
                                   (-1, 1), (0, 1), (1, 1)]

                    for dx, dy in myneighbors:
                        tdx, tdy = player.x + dx, player.y + dy
                        if game_map.tiles[tdx][tdy].door:
                            if game_map.tiles[tdx][tdy].block_sight:
                                libtcod.console_print_ex(
                                    0, tx, ty, libtcod.BKGND_SET,
                                    libtcod.RIGHT,
                                    "Move into a closed door to open it.")
                            else:
                                libtcod.console_print_ex(
                                    0, tx, ty, libtcod.BKGND_SET,
                                    libtcod.RIGHT,
                                    "Press [c] and then a direction to close an open door."
                                )

    # Print the game messages, one line 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,
    #                          'Dungeon level: {0}'.format(game_map.dungeon_level))
    # libtcod.console_print_ex(panel, 1, 4, libtcod.BKGND_NONE, libtcod.LEFT,
    #                          'Turn : {0}'.format(player.turn_count))

    #print condition icons
    if len(player.conditions) > 0:
        ind = 0
        for condition in player.conditions:
            if condition.active:
                libtcod.console_print_ex(panel, 1 + ind, 2, libtcod.BKGND_SET,
                                         libtcod.LEFT, condition.char)
                libtcod.console_set_char_background(panel, 1 + ind, 2,
                                                    condition.bgcolor,
                                                    libtcod.BKGND_SET)
                libtcod.console_set_char_foreground(panel, 1 + ind, 2,
                                                    condition.fgcolor)
                ind += 1

    #timeline
    libtcod.console_set_default_foreground(panel, libtcod.dark_gray)
    libtcod.console_print_ex(panel, 22, 1, libtcod.BKGND_NONE, libtcod.LEFT,
                             chr(195))  #195 >
    libtcod.console_print_ex(panel, 58, 1, libtcod.BKGND_NONE, libtcod.LEFT,
                             chr(180))  #180 <
    for x in range(23, 58):
        libtcod.console_print_ex(panel, x, 1, libtcod.BKGND_NONE, libtcod.LEFT,
                                 chr(196))  #196 -

    libtcod.console_set_default_foreground(panel, libtcod.white)
    libtcod.console_print_ex(panel, 23, 1, libtcod.BKGND_NONE, libtcod.LEFT,
                             chr(player.char))  #player char

    turn_order = []
    for ent in entities:
        if not ent.name == player.name and ent.ai and libtcod.map_is_in_fov(
                fov_map, ent.x, ent.y):
            temp_enemy_timer = ent.fighter.timer + ent.fighter.speed
            while temp_enemy_timer >= player.fighter.speed:
                turn_order.append(ent)
                temp_enemy_timer -= player.fighter.speed

    x = 25
    for ent in turn_order:
        if x < 58:
            libtcod.console_print_ex(panel, x, 1, libtcod.BKGND_NONE,
                                     libtcod.LEFT, chr(ent.char + 1))
            x = x + 2

    #check for timeline highlighting
    if mouse.cy == 37:
        if mouse.cx >= 25 and mouse.cx <= 57:
            timeline_index = (mouse.cx - 25)
            if mouse.cx % 2 == 0: timeline_index -= 1
            timeline_index = int(timeline_index / 2)
        else:
            timeline_index = 99

        if timeline_index <= len(turn_order) - 1 and tick % tick_speed < 2:
            ent = turn_order[timeline_index]
            libtcod.console_set_default_foreground(0, libtcod.lighter_yellow)
            libtcod.console_print_ex(0, ent.x, ent.y, libtcod.BKGND_NONE,
                                     libtcod.LEFT, chr(ent.char))

            # TODO :: Look at this... this code was an attempt to highlight each occurance of a highlighted creature in the timeline
            #so if you highlight a rat, and he gets two turns, I wanted both of his sprites on the timeline to highlight.
            #didn't work, but it did manage to highlight the specific sprite you were hovering over on the timeline.

            # for e in turn_order:
            #     if e == turn_order[timeline_index]:
            #         ex = 25 + (2*timeline_index)
            #         libtcod.console_set_default_foreground(panel, libtcod.lighter_yellow)
            #         libtcod.console_print_ex(panel, ex, 1, libtcod.BKGND_NONE, libtcod.LEFT, chr(ent.char))

    for ent in entities:
        if libtcod.map_is_in_fov(
                fov_map, ent.x, ent.y
        ) and ent.x == mouse.cx and ent.y == mouse.cy and ent.name != "Targeter" and ent.name != "Player":
            if ent.fighter:
                #print a context menu for the lil guy
                context_menu(game_map.width, game_map.height, ent, names_list)
                break
            else:
                render_tooltip(ent.x + 1, ent.y - 1, ent.name)

    if game_state == GameStates.KEYTARGETING:
        targeter = None
        for ent in entities:
            if ent.name == 'Targeter':
                targeter = ent
        if not targeter == None:
            #libtcod.console_set_default_foreground(panel, libtcod.light_gray)
            libtcod.console_print_ex(
                panel, 1, 0, libtcod.BKGND_NONE, libtcod.LEFT,
                get_all_at(targeter.x, targeter.y, entities, fov_map, game_map,
                           names_list))
            for ent in entities:
                if libtcod.map_is_in_fov(
                        fov_map, ent.x, ent.y
                ) and ent.x == targeter.x and ent.y == targeter.y and ent.name != "Targeter" and ent.name != "Player":
                    if ent.fighter:
                        #print a context menu for the lil guy
                        context_menu(game_map.width, game_map.height, ent,
                                     names_list)
                        break
                    else:
                        render_tooltip(ent.x + 1, ent.y - 1, ent.name)

    libtcod.console_blit(panel, 0, 0, screen_width, panel_height, 0, 0,
                         panel_y)

    if game_state == GameStates.PLAYERS_TURN:
        if len(player.conditions) > 0:
            if mouse.cy == 35:  #the row where status icons are displayed
                if mouse.cx > 0 and mouse.cx <= len(player.conditions):
                    render_tooltip(mouse.cx + 1, 36,
                                   player.conditions[mouse.cx - 1].tooltip)

    if game_state in (GameStates.SHOW_INVENTORY, GameStates.DROP_INVENTORY):
        if game_state == GameStates.SHOW_INVENTORY:
            inventory_title = 'Press the key next to an item to use it, or Esc to cancel.\n'
        else:
            inventory_title = 'Press the key next to an item to drop it, or Esc to cancel.\n'

        inventory_menu(con, inventory_title, player, 50, screen_width,
                       screen_height)

    elif game_state == GameStates.LEVEL_UP:
        level_up_menu(con, 'Level up! Choose a stat to raise:', player, 40,
                      screen_width, screen_height)

    elif game_state == GameStates.CHARACTER_SCREEN:
        character_screen(player, 30, 10, screen_width, screen_height)
Example #8
0
def _draw(item):
    tcod.console_put_char(con, item.location.x, item.location.y, item.char)
    tcod.console_set_char_foreground(con, item.location.x, item.location.y,
                                     item.colour)
Example #9
0
def render_all(con, panel, entities, player, game_map, fov_map, fov_recompute,
               message_log, screen_width, screen_height, bar_width,
               panel_height, panel_y, mouse, colors, game_state, graphics):
    """
    Affiche les pièces, les entites, les menus, et tous les éléments du jeu

    Parametres:
    ----------
    con : tcod.console

    panel : tcod.console

    entities : list

    player : Entity

    game_map : GameMap

    fov_map : tcod.map

    fov_recompute : bool

    message_log : MessageLog

    screen_width : int

    screen_height : int

    bar_width : int

    panel_heidght : int

    panel_y : int

    mouse : tcod.mouse

    colors : tcod.colors
        Désormais non utilisé

    game_state : int

    graphics : dict


    Renvoi:
    -------
    Aucun

    """
    if fov_recompute:
        for y in range(game_map.height):
            for x in range(game_map.width):
                visible = libtcod.map_is_in_fov(fov_map, x, y)
                wall = game_map.tiles[x][y].block_sight
                if visible:
                    if wall:
                        libtcod.console_put_char_ex(con, x, y,
                                                    graphics.get('wall'),
                                                    libtcod.white,
                                                    libtcod.black)
                    else:
                        libtcod.console_put_char_ex(con, x, y,
                                                    graphics.get('floor'),
                                                    libtcod.white,
                                                    libtcod.black)
                    game_map.tiles[x][y].explored = True
                elif game_map.tiles[x][y].explored:
                    if wall:
                        libtcod.console_put_char_ex(con, x, y,
                                                    graphics.get('wall'),
                                                    libtcod.light_grey,
                                                    libtcod.black)
                    else:
                        libtcod.console_put_char_ex(con, x, y,
                                                    graphics.get('floor'),
                                                    libtcod.light_grey,
                                                    libtcod.black)
    entities_in_render_order = sorted(entities,
                                      key=lambda x: x.render_order.value)

    for entity in entities_in_render_order:
        draw_entity(con, entity, fov_map, game_map)
        if entity.ai:
            if entity.ai.ai_name == 'Boss':
                if entity.ai.aoeing:
                    if entity.ai.turn % 10 == 0:
                        color = libtcod.lightest_red
                    elif entity.ai.turn % 10 == 1:
                        color = libtcod.lighter_red
                    elif entity.ai.turn % 10 == 2:
                        color = libtcod.light_red
                    elif entity.ai.turn % 10 == 3:
                        color = libtcod.red
                    radius = entity.ai.radius
                    for x in range(entity.x - radius, entity.x + radius + 1):
                        for y in range(entity.y - radius,
                                       entity.y + radius + 1):
                            if ((x - entity.x)**2 +
                                (y - entity.y)**2)**0.5 <= radius:
                                libtcod.console_set_char_foreground(
                                    con, x, y, color)

    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)

    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, 2, libtcod.BKGND_NONE, libtcod.LEFT,
        'Salle : {0} - LVL : {1}'.format(game_map.dungeon_level,
                                         player.level.current_level))
    boss_bar = False
    for entity in entities:
        if entity.name == 'Boss':
            boss_bar = True
            boss = entity.fighter
    if boss_bar:
        render_bar(panel, 1, 3, bar_width, 'Boss HP', boss.hp, boss.max_hp,
                   libtcod.orange, libtcod.darker_orange)
    else:
        render_bar(panel, 1, 3, bar_width, 'XP', player.level.current_xp,
                   player.level.experience_to_next_level, libtcod.light_purple,
                   libtcod.darker_purple)
    libtcod.console_print_ex(
        panel, 1, 4, libtcod.BKGND_NONE, libtcod.LEFT,
        'ATQ : {0} - DEF : {1}'.format(player.fighter.power,
                                       player.fighter.defense))

    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, entities, fov_map))
    libtcod.console_blit(panel, 0, 0, screen_width, panel_height, 0, 0,
                         panel_y)
    if game_state in (GameStates.SHOW_INVENTORY, GameStates.DROP_INVENTORY):
        if game_state == GameStates.SHOW_INVENTORY:
            inventory_title = 'Echap pour quitter, A/B/C... pour utiliser.\n'
        else:
            inventory_title = 'Echap pour quitter, A/B/C... pour lacher\n'
        inventory_menu(con, inventory_title, player, 50, screen_width,
                       screen_height)
    elif game_state == GameStates.LEVEL_UP:
        level_up_menu(con, 'Level up, choisis une amelioration :', player, 40,
                      screen_width, screen_height)
    elif game_state == GameStates.CHARACTER_SCREEN:
        character_screen(player, 30, 10, screen_width, screen_height)
Example #10
0
    def _draw_what_player_sees(self, pc, sight):
        world=rog.world()
        pos=world.component_for_entity(pc, cmp.Position)
        
        for     x in range( max(0, pos.x-sight), min(self.w, pos.x+sight+1) ):
            for y in range( max(0, pos.y-sight), min(self.h, pos.y+sight+1) ):
##                print("tile at {} {} has light level {}".format(x ,y, self.get_light_value(x,y)))
                
                if not rog.can_see(pc, x, y, sight):
                    continue
                
                # get return data from rog.can_see
                ret=rog.fetchglobalreturn()
                if ret: # unpack
                    dist, plight = ret
                
                ents=self.thingsat(x, y)
                
                if ents:
                    charDiscover = None
                    entDrawn = False
                    
                    for ent in reversed(ents):
                        # calculate visibility
                        if ent==pc:
                            visibility=10 #VISIBILITY_MAX
                        else:
                            camo = rog.getms(ent, 'camo')
                            visibility=rog.visibility(
                                pc,sight,plight,camo,dist)
##                            print('visibility: ',visibility)
##                            print('stats: s{}, l{}, c{}, d{}'.format(sight, plight, camo, dist))
                        
                        if visibility<=0: continue
                        # render data based on visibility
                        rend=world.component_for_entity(ent, cmp.Draw)
                        char = rend.char if visibility > 1 else '?'
                        
                        if not entDrawn: # draw top entity
                            entDrawn = True
                            # get render data
                            fgcol=rend.fgcol
                            # render
                            libtcod.console_put_char(
                                self.con_map_state, x,y, char )
                            
##                            if type(fgcol)==type("s"): # TEST
##                                print("~~~ problem entity: {} named '{}'".format(
##                                    ent, rog.getname(ent)))

                            libtcod.console_set_char_foreground(
                                self.con_map_state, x,y, fgcol)
                            self._apply_rendered_bgcol(x,y, ent)
                            if world.has_component(ent, cmp.Creature):
                                continue # don't discover creatures
                        
                        if charDiscover is None:
                            charDiscover = char # we'll discover this entity
                            break # only discover one entity
                    # end for

                    self._discover_place(x,y, charDiscover)
                else:
                    libtcod.console_put_char_ex(self.con_map_state, x,y,
                        self.get_char(x, y),
                        self.get_color(x, y), self.get_bgcolor(x, y))
                    self._discover_place(x,y, None)
Example #11
0
def test_console_set_char_foreground(console, fg):
    libtcodpy.console_set_char_foreground(console, 0, 0, fg)
    assert_char(console, 0, 0, fg=fg)
Example #12
0
def test_console_set_char_foreground(console, fg):
    libtcodpy.console_set_char_foreground(console, 0, 0, fg)
    assert_char(console, 0, 0, fg=fg)
Example #13
0
def console_invert_color(con, x, y):
    col1 = libtcod.console_get_char_foreground(con, x, y)
    col2 = libtcod.console_get_char_background(con, x, y)
    libtcod.console_set_char_foreground(con, x, y, color_invert(col1))
    libtcod.console_set_char_background(con, x, y, color_invert(col2))
Example #14
0
	def putchar(self,x,y,rep,color):
		(x,y) = self.tocam(x,y)
		tcod.console_put_char(self.con,x,y,rep)
		tcod.console_set_char_foreground(self.con,x,y,color)
def render_all(con,
               panel,
               entities,
               player,
               game_map,
               fov_map,
               fov_recompute,
               message_log,
               screen_width,
               screen_height,
               acting_member,
               bar_width,
               panel_height,
               panel_y,
               mouse,
               colors,
               target_tiles=None):
    """
    Draw all entities in the list
    :param con: destination drawing console
    :param panel: drawing surface for messages, etc.
    :param entities: list of Entity objects
    :param player: the player Entity object
    :param game_map: GameMap object
    :param fov_map: map of field of view
    :param fov_recompute: boolean
    :param message_log: MessageLog object containing list of messages
    :param screen_width: int width of screen
    :param screen_height: int height of screen
    :param acting_member: int selected member of party
    :param bar_width: int width of bar for panel
    :param panel_height: int height of panel
    :param panel_y: int location of panel
    :param mouse: tuple mouse location
    :param colors: dict of color tuples
    :param target_tiles: list of tuple tile coordinates for target tiles to be highlighted
    :return: None
    """
    if fov_recompute:
        for y in range(game_map.height):
            for x in range(game_map.width):
                visible = libtcod.map_is_in_fov(m=fov_map, x=x, y=y)
                wall = game_map.tiles[x][y].block_sight

                if visible:
                    if wall:
                        libtcod.console_set_char_foreground(
                            con=con, x=x, y=y, col=colors.get('light_ground'))
                        libtcod.console_set_char(con=con, x=x, y=y, c='-')
                        libtcod.console_set_char_background(
                            con=con,
                            x=x,
                            y=y,
                            col=colors.get('light_wall'),
                            flag=libtcod.BKGND_SET)
                    else:
                        libtcod.console_set_char_foreground(
                            con=con, x=x, y=y, col=colors.get('light_wall'))
                        libtcod.console_set_char(con=con, x=x, y=y, c='.')
                        libtcod.console_set_char_background(
                            con=con,
                            x=x,
                            y=y,
                            col=colors.get('light_ground'),
                            flag=libtcod.BKGND_SET)
                    game_map.tiles[x][y].explored = True
                elif game_map.tiles[x][y].explored:
                    if wall:
                        libtcod.console_set_char(con=con, x=x, y=y, c=' ')
                        libtcod.console_set_char_background(
                            con=con,
                            x=x,
                            y=y,
                            col=colors.get('dark_wall'),
                            flag=libtcod.BKGND_SET)
                    else:
                        libtcod.console_set_char(con=con, x=x, y=y, c=' ')
                        libtcod.console_set_char_background(
                            con=con,
                            x=x,
                            y=y,
                            col=colors.get('dark_ground'),
                            flag=libtcod.BKGND_SET)
                if target_tiles and (x, y) in target_tiles:
                    libtcod.console_set_char_background(
                        con=con,
                        x=x,
                        y=y,
                        col=libtcod.lighter_red,
                        flag=libtcod.BKGND_SET)

    entities_in_render_order = sorted(entities,
                                      key=lambda z: z.render_order.value)

    for entity in entities_in_render_order:
        draw_entity(con=con, entity=entity, fov_map=fov_map)

    # noinspection PyTypeChecker
    libtcod.console_blit(src=con,
                         x=0,
                         y=0,
                         w=screen_width,
                         h=screen_height,
                         dst=0,
                         xdst=0,
                         ydst=0)

    libtcod.console_set_default_background(con=panel, col=libtcod.darker_gray)
    libtcod.console_clear(con=panel)

    # Print the game messages, one line at a time
    y = 1
    for message in message_log.messages:
        # libtcod.console_set_key_color(panel, libtcod.gray)
        libtcod.console_set_default_foreground(con=panel, col=message.color)
        libtcod.console_print_ex(con=panel,
                                 x=message_log.x,
                                 y=y,
                                 flag=libtcod.BKGND_NONE,
                                 alignment=libtcod.LEFT,
                                 fmt=message.text)
        y += 1

    # get entities under mouse
    text2 = None
    text = get_names_under_mouse(mouse=mouse,
                                 entities=entities,
                                 fov_map=fov_map)
    if not text:
        text = player.name
        text2 = 'Gold: {}'.format(player.party.coins)
    libtcod.console_set_default_foreground(con=panel, col=libtcod.white)
    libtcod.console_print_ex(con=panel,
                             x=1,
                             y=0,
                             flag=libtcod.BKGND_NONE,
                             alignment=libtcod.LEFT,
                             fmt=text)
    if text2:
        libtcod.console_print_ex(con=panel,
                                 x=bar_width,
                                 y=0,
                                 flag=libtcod.BKGND_NONE,
                                 alignment=libtcod.RIGHT,
                                 fmt=text2)

    target = get_party_under_mouse(mouse=mouse,
                                   entities=entities,
                                   fov_map=fov_map)
    if not target:
        target = player

    y = 1
    x = 1
    for member in target.party.members:
        if member.cooldown > 0:
            text_color = libtcod.red
        else:
            text_color = libtcod.white
        if target == player and acting_member and member == target.party.members[
                acting_member - 1]:
            bkg_color = libtcod.light_gray
        else:
            bkg_color = libtcod.darker_gray

        render_member(panel,
                      x,
                      y,
                      member,
                      width=bar_width,
                      text_color=text_color,
                      bkg_color=bkg_color)
        y += 1

    # y = 1
    # for member in player.party.members:
    #     if member.cooldown > 0:
    #         render_bar(panel=panel, x=1, y=y, total_width=bar_width, name=member.name, value=member.cooldown,
    #                    bar_color=libtcod.darker_red, back_color=libtcod.darker_red)
    #     else:
    #         render_bar(panel=panel, x=1, y=y, total_width=bar_width, name=member.name, value=member.cooldown,
    #                    bar_color=libtcod.darker_gray, back_color=libtcod.darker_gray)
    #     y += 1

    # noinspection PyTypeChecker
    libtcod.console_blit(src=panel,
                         x=0,
                         y=0,
                         w=screen_width,
                         h=panel_height,
                         dst=0,
                         xdst=0,
                         ydst=panel_y)
Example #16
0
def render_all(con, panel, entities, player, game_map, fov_map, fov_recompute, message_log, screen_width, screen_height,
               bar_width, panel_height, panel_y, mouse, colors, game_state):

    if fov_recompute:
        # Draw all the tiles
        for y in range(game_map.height):
            for x in range(game_map.width):
                #todo change map_is_in_fov
                visible = libtcod.map_is_in_fov(fov_map, x, y)
                wall = game_map.tiles[x][y].block_sight

                if visible:
                    if wall:
                        #todo change the console char setting
                        libtcod.console_set_char_foreground(con, x, y, colors.get('light_ground'))
                        libtcod.console_set_char(con, x, y, '=')
                        libtcod.console_set_char_background(con, x, y, colors.get('light_wall'), libtcod.BKGND_SET)
                    else:
                        #todo change the console char setting
                        libtcod.console_set_char_foreground(con, x, y, colors.get('light_wall'))
                        libtcod.console_set_char(con, x, y, '.')
                        libtcod.console_set_char_background(con, x, y, colors.get('light_ground'), libtcod.BKGND_SET)
                    game_map.tiles[x][y].explored = True
                elif game_map.tiles[x][y].explored:
                    if wall:
                        #todo change the console char setting
                        libtcod.console_set_char_foreground(con, x, y, colors.get('dark_ground'))
                        libtcod.console_set_char(con, x, y, '=')
                        libtcod.console_set_char_background(con, x, y, colors.get('dark_wall'), libtcod.BKGND_SET)
                    else:
                        #todo change the console char setting
                        libtcod.console_set_char_foreground(con, x, y, colors.get('dark_wall'))
                        libtcod.console_set_char(con, x, y, '.')
                        libtcod.console_set_char_background(con, x, y, colors.get('dark_ground'), libtcod.BKGND_SET)

    entities_in_render_order = sorted(entities, key=lambda x: x.render_order.value)

    # draw all entities in the list
    for entity in entities_in_render_order:
        draw_entity(con, entity, fov_map, game_map)

    #todo update to new tcod commands
    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 line at a time
    y = 1
    for message in message_log.messages:
        #todo change the console char setting
        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

    # HP Bar
    render_bar(panel, 1, 1, bar_width, 'HP', player.fighter.hp, player.fighter.max_hp, libtcod.light_red, libtcod.darker_red)
    #todo change the console char setting
    libtcod.console_print_ex(panel, 1, 3, libtcod.BKGND_NONE, libtcod.LEFT, 'Dungeon Depth: {0}'.format(game_map.dungeon_depth))

    # print output from entities under mouse
    #todo change the console char setting
    libtcod.console_set_default_foreground(panel, libtcod.white)
    libtcod.console_print_ex(panel, 1, 0, libtcod.BKGND_NONE, libtcod.LEFT,
                             get_names_under_mouse(mouse, entities, fov_map))

    libtcod.console_blit(panel, 0, 0, screen_width, panel_height, 0, 0, panel_y)

    # Inventory call
    if game_state in (GameStates.SHOW_INVENTORY, GameStates.DROP_INVENTORY):
        if game_state == GameStates.SHOW_INVENTORY:
            inventory_title = 'Select from Menu or Esc to cancel.\n'
        else:
            inventory_title = 'Select from Menu or Esc to cancel.\n'

        inventory_menu(con, inventory_title, player, 50, screen_width, screen_height)

    elif game_state == GameStates.LEVEL_UP:
        level_up_menu(con, 'Level Up! Choose a stat to raise:', player, 40, screen_width, screen_width)

    elif game_state == GameStates.CHARACTER_SCREEN:
        character_screen(player, 30, 10, screen_width, screen_height)
Example #17
0
def draw_cell(con, pos, char, fg, bg=None):
    x, y = pos
    if bg:
        tcod.console_set_char_background(con, x, y, bg)
    tcod.console_set_char_foreground(con, x, y, fg)
    tcod.console_set_char(con, x, y, char)
Example #18
0
def character_screen(player, character_screen_width, character_screen_height,
                     screen_width, screen_height):
    window = libtcodpy.console_new(character_screen_width,
                                   character_screen_height)

    libtcodpy.console_set_default_foreground(window, libtcodpy.white)

    libtcodpy.console_print_rect_ex(
        window, 0, 1, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT, '%cCharacter Information%c' %
        (libtcodpy.COLCTRL_1, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_set_char_foreground(window, character_screen_width,
                                          character_screen_height,
                                          libtcodpy.Color(35, 140, 196))
    libtcodpy.console_print_rect_ex(
        window, 0, 2, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cLevel%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 2, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.level.current_level) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 3, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cExp%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 3, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.level.current_xp) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 4, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cExp to Level%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 4, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.level.experience_to_next_level) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 5, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cConstitution%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 5, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.max_hp) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 6, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cStrength%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 6, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.strength) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 7, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cEndurance%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 7, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.defense) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 8, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cDexterity%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 8, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.dexterity) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 9, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cIntelligence%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 9, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.intelligence) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    libtcodpy.console_print_rect_ex(
        window, 0, 10, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%cCharisma%c' % (libtcodpy.COLCTRL_2, libtcodpy.COLCTRL_STOP))
    libtcodpy.console_print_rect_ex(
        window, 15, 10, character_screen_width, character_screen_height,
        libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        '%c{0}%c'.format(player.fighter.charisma) %
        (libtcodpy.COLCTRL_4, libtcodpy.COLCTRL_STOP))

    x = screen_width // 2 - character_screen_width // 2
    y = screen_height // 2 - character_screen_height // 2
    libtcodpy.console_blit(window, 0, 0, character_screen_width,
                           character_screen_height, 0, screen_width - 30, 30,
                           1.0, 0.7)
Example #19
0
def render_all(con, panel, entities, player, game_map, fov_map, fov_recompute,
               message_log, screen_width, screen_height, bar_width,
               panel_height, panel_y, mouse, colors, game_state):
    # Draw all the tiles in the game map
    if fov_recompute:
        for y in range(game_map.height):
            for x in range(game_map.width):
                visible = libtcodpy.map_is_in_fov(fov_map, x, y)
                wall = game_map.tiles[x][y].block_sight

                if visible:
                    if wall:
                        libtcodpy.console_put_char(con, x, y, '#',
                                                   libtcodpy.BKGND_SET)
                        libtcodpy.console_set_char_foreground(
                            con, x, y, colors.get('light_wall'))
                    else:
                        libtcodpy.console_put_char(con, x, y, '.',
                                                   libtcodpy.BKGND_SET)
                        libtcodpy.console_set_char_foreground(
                            con, x, y, colors.get('light_ground'))

                    game_map.tiles[x][y].explored = True
                elif game_map.tiles[x][y].explored:
                    if wall:
                        libtcodpy.console_put_char(con, x, y, '#',
                                                   libtcodpy.BKGND_SET)
                        libtcodpy.console_set_char_foreground(
                            con, x, y, colors.get('dark_wall'))
                    else:
                        libtcodpy.console_put_char(con, x, y, '.',
                                                   libtcodpy.BKGND_SET)
                        libtcodpy.console_set_char_foreground(
                            con, x, y, colors.get('dark_ground'))

    entities_in_render_order = sorted(entities,
                                      key=lambda x: x.render_order.value)

    # Draw all entities in the list
    for entity in entities_in_render_order:
        draw_entity(con, entity, fov_map, game_map)

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

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

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

    # Draw health bar
    render_bar(panel, 1, 2, bar_width, 'HP', player.fighter.hp,
               player.fighter.max_hp, libtcodpy.Color(245, 56, 2),
               libtcodpy.Color(138, 20, 0))
    libtcodpy.console_print_ex(
        panel, 1, 4, libtcodpy.BKGND_NONE, libtcodpy.LEFT,
        'Dungeon Level: {0}'.format(game_map.dungeon_level))

    # Draw names
    libtcodpy.console_set_default_foreground(panel,
                                             libtcodpy.Color(231, 93, 16))
    libtcodpy.console_print_ex(panel, 1, 0, libtcodpy.BKGND_NONE,
                               libtcodpy.LEFT,
                               get_names_under_mouse(mouse, entities, fov_map))

    libtcodpy.console_blit(panel, 0, 0, screen_width, panel_height, 0, 0,
                           panel_y)

    # Draw Inventory
    if game_state in (GameStates.SHOW_INVENTORY, GameStates.DROP_INVENTORY):
        if game_state == GameStates.SHOW_INVENTORY:
            inventory_title = 'Inventory'
            color = libtcodpy.Color(66, 190, 255)
        else:
            inventory_title = 'Inventory'
            color = libtcodpy.Color(169, 0, 32)

        inventory_menu(con, inventory_title, player, 50, screen_width,
                       screen_height, color)

    elif game_state == GameStates.LEVEL_UP:
        level_up_menu(con, 'Level up! Choose a stat to raise:', player, 40,
                      screen_width, screen_height)

    # elif game_state == GameStates.CHARACTER_SCREEN:
    character_screen(player, 30, 15, screen_width, screen_height)
    character_equipment_screen(player, 30, 10, screen_width)
    help_screen(30, 15, screen_width)

    # Draw Inventory on Side
    if game_state not in (GameStates.SHOW_INVENTORY,
                          GameStates.DROP_INVENTORY):
        inventory_menu(con, 'Inventory', player, 50, screen_width,
                       screen_height, libtcodpy.Color(121, 121, 121))