本文整理匯總了Python中direct.gui.DirectLabel.DirectLabel.setDepthWrite方法的典型用法代碼示例。如果您正苦於以下問題:Python DirectLabel.setDepthWrite方法的具體用法?Python DirectLabel.setDepthWrite怎麽用?Python DirectLabel.setDepthWrite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類direct.gui.DirectLabel.DirectLabel
的用法示例。
在下文中一共展示了DirectLabel.setDepthWrite方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: HUD
# 需要導入模塊: from direct.gui.DirectLabel import DirectLabel [as 別名]
# 或者: from direct.gui.DirectLabel.DirectLabel import setDepthWrite [as 別名]
class HUD():
def __init__(self):
self.canPlantLabel = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.15,
pos=(0, 0, 0.25),
pad=(0.2,0.2),
text=_("Plant Seed"))
self.canPlantLabel.setTransparency(True)
self.canPlantLabel.reparentTo(base.a2dBottomCenter)
self.canPlantLabel.hide()
self.speekLabel = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.15,
pos=(0, 0, 0.5),
pad=(0.2,0.2),
text="...")
self.speekLabel.reparentTo(render)
self.speekLabel.hide()
self.speekLabel.setTransparency(True)
self.speekLabel.setEffect(BillboardEffect.makePointEye())
self.speekLabel.setBin("fixed", 11)
self.speekLabel.setDepthWrite(False)
self.storyText = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.08,
pos=(0, 0, 0.25),
pad=(0.2,0.2),
text="Story text")
self.storyText.setTransparency(True)
self.storyText.reparentTo(base.a2dBottomCenter)
self.storyText.hide()
self.points = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(0.05, 0, -0.1),
pad=(0.2,0.2),
text_align=TextNode.ALeft,
text=_("Points: %d")%0)
self.points.setTransparency(True)
self.points.reparentTo(base.a2dTopLeft)
self.playerWater = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(0.05, 0, -0.2),
pad=(0.2,0.2),
text_align=TextNode.ALeft,
text=_("Remaining Water: %d")%100)
self.playerWater.setTransparency(True)
self.playerWater.reparentTo(base.a2dTopLeft)
self.helpInfo = DirectLabel(
frameColor=(0, 0, 0, 0.25),
text_fg=(1, 1, 1, 1),
scale=0.075,
pos=(-0.05, 0, -0.1),
pad=(0.2,0.2),
text_align=TextNode.ARight,
text=_("F1 - show help"))
self.helpInfo.setTransparency(True)
self.helpInfo.reparentTo(base.a2dTopRight)
self.hide()
def show(self):
self.points.show()
self.playerWater.show()
self.helpInfo.show()
def hide(self):
self.points.hide()
self.playerWater.hide()
self.helpInfo.hide()
def hideAll(self):
self.canPlantLabel.hide()
self.speekLabel.hide()
self.points.hide()
self.playerWater.hide()
self.helpInfo.hide()
def showStory(self):
self.storyText.show()
def hideStory(self):
self.storyText.hide()
def cleanup(self):
self.hideAll()
self.canPlantLabel.destroy()
#.........這裏部分代碼省略.........