本文整理汇总了Python中panda3d.core.TextNode.setGlyphShift方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setGlyphShift方法的具体用法?Python TextNode.setGlyphShift怎么用?Python TextNode.setGlyphShift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.TextNode
的用法示例。
在下文中一共展示了TextNode.setGlyphShift方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setGlyphShift [as 别名]
class Nametag:
TEXT_WORD_WRAP = 8
TEXT_Y_OFFSET = -0.05
CHAT_TEXT_WORD_WRAP = 12
PANEL_X_PADDING = 0.2
PANEL_Z_PADDING = 0.2
CHAT_BALLOON_ALPHA = 1
def __init__(self):
self.avatar = None
self.panel = None
self.icon = None
self.chatBalloon = None
self.chatButton = NametagGlobals.noButton
self.chatReversed = False
self.font = None
self.chatFont = None
self.chatType = NametagGlobals.CHAT
self.chatBalloonType = NametagGlobals.CHAT_BALLOON
self.nametagColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal]
self.arrowColor = NametagGlobals.NametagColors[NametagGlobals.CCNormal]
self.chatColor = NametagGlobals.ChatColors[NametagGlobals.CCNormal]
self.speedChatColor = self.chatColor[0][1]
self.nametagHidden = False
self.chatHidden = False
self.thoughtHidden = False
# Create our TextNodes:
self.textNode = TextNode('text')
self.textNode.setWordwrap(self.TEXT_WORD_WRAP)
self.textNode.setAlign(TextNode.ACenter)
self.chatTextNode = TextNode('chatText')
self.chatTextNode.setWordwrap(self.CHAT_TEXT_WORD_WRAP)
self.chatTextNode.setGlyphScale(ChatBalloon.TEXT_GLYPH_SCALE)
self.chatTextNode.setGlyphShift(ChatBalloon.TEXT_GLYPH_SHIFT)
# Add the tick task:
self.tickTaskName = self.getUniqueName() + '-tick'
self.tickTask = taskMgr.add(self.tick, self.tickTaskName, sort=45)
def destroy(self):
if self.tickTask is not None:
taskMgr.remove(self.tickTask)
self.tickTask = None
self.chatTextNode = None
self.textNode = None
self.chatFont = None
self.font = None
self.chatButton = NametagGlobals.noButton
if self.chatBalloon is not None:
self.chatBalloon.removeNode()
self.chatBalloon = None
if self.icon is not None:
self.icon.removeAllChildren()
self.icon = None
if self.panel is not None:
self.panel.removeNode()
self.panel = None
self.avatar = None
def getUniqueName(self):
return 'Nametag-' + str(id(self))
def getChatBalloonModel(self):
pass # Inheritors should override this method.
def getChatBalloonWidth(self):
pass # Inheritors should override this method.
def getChatBalloonHeight(self):
pass # Inheritors should override this method.
def tick(self, task):
return Task.done # Inheritors should override this method.
def updateClickRegion(self):
pass # Inheritors should override this method.
def drawChatBalloon(self, model, modelWidth, modelHeight):
pass # Inheritors should override this method.
def drawNametag(self):
pass # Inheritors should override this method.
#.........这里部分代码省略.........