def draw(self): #set the color and then draw the character that represents this object at its position if libtcod.map_is_in_fov(fov_map, self.x, self.y): libtcod.console_set_foreground_color(con, self.color) libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
def draw_obj(self, con, x, y, obj): # set the color and then draw the character that represents this object at its position if x is not None: # set the color and then draw the character that represents this object at its position libtcod.console_set_default_foreground(con, obj.color) libtcod.console_put_char(con, x, y, obj.char, libtcod.BKGND_NONE)
def draw_tile(self, x, y, tile, in_fov): con = self.map_console tile_disp = TILE_DISPS[tile.tile_type] if in_fov: tile.explored = True color_mult = 1.0 if in_fov else 0.5 bg = tile_disp.bg * color_mult if tile_disp.bg else None fg = tile_disp.fg * color_mult if tile_disp.fg else None if tile.explored: if tile_disp.char == ' ': libtcod.console_set_char_background(con, x, y, bg, libtcod.BKGND_SET) libtcod.console_set_char(con, x, y, ' ') else: libtcod.console_set_char_background(con, x, y, bg, libtcod.BKGND_SET) libtcod.console_set_default_foreground(con, fg) libtcod.console_put_char(con, x, y, tile_disp.char, libtcod.BKGND_NONE) else: libtcod.console_set_char_background(con, x, y, libtcod.black, libtcod.BKGND_SET) libtcod.console_set_char(con, x, y, ' ')
def draw(self): # only show if it's visible to the player; or it's set to # "always visible" and on an explored tile if (libtcod.map_is_in_fov(fov_map, self.x, self.y) or (self.always_visible and map[self.x][self.y].explored)): # set the color and then draw the character that represents # this object at its position libtcod.console_set_default_foreground(con, self.color) libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
def draw(self): #only show if it's visible to the player in_fov = libtcod.map_is_in_fov(fov_map, self.x, self.y) if (self.ai == None and self.seen) or in_fov: #set the color and then draw the character that represents this object at its position self.seen = True if in_fov: libtcod.console_set_foreground_color(con, self.color) else: libtcod.console_set_foreground_color(con, libtcod.grey) libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
def draw_tile(self, tile, x, y, in_fov): bk_color = tile.bk_color fg_color = tile.fg_color if in_fov: bk_color = bk_color * 2 fg_color = fg_color * 2 libtcod.console_set_char_background( self.con, x, y, bk_color, libtcod.BKGND_SET) libtcod.console_set_default_foreground(self.con, fg_color) libtcod.console_put_char( self.con, x, y, tile.char, libtcod.BKGND_NONE)
def clear(self): libtcod.console_put_char(self.__con, self.__x, self.__y, ' ', libtcod.BKGND_NONE)
def draw(self): if not self.is_in_fov(): return libtcod.console_set_default_foreground(self.__con, self.color) libtcod.console_put_char(self.__con, self.__x, self.__y, self.char, libtcod.BKGND_NONE)
def clear(self): #erase the character that represents this object libtcod.console_put_char(con, self.x, self.y, ' ', libtcod.BKGND_NONE)
libtcod.line(rect.x1, rect.y1, rect.x1, rect.y2, listener) libtcod.line(rect.x2, rect.y1, rect.x2, rect.y2, listener) libtcod.line(rect.x1, rect.y2, rect.x2, rect.y2, listener) if tree.left is not None: trace_sections(tree.left) if tree.right is not None: trace_sections(tree.right) trace_sections(tree) libtcod.console_set_custom_font( 'terminal12x12_gs_ro.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_ASCII_INROW) libtcod.console_init_root( SCREEN_WIDTH, SCREEN_HEIGHT, 'rogue-one', False, libtcod.RENDERER_GLSL) for x in range(SCREEN_WIDTH): for y in range(SCREEN_HEIGHT): col = libtcod.Color(60 * map[x][y], 60 * map[x][y], 60 * map[x][y]) libtcod.console_set_char_background(0, x, y, col) libtcod.console_set_default_foreground(0, libtcod.dark_grey) libtcod.console_put_char(0, x, y, ".") libtcod.console_flush() libtcod.console_wait_for_keypress(True) exit()
def draw(self): libtcod.console_set_default_foreground(self.con, self.color) libtcod.console_put_char(self.con, self.x, self.y, self.char, libtcod.BKGND_NONE)