本文整理汇总了Python中pandac.PandaModules.TextNode.setGlyphScale方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setGlyphScale方法的具体用法?Python TextNode.setGlyphScale怎么用?Python TextNode.setGlyphScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.TextNode
的用法示例。
在下文中一共展示了TextNode.setGlyphScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_text_fields
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setGlyphScale [as 别名]
def _create_text_fields(self, radius, width):
test_letter = 'W'
# the larger back side text field
x,z = 0,0
y = (width/2.0+Hexagon.text_distance)
text = TextNode('')
#font = loader.loadFont("cmss12.egg")
#text.setFont(font)
text.setGlyphScale(1.1*radius)
text.setTextColor(0,0,0,1)
self.back_side_text = self.root_node_path.attachNewNode(text)
self.back_side_text.node().setText(test_letter)
self.back_side_text.setH(180)
center_node_on_xyz(self.back_side_text, x, y, z)
self.back_side_text_z = self.back_side_text.getZ()
# the six front side text fields
self.front_side_text_coordinates = []
for _i, phi in enumerate(range(0,360,60)):
text = TextNode('')
#text.setFont(font)
text.setGlyphScale(0.45*radius)
text.setTextColor(0,0,0,1)
text_path = self.root_node_path.attachNewNode(text)
self.front_side_text.append(text_path)
x,z = rotate_phi_degrees_clockwise(phi, (0,radius/1.6))
text_path.node().setText(test_letter)
center_node_on_xyz(text_path, x, -y, z)
self.front_side_text_coordinates.append((x,-y,z))
示例2: createText
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setGlyphScale [as 别名]
def createText(self, text, pos=(0.0, 0.0), align=TextNode.ACenter, scale=None, colour=None):
if colour is None:
colour = self.colour
if scale is None:
scale = self.default_element_scale
text_node = TextNode("text")
text_node.setText(text)
text_node.setGlyphScale(scale)
text_node.setAlign(align)
text_node.setFont(self.unicodefont)
text_node.setTextColor(colour[0], colour[1], colour[2], colour[3])
generated_text = text_node.generate()
text_node_path = render2d.attachNewNode(generated_text)
text_node_path.setPos(pos[0], 0.0, pos[1])
return text_node, text_node_path
示例3: __init__
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setGlyphScale [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.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
self.removeBalloon()
self.removeIcon()
self.removePanel()
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.
def setAvatar(self, avatar):
self.avatar = avatar
def getAvatar(self):
return self.avatar
def setIcon(self, icon):
self.icon = icon
#.........这里部分代码省略.........