Beispiel #1
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, colors):
    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_set_char_background(
                            con, x, y, COLORS.get('light_wall'),
                            libtcod.BKGND_SET)
                    else:
                        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:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('dark_wall'),
                            libtcod.BKGND_SET)
                    else:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('dark_ground'),
                            libtcod.BKGND_SET)

    # Draw all entities in the list

    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)

    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_blit(panel, 0, 0, screen_width, panel_height, 0, 0,
                         panel_y)
    def plot_poverty_breakdown(self):
        # Labels for training
        labels = self.data.loc[(self.data['Target'].notnull()) & (self.data['parentesco1'] == 1),
                                ['Target', 'idhogar']]

        # Value counts of target
        label_counts = labels['Target'].value_counts().sort_index()

        f, ax = plt.subplots(figsize=(8, 6))

        # Bar plot of occurrences of each label
        label_counts.plot.bar(figsize = (8, 6), 
                              color = COLORS.values(),
                              edgecolor = 'k', linewidth = 2)

        # Formatting
        plt.xlabel('Poverty Level')
        plt.ylabel('Count')
        plt.xticks([x - 1 for x in POVERTY_MAPPING.keys()], 
                   list(POVERTY_MAPPING.values()), rotation = 30)
        plt.title('Poverty Level Breakdown')
        plt.tight_layout()

        # return as bytes image
        bytes_image = io.BytesIO()
        plt.savefig(bytes_image, format='png')
        bytes_image.seek(0)
        return bytes_image
Beispiel #3
0
def render_all(con, panels, entities, player, game_map, fov, message_log,
               game_state, camera):
    camera.move_camera(player, fov)
    if fov.recompute:
        fov.recompute = False
        fov.recompute_fov(player)
        libtcod.console_clear(con)
        for y in range(camera.height):
            for x in range(camera.width):
                (map_x, map_y) = (int(camera.x + x), int(camera.y + y))
                visible = libtcod.map_is_in_fov(fov.map, map_x, map_y)
                wall = game_map.tiles[map_x][map_y].block_sight
                if visible:
                    if wall:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('light_wall'),
                            libtcod.BKGND_SET)
                    else:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('light_ground'),
                            libtcod.BKGND_SET)
                    game_map.tiles[map_x][map_y].explored = True
                elif game_map.tiles[map_x][map_y].explored:
                    if wall:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('dark_wall'),
                            libtcod.BKGND_SET)
                    else:
                        libtcod.console_set_char_background(
                            con, x, y, COLORS.get('dark_ground'),
                            libtcod.BKGND_SET)
    # Draw all entities in the list
    entities_in_render_order = sorted(entities, key=lambda x: x.render.value)
    for entity in entities_in_render_order:
        draw_entity(con, entity, fov.map, camera)
    libtcod.console_blit(con, 0, 0, con.width, con.height, 0, 0, 0)
    for panel in panels:
        panel.draw(message_log)
    if game_state == GameStates.SHOW_INVENTORY:
        inventory_menu(con, player.inventory, 50)
Beispiel #4
0
def get_vodcast_color():
    color = int(kodi.get_setting('vodcast_highlight'))
    color = COLORS.split('|')[color]
    return color.decode('utf-8')
Beispiel #5
0
def get_vodcast_color():
    color = int(kodi.get_setting('vodcast_highlight'))
    color = COLORS.split('|')[color]
    return color.decode('utf-8')