当前位置: 首页>>代码示例>>Python>>正文


Python TextNode.setGlyphScale方法代码示例

本文整理汇总了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))
开发者ID:JingLu92,项目名称:pyff,代码行数:30,代码来源:Hexagon.py

示例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
开发者ID:garym,项目名称:Azure--Infinite-Skies,代码行数:19,代码来源:gui.py

示例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
#.........这里部分代码省略.........
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:103,代码来源:Nametag.py


注:本文中的pandac.PandaModules.TextNode.setGlyphScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。