def __init__(self, root_console_width, root_console_height, frame_manager): self.entity_manager = frame_manager.parent_menu.entity_manager # load xp for bg console_bg_xp = gzip.open('assets\\ui\\ui_frame_libraries_bg.xp') self.bg_data = xp_loader.load_xp_string(console_bg_xp.read()) Frame.__init__(self, root_console_width, root_console_height, self.bg_data['width'], self.bg_data['height'], frame_manager) library_start_xy = xp_loader.get_position_key_xy( self.bg_data['layer_data'][1], xp_loader.poskey_color_red) self.library_start_xy = Vec2d(library_start_xy[0], library_start_xy[1]) self.library_line_extent = xp_loader.get_position_key_xy( self.bg_data['layer_data'][1], xp_loader.poskey_color_green) #TODO put these in config somewhere self.line_char = chr(196) self.line_bg = libtcod.Color(2, 22, 12) self.line_fg = libtcod.Color(6, 130, 60) self.libname_fg = libtcod.Color(102, 255, 178) libtcod.console_set_default_background(self.console, self.line_bg) libtcod.console_set_default_foreground(self.console, self.libname_fg) libtcod.console_set_alignment(self.console, libtcod.LEFT) xp_loader.load_layer_to_console(self.console, self.bg_data['layer_data'][0])
def __init__(self, root_console_width, root_console_height, start_x, frame_height, frame_manager): #TODO make and load .XP file with background, and arrange it to have an autoextending background Frame.__init__(self, root_console_width, root_console_height, root_console_width - start_x, frame_height, frame_manager) self.start_x = start_x
def __init__(self, root_console_width, root_console_height, frame_manager): self.entity_manager = frame_manager.parent_menu.entity_manager # load xp for bg console_bg_xp = gzip.open('assets\\ui\\ui_frame_libraries_bg.xp') self.bg_data = xp_loader.load_xp_string(console_bg_xp.read()) Frame.__init__(self, root_console_width, root_console_height, self.bg_data['width'], self.bg_data['height'], frame_manager) library_start_xy = xp_loader.get_position_key_xy(self.bg_data['layer_data'][1], xp_loader.poskey_color_red) self.library_start_xy = Vec2d(library_start_xy[0], library_start_xy[1]) self.library_line_extent = xp_loader.get_position_key_xy(self.bg_data['layer_data'][1], xp_loader.poskey_color_green) #TODO put these in config somewhere self.line_char = chr(196) self.line_bg = libtcod.Color(2, 22, 12) self.line_fg = libtcod.Color(6, 130, 60) self.libname_fg = libtcod.Color(102, 255, 178) libtcod.console_set_default_background(self.console,self.line_bg) libtcod.console_set_default_foreground(self.console,self.libname_fg) libtcod.console_set_alignment(self.console, libtcod.LEFT) xp_loader.load_layer_to_console(self.console, self.bg_data['layer_data'][0])
def __init__(self, root_console_width, root_console_height, world_x_start, world_y_start, frame_manager): Frame.__init__(self, root_console_width, root_console_height, root_console_width - world_x_start, root_console_height - world_y_start, frame_manager) self.entity_manager = frame_manager.parent_menu.entity_manager self.world_x_start = world_x_start self.world_y_start = world_y_start
def __init__(self, root_console_width, root_console_height, world_x_start, world_y_start, frame_manager): #TODO manage offset of code Frame.__init__(self, root_console_width, root_console_height, root_console_width - world_x_start, root_console_height - world_y_start, frame_manager) self.world_x_start = world_x_start self.world_y_start = world_y_start self.entity_manager = frame_manager.parent_menu.entity_manager self.actions = [] libtcod.console_set_default_background(self.console, libtcod.Color(255, 0, 255)) libtcod.console_set_key_color(self.console, libtcod.Color(255, 0, 255))
def __init__(self, root_console_width, root_console_height, start_y, frame_manager): # constants and initialization self.current_action_count = 0 self.max_actions = 0 self.highlighted_tile_count = 0 self.y_blit_offset = start_y self.entity_manager = frame_manager.parent_menu.entity_manager # load xp for bg console_bg_xp = gzip.open('assets\\ui\\ui_frame_actionclock_bg.xp') self.bg_data = xp_loader.load_xp_string(console_bg_xp.read()) Frame.__init__(self, root_console_width, root_console_height, self.bg_data['width'], self.bg_data['height'], frame_manager) xp_loader.load_layer_to_console(self.console, self.bg_data['layer_data'][0]) queued_actions_display_start = None queued_actions_display_end = None #scrape the xp file for position markers for action clock bar and text for actions remaining x = 0 for row in self.bg_data['layer_data'][1]['cells']: y = 0 for cell in row: if cell['fore_r'] == 255 and cell['fore_g'] == 0 and cell[ 'fore_b'] == 0: self.remaining_actions_display_position = Vec2d(x, y) if cell['fore_r'] == 0 and cell['fore_g'] == 0 and cell[ 'fore_b'] == 255: self.max_actions_display_position = Vec2d(x, y) elif cell['fore_r'] == 255 and cell['fore_g'] == 255 and cell[ 'fore_b'] == 0: queued_actions_display_start = Vec2d(x, y) elif cell['fore_r'] == 0 and cell['fore_g'] == 255 and cell[ 'fore_b'] == 0: queued_actions_display_end = Vec2d(x, y) elif cell['fore_r'] == 0 and cell['fore_g'] == 255 and cell[ 'fore_b'] == 0: queued_actions_display_end = Vec2d(x, y) y += 1 x += 1 self.queued_actions_display_start = queued_actions_display_start self.queued_actions_bar_width = queued_actions_display_end[ 0] - queued_actions_display_start[0]
def __init__(self, root_console_width, root_console_height, terminal_width, terminal_height, frame_manager): # constants and initialization self.prompt_string = "X:\\>" self.input_command = "" self.blinking_cursor = "_" self.cursor_blink_delay = 500 self.cursor_timer = 0 self.console_command_history = [] self.console_max_history_length = terminal_height - 2 self.input_enabled = True Frame.__init__(self, root_console_width, root_console_height, terminal_width, terminal_height, frame_manager) #-1 to account for border tile self.max_command_size = self.width - len(self.prompt_string) - 1 libtcod.console_set_key_color(self.console, libtcod.Color(255, 0, 255))
def __init__(self, root_console_width, root_console_height, start_y, frame_manager): # constants and initialization self.current_action_count = 0 self.max_actions = 0 self.highlighted_tile_count = 0 self.y_blit_offset = start_y self.entity_manager = frame_manager.parent_menu.entity_manager # load xp for bg console_bg_xp = gzip.open('assets\\ui\\ui_frame_actionclock_bg.xp') self.bg_data = xp_loader.load_xp_string(console_bg_xp.read()) Frame.__init__(self, root_console_width, root_console_height, self.bg_data['width'], self.bg_data['height'], frame_manager) xp_loader.load_layer_to_console(self.console, self.bg_data['layer_data'][0]) queued_actions_display_start = None queued_actions_display_end = None #scrape the xp file for position markers for action clock bar and text for actions remaining x = 0 for row in self.bg_data['layer_data'][1]['cells']: y = 0 for cell in row: if cell['fore_r'] == 255 and cell['fore_g'] == 0 and cell['fore_b'] == 0: self.remaining_actions_display_position = Vec2d(x, y) if cell['fore_r'] == 0 and cell['fore_g'] == 0 and cell['fore_b'] == 255: self.max_actions_display_position = Vec2d(x, y) elif cell['fore_r'] == 255 and cell['fore_g'] == 255 and cell['fore_b'] == 0: queued_actions_display_start = Vec2d(x, y) elif cell['fore_r'] == 0 and cell['fore_g'] == 255 and cell['fore_b'] == 0: queued_actions_display_end = Vec2d(x, y) elif cell['fore_r'] == 0 and cell['fore_g'] == 255 and cell['fore_b'] == 0: queued_actions_display_end = Vec2d(x, y) y += 1 x += 1 self.queued_actions_display_start = queued_actions_display_start self.queued_actions_bar_width = queued_actions_display_end[0] - queued_actions_display_start[0]
def __init__(self, root_console_width, root_console_height, start_x, frame_height, frame_manager): # TODO make and load .XP file with background, and arrange it to have an autoextending background Frame.__init__( self, root_console_width, root_console_height, root_console_width - start_x, frame_height, frame_manager ) self.start_x = start_x