# Path: console.py
# class ConsoleVisual(object):
#     def __init__(self, width, height):
#     def get_color_fg(self, position):
#     def get_color_bg(self, position):
#     def get_symbol(self, position):
#     def get_default_color_fg(self):
#     def get_default_color_bg(self):
#     def set_default_color_fg(self, color, console=0):
#     def set_default_color_bg(self, color, console=0):
#     def set_symbol(self, position, icon, console=0):
#     def set_color_fg(self, position, color, console=0):
#     def set_color_bg(self, position, color, effect=libtcod.BKGND_SET, console=0):
#     def print_text(self, position, text):
#     def print_text_vertical(self, position, text):
#     def set_colors_and_symbol(self, position, color_fg, color_bg, icon, console=0):
#     def print_char_big(self, icon_position, destination, console=0):
#     def flush(self):
#     def print_screen(self):


import colors
import constants
import geometry as geo
import settings
from console import console
    def dungeon_to_screen_position(self, position):
        return geo.add_2d(geo.sub_2d(position, self.camera_offset),
                          self.screen_position)

    def screen_to_dungeon_position(self, position):
        return geo.sub_2d(geo.add_2d(position, self.camera_offset),
                          self.screen_position)

    def scroll_graze_delta(self, position):
        x_delta = 0
        y_delta = 0
        x_delta += max(0, self.x_graze_edge[0] - position[0])
        x_delta -= max(0, position[0] - self.x_graze_edge[1])
        y_delta += max(0, self.y_graze_edge[0] - position[1])
        y_delta -= max(0, position[1] - self.y_graze_edge[1])
        return - x_delta, - y_delta

    def update(self, player):
        position = player.position.value
        delta = self.scroll_graze_delta(self.dungeon_to_screen_position(position))
        self.camera_offset = geo.add_2d(self.camera_offset, delta)

    def center_on_entity(self, entity):
        position = entity.position.value
        delta = geo.sub_2d(position, self.screen_center_position)
        self.camera_offset = geo.add_2d(self.camera_offset, delta)

    def draw_graze_rect(self):
        for x in range(self.x_graze_edge[0], self.x_graze_edge[1]):
            console.set_color_bg((x, self.y_graze_edge[0]), colors.YELLOW)

# Path: console.py
# class ConsoleVisual(object):
#     def __init__(self, width, height):
#     def get_color_fg(self, position):
#     def get_color_bg(self, position):
#     def get_symbol(self, position):
#     def get_default_color_fg(self):
#     def get_default_color_bg(self):
#     def set_default_color_fg(self, color, console=0):
#     def set_default_color_bg(self, color, console=0):
#     def set_symbol(self, position, icon, console=0):
#     def set_color_fg(self, position, color, console=0):
#     def set_color_bg(self, position, color, effect=libtcod.BKGND_SET, console=0):
#     def print_text(self, position, text):
#     def print_text_vertical(self, position, text):
#     def set_colors_and_symbol(self, position, color_fg, color_bg, icon, console=0):
#     def print_char_big(self, icon_position, destination, console=0):
#     def flush(self):
#     def print_screen(self):


# Path: camera.py
import colors
import constants
import geometry as geo
import settings
from console import console

    def dungeon_to_screen_position(self, position):
        return geo.add_2d(geo.sub_2d(position, self.camera_offset),
                          self.screen_position)

    def screen_to_dungeon_position(self, position):
        return geo.sub_2d(geo.add_2d(position, self.camera_offset),
                          self.screen_position)

    def scroll_graze_delta(self, position):
        x_delta = 0
        y_delta = 0
        x_delta += max(0, self.x_graze_edge[0] - position[0])
        x_delta -= max(0, position[0] - self.x_graze_edge[1])
        y_delta += max(0, self.y_graze_edge[0] - position[1])
        y_delta -= max(0, position[1] - self.y_graze_edge[1])
        return - x_delta, - y_delta

    def update(self, player):
        position = player.position.value
        delta = self.scroll_graze_delta(self.dungeon_to_screen_position(position))
        self.camera_offset = geo.add_2d(self.camera_offset, delta)

    def center_on_entity(self, entity):
        position = entity.position.value
        delta = geo.sub_2d(position, self.screen_center_position)
        self.camera_offset = geo.add_2d(self.camera_offset, delta)

    def draw_graze_rect(self):
        for x in range(self.x_graze_edge[0], self.x_graze_edge[1]):
            console.set_color_bg((x, self.y_graze_edge[0]), colors.YELLOW)

            console.set_color_bg((x, self.y_graze_edge[1]), colors.YELLOW)