def draw(self): if self.board.fov_recalculate: self.board.fov_recalculate = False ltc.map_compute_fov(self.board.map_fov,self.player.pos_x,self.player.pos_y, self.board.fov_torch_radius, self.board.fov_light_walls, self.board.fov_algo ) self.board.draw() self.cursor.draw() for index,character in enumerate(self.characters): character.draw() # draws all the cons for name,number in constants.layers.iteritems(): ltc.console_blit(self.layers[number],0,0,self.settings_screenSize[0], self.settings_screenSize[1],0,0,0) ltc.console_flush() for index,character in enumerate(self.characters): character.clear()
def render_loop(console, objects, bars, root_width, root_height): for object in objects.values(): object.draw() tcod.console_blit(console['root'].panel, 0, 0, root_width, root_height, 0, 0, 0) tcod.console_blit(console['map'].panel, 0, 0, root_width, root_height, console['root'].panel, 0, 0) render_health_bars(console['health'].panel, bars, console['root'].panel) render_chat(console['chat'].panel,root_width,root_height) tcod.console_flush() sleep(0.075)
def render_chat(console,w,h): tcod.console_set_default_foreground(console, tcod.white) tcod.console_set_default_background(console, tcod.black) tcod.console_print_frame(console, 0, parser.OPTIONS['game']['tileheight'] - 7, w, 7, True, tcod.BKGND_SET) ## print the game messages, one line at a time y = parser.OPTIONS['game']['tileheight'] - 6 for (line, color) in game.game_msgs: tcod.console_set_default_foreground(console, color) tcod.console_print_ex(console, 1, y, tcod.BKGND_NONE, tcod.LEFT, line) y +=1 tcod.console_blit(console, 0, 0, w, h, console, 0, 0)
def render_health_bars(panel, bars, dest): i = 0 for bar in bars.values(): if parser.OPTIONS['game']['debug'] is True: barf.Barf('DBG', 'Rendering %s' % panel) i += 1 render_panel(panel, bar, bar.x, bar.y, 1, i) #tcod.console_blit(panel, bar.x, bar.y, bar.width, 3, dest, bar.x, bar.y) # Health frame tcod.console_set_default_background(panel, tcod.Color(20, 20, 45)) tcod.console_print_frame(panel, 0, 0, 22, 5, False, tcod.BKGND_SET) tcod.console_blit(panel, 0, 0, 22, 5, dest, 0, 0) # Health frame tcod.console_print_frame(panel, 0, 0, 22, 5, False, tcod.BKGND_DEFAULT) tcod.console_blit(panel, 0, 0, 22, 5, dest, 0, 0)