本文整理汇总了Python中pyglet.text.Label.end_update方法的典型用法代码示例。如果您正苦于以下问题:Python Label.end_update方法的具体用法?Python Label.end_update怎么用?Python Label.end_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglet.text.Label
的用法示例。
在下文中一共展示了Label.end_update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Hud
# 需要导入模块: from pyglet.text import Label [as 别名]
# 或者: from pyglet.text.Label import end_update [as 别名]
class Hud(object):
"""docstring for Hud"""
def __init__(self, batch, window):
super(Hud, self).__init__()
self.text_ = 'This is the warmup phase'
self.hp_t = '-1'
self.armor_t = '-1'
self.text_active = 5
self.killmsg_active = False
self.chat_active = False
self.batch = batch
self.scale = vec2(window.width / 1280., window.height / 720.)
self.hp = Label(self.hp_t, font_name=font, font_size=36,
bold=True, x=80, y=10, anchor_x='center',
anchor_y='bottom',
batch=self.batch)
self.armor = Label(self.armor_t, font_name=font, font_size=36,
x=240, y=10, anchor_x='center', anchor_y='bottom',
bold=True,
batch=self.batch)
self.text = Label(self.text_, font_name=font, font_size=36,
x=640, y=360, anchor_x='center', anchor_y='center',
batch=self.batch)
self.weapon = Label('melee', font_name=font, font_size=32,
x=1160, y=80, anchor_x='center', anchor_y='bottom',
color=(0, 255, 255, 255),
batch=self.batch)
self.ammo = Label('1', font_name=font, font_size=36,
x=1160, y=10, anchor_x='center', anchor_y='bottom',
bold=True,
batch=self.batch)
self.time = Label('0:00', font_name=font, font_size=36,
x=640, y=680, anchor_x='center', anchor_y='center',
bold=True,
batch=self.batch)
self.chatdoc = FormattedDocument('\n' * 11)
#self.chatlog = document .FormattedDocument('\n')
self.chat = ScrollableTextLayout(self.chatdoc, width=500,
height=208, multiline=True,
batch=self.batch)
self.chat.x = 130
self.chat.y = 130
self.chat.content_valign = 'bottom'
self.killdoc = FormattedDocument('\n')
self.killmsg = ScrollableTextLayout(self.killdoc, width=300,
height=104, multiline=True,
batch=self.batch)
self.killmsg.x = 20
self.killmsg.y = 600
self.scoredoc = FormattedDocument('0 : 0')
self.score = ScrollableTextLayout(self.scoredoc, width=150,
height=104, multiline=True,
batch=self.batch)
self.score.x = 1270
self.score.y = 650
self.score.anchor_x = 'right'
self.score.anchor_y = 'center'
self.normal_hpcol = (255, 255, 255, 255)
self.low_hpcol = (255, 128, 0, 255)
self.high_hpcol = (0, 204, 255, 255)
self.bname = '_'
self.aname = '_'
self.gametime = 70
self.weaponcolors = {proto.melee: (0, 255, 255, 255),
proto.explBlaster: (255, 255, 0, 255)}
self.killmsg_count = 0
self.scoreboard = None
self.weaponbar = WeaponBar(self.batch, self.scale)
self.do_scale()
def do_scale(self):
for item in (self.armor, self.hp, self.text, self.chat, self.killmsg,
self.time, self.ammo, self.weapon, self.score):
item.x *= self.scale.x
item.y *= self.scale.y
def init_player(self, players):
if len(players) == 0:
self.set_score(0, 0)
else:
self.bname = players.values()[0].name
self.set_score(0, 0)
self.init_pers_hud()
def init_pers_hud(self):
if self.hp._vertex_lists:
self.weaponbar.batch = self.batch
self.weapon.batch = self.batch
self.ammo.batch = self.batch
self.hp.batch = self.batch
self.armor.begin_update()
self.armor.batch = self.batch
self.armor.end_update()
def init_spec(self):
self.weaponbar.remove()
self.weapon.delete()
#.........这里部分代码省略.........