本文整理汇总了Python中console.Console.draw_border方法的典型用法代码示例。如果您正苦于以下问题:Python Console.draw_border方法的具体用法?Python Console.draw_border怎么用?Python Console.draw_border使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类console.Console
的用法示例。
在下文中一共展示了Console.draw_border方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import draw_border [as 别名]
#.........这里部分代码省略.........
self.player = Player(self, self.next_id(),
0, 0, 0, False, True,
input_handler = InputHandler(),
creature = player_creature)
self.add_entity(self.player)
for name in self.materials:
self.player.materials[self.materials[name]] = 0
for ability in self.abilities.values():
self.player.add_observer(ability)
ability.add_observer(self.player.input_handler)
for word_id in self.words:
self.player.words.append(self.words[word_id])
def clear_all(self):
for entity in self.entities:
entity.clear(self.player.x,
self.player.y,
self.map_con)
def get_entity(self,entity_id):
for entity in self.entities:
if entity.entity_id == entity_id:
return entity
def get_creature_at(self,x,y):
return self.cur_level.get_tile(x,y).creature
def get_item_at(self,x,y):
return self.cur_level.get_tile(x,y).item
def render_panel(self):
self.panel_con.clear()
self.panel_con.draw_border(True,C_BORDER,C_BORDER_BKGND)
y = 2
if SHOW_FPS:
x=2
self.panel_con.set_default_foreground(C_MENU)
self.panel_con.print_string(x,y,'FPS: %i'%self.fps)
y += 1
y += 1
for part_name in ['Head','Torso','L Arm','R Arm','L Leg','R Leg']:
part = self.player.creature.body_parts[part_name]
part_name = '%s:'%part.name
part_health = '%i/%i'%(part.health,part.max_health)
x = 2
self.panel_con.set_default_foreground(C_MENU)
self.panel_con.print_string(x,y,part_name)
x = 9
self.panel_con.set_default_foreground(libtcod.light_red)
self.panel_con.print_string(x,y,part_health)
y += 1
status_effects = []
for bp in self.player.creature.body_parts.values():
status_effects += bp.status_effects
if status_effects:
y += 1
for se in status_effects:
if se.name:
x = 2
self.panel_con.set_default_foreground(C_MENU)
self.panel_con.print_string(x,y,se.name)
y += 1