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


Python TextNode.setFont方法代码示例

本文整理汇总了Python中panda3d.core.TextNode.setFont方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setFont方法的具体用法?Python TextNode.setFont怎么用?Python TextNode.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.TextNode的用法示例。


在下文中一共展示了TextNode.setFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addAvatar

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
    def addAvatar(self, avId, name, damage):
        if self.currentIndex == 0:
            self.addLeaderboardLabel()

        self.avId2Names[avId] = name
        self.avId2Damage[avId] = damage

        text = TextNode('leaderboard-%d' % avId)
        text.setAlign(TextNode.ACenter)
        text.setFlattenFlags(TextNode.FFMedium)
        text.setFont(getSuitFont())
        text.setTextScale(0.05)
        text.setTextColor(*TEXT_WHITE)
        text.setText(name + ': ' + str(damage))
        textNodePath = aspect2d.attachNewNode(text)
        textNodePath.reparentTo(base.a2dTopRight)

        if self.currentIndex:
            self.index2Pos[self.currentIndex] = (-0.35, 0.0, (TEXT_HEIGHT * self.currentIndex) - 0.1)
            textNodePath.setPos(*self.index2Pos[self.currentIndex])
        else:
            self.index2Pos[0] = (-0.35, 0.0, -0.20)
            textNodePath.setPos(*self.index2Pos[0])

        self.currentIndex += 1

        self.avId2Nodes[avId] = [textNodePath, text]
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:29,代码来源:BossBattleLeaderboard.py

示例2: loadGUI

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def loadGUI(self):
     self.gui = loader.loadModel('phase_13/models/parties/trampolineGUI')
     self.gui.reparentTo(base.a2dTopLeft)
     self.gui.setPos(0.115, 0, -1)
     self.gui.hide()
     self.toonIndicator = self.gui.find('**/trampolineGUI_MovingBar')
     jumpLineLocator = self.gui.find('**/jumpLine_locator')
     guiBean = self.gui.find('**/trampolineGUI_GreenJellyBean')
     self.gui.find('**/trampolineGUI_GreenJellyBean').stash()
     self.guiBeans = [ guiBean.instanceUnderNode(jumpLineLocator, self.uniqueName('guiBean%d' % i)) for i in xrange(self.numJellyBeans) ]
     self.guiBeans[-1].setScale(1.5)
     heightTextNode = TextNode(self.uniqueName('TrampolineActivity.heightTextNode'))
     heightTextNode.setFont(ToontownGlobals.getSignFont())
     heightTextNode.setAlign(TextNode.ALeft)
     heightTextNode.setText('0.0')
     heightTextNode.setShadow(0.05, 0.05)
     heightTextNode.setShadowColor(0.0, 0.0, 0.0, 1.0)
     heightTextNode.setTextColor(1.0, 1.0, 1.0, 1.0)
     self.heightText = jumpLineLocator.attachNewNode(heightTextNode)
     self.heightText.setX(0.15)
     self.heightText.setScale(0.1)
     self.heightText.setAlphaScale(0.0)
     self.quitEarlyButtonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
     quitEarlyUp = self.quitEarlyButtonModels.find('**//InventoryButtonUp')
     quitEarlyDown = self.quitEarlyButtonModels.find('**/InventoryButtonDown')
     quitEarlyRollover = self.quitEarlyButtonModels.find('**/InventoryButtonRollover')
     self.quitEarlyButton = DirectButton(parent=base.a2dTopRight, relief=None, text=TTLocalizer.PartyTrampolineQuitEarlyButton, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.7, image=(quitEarlyUp, quitEarlyDown, quitEarlyRollover), image_color=(1, 0, 0, 1), image_scale=(20, 1, 11), pos=(-0.183, 0, -0.4), scale=0.09, command=self.leaveTrampoline)
     self.quitEarlyButton.stash()
     self.flashText = OnscreenText(text='', pos=(0.0, -0.45), scale=0.2, fg=(1.0, 1.0, 0.65, 1.0), align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
     self.timer = PartyUtils.getNewToontownTimer()
     self.timer.posInTopRightCorner()
     return
开发者ID:nate97,项目名称:src,代码行数:34,代码来源:DistributedPartyTrampolineActivity.py

示例3: attachHostNameToSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def attachHostNameToSign(self, locator):
     if self.hostName == '':
         return
     nameText = TextNode('nameText')
     nameText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
     nameText.setCardDecal(True)
     nameText.setCardColor(1.0, 1.0, 1.0, 0.0)
     r = 232.0 / 255.0
     g = 169.0 / 255.0
     b = 23.0 / 255.0
     nameText.setTextColor(r, g, b, 1)
     nameText.setAlign(nameText.ACenter)
     nameText.setFont(ToontownGlobals.getBuildingNametagFont())
     nameText.setShadowColor(0, 0, 0, 1)
     nameText.setBin('fixed')
     if TTLocalizer.BuildingNametagShadow:
         nameText.setShadow(*TTLocalizer.BuildingNametagShadow)
     nameWordWrap = 11.0
     nameText.setWordwrap(nameWordWrap)
     scaleMult = 0.48
     houseName = self.hostName
     nameText.setText(houseName)
     textWidth = nameText.getWidth()
     xScale = 1.0 * scaleMult
     if textWidth > nameWordWrap:
         xScale = nameWordWrap / textWidth * scaleMult
     sign_origin = locator
     namePlate = sign_origin.attachNewNode(nameText)
     namePlate.setDepthWrite(0)
     namePlate.setPos(0, 0, 0)
     namePlate.setScale(xScale)
开发者ID:nate97,项目名称:src,代码行数:33,代码来源:DistributedParty.py

示例4: loadSign

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def loadSign(self):
     actNameForSign = self.activityName
     if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
     elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
     self.sign = self.root.attachNewNode('%sSign' % self.activityName)
     self.signModel = self.party.defaultSignModel.copyTo(self.sign)
     self.signFlat = self.signModel.find('**/sign_flat')
     self.signFlatWithNote = self.signModel.find('**/sign_withNote')
     self.signTextLocator = self.signModel.find('**/signText_locator')
     textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign)
     textureNodePath.setPos(0.0, -0.02, 2.2)
     textureNodePath.setScale(2.35)
     textureNodePath.copyTo(self.signFlat)
     textureNodePath.copyTo(self.signFlatWithNote)
     text = TextNode('noteText')
     text.setTextColor(0.2, 0.1, 0.7, 1.0)
     text.setAlign(TextNode.ACenter)
     text.setFont(OTPGlobals.getInterfaceFont())
     text.setWordwrap(10.0)
     text.setText('')
     self.noteText = self.signFlatWithNote.attachNewNode(text)
     self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0)
     self.noteText.setScale(0.2)
     self.signFlatWithNote.stash()
     self.signTextLocator.stash()
开发者ID:nate97,项目名称:src,代码行数:29,代码来源:DistributedPartyActivity.py

示例5: getSpaceGap

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
def getSpaceGap(gap, font=None):
	txtn = TextNode('tt')
	if font: txtn.setFont(font)
	s = ''
	txtn.setText(s)
	while txtn.getWidth() < gap:
			s += ' '
			txtn.setText(s)
	return s
开发者ID:rll,项目名称:labeling_tool,代码行数:11,代码来源:buttonjoe.py

示例6: fontHasCharacters

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def fontHasCharacters(name, font = font):
     if font:
         tn = TextNode('NameCheck')
         tn.setFont(font)
         for c in name:
             # Define c as unicode
             if not tn.hasCharacter(unichr(ord(c))):
                 notify.info('name contains bad char: %s' % TextEncoder().encodeWtext(c))
                 return OTPLocalizer.NCBadCharacter % TextEncoder().encodeWtext(c)
开发者ID:nate97,项目名称:src,代码行数:11,代码来源:NameCheck.py

示例7: addText

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
	def addText(self,name,text,xpos,ypos,r,g,b,align):
		textNode=TextNode(name)
		textNode.setText(text)
		textNode.setFont(self.font)
		textNode.setTextColor(r,g,b,1.0)
		textNode.setAlign(align)
		textNodePath=self.containerNode.attachNewNode(textNode)
		textNodePath.setScale(self.fontScale)
		textNodePath.setPos((2.0/self.characterWidth*xpos)-1,0.0,(2.0/self.characterHeight*ypos)-1) 
		return textNode
开发者ID:jonathanopalise,项目名称:grid-leader,代码行数:12,代码来源:textoverlay.py

示例8: generate

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def generate(self):
     DistributedObject.announceGenerate(self)
     self.trolleyStation = self.cr.playGame.hood.loader.geom.find('**/prop_trolley_station_DNARoot')
     self.trolleyCar = self.trolleyStation.find('**/trolley_car')
     self.trolleyKey = self.trolleyStation.find('**/key')
     tn = TextNode('trolleycountdowntext')
     tn.setFont(CIGlobals.getMickeyFont())
     tn.setTextColor(1, 0, 0, 1)
     self.countdownText = self.trolleyStation.attachNewNode(tn)
     self.countdownText.setScale(3.0)
     self.countdownText.setPos(14.58, 10.77, 11.17)
     self.acceptOnce('entertrolley_sphere', self.__handleTrolleyTrigger)
开发者ID:coginvasion,项目名称:src,代码行数:14,代码来源:DistributedBattleTrolley.py

示例9: getTextSize

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
def getTextSize(txt, style):
	tn = TextNode(txt)
	tn.setText(txt)
	tn.setFont(loader.loadFont(style['font']))
	tn.setSlant(style['slant'])
	#tn.setFont(style['font'])
	fontSize = style['font-size']
	lineHeight = tn.getLineHeight()
	f = tn.getFrameActual()
	return (tn.getWidth()*fontSize,\
		(f[3]-f[2])*fontSize,\
		lineHeight*fontSize,\
		(0, f[1]*fontSize, f[2]*fontSize, f[3]*fontSize))
开发者ID:rll,项目名称:labeling_tool,代码行数:15,代码来源:buttonjoe.py

示例10: setupLevelDisplay

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def setupLevelDisplay(self):
     LEVEL_1 = "Level 1"
     levelDisplay(LEVEL_1)
     levelN = TextNode('level-display')
     levelN.setText(LEVEL_1)
     font = loader.loadFont("font/Caveman.ttf")
     levelN.setFont(font)
     levelN.setTextColor(1, 1, 1, 1)
     levelN.setSlant(0.1)
     levelN.setShadow(0.05)
     levelN.setShadowColor(255, 0, 0, 1)
     textNodePath = self.aspect2d.attachNewNode(levelN)
     textNodePath.setPos(-0.45, 0, 0)
     textNodePath.setScale(0.2)
开发者ID:anto004,项目名称:game-programming,代码行数:16,代码来源:Ecco.py

示例11: load

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def load(self):
     from toontown.toonbase import ToontownGlobals
     from panda3d.core import TextNode
     textNode = TextNode('moviedialogue')
     textNode.setTextColor(0, 0, 0, 1)
     textNode.setCardColor(1, 1, 1, 1)
     textNode.setCardAsMargin(0, 0, 0, 0)
     textNode.setCardDecal(True)
     textNode.setWordwrap(27.0)
     textNode.setAlign(TextNode.ACenter)
     textNode.setFont(ToontownGlobals.getToonFont())
     self._dialogueLabel = aspect2d.attachNewNode(textNode)
     self._dialogueLabel.setScale(0.06, 0.06, 0.06)
     self._dialogueLabel.setPos(0.32, 0, -0.75)
     self._dialogueLabel.reparentTo(hidden)
开发者ID:nate97,项目名称:src,代码行数:17,代码来源:CogdoUtil.py

示例12: checkIfEccoDied

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
    def checkIfEccoDied(self):
        print "position" + str(self.pos.getY())
        if self.pos.getZ() > -50.0 and self.pos.getZ() < 0.0:
            title = "Game Over"
            levelCompleteN = TextNode('ecco-died')
            font = loader.loadFont("font/Caveman.ttf")
            levelCompleteN.setFont(font)
            levelCompleteN.setText(title)
            levelCompleteN.setTextColor(1, 1, 1, 1)
            levelCompleteN.setSlant(0.1)
            levelCompleteN.setShadow(0.03)
            levelCompleteN.setShadowColor(0, 0, 200, 1)
            # levelN.setFrameAsMargin(0, 0, 0, 0)
            levelCompleteN.setFrameColor(200, 0, 0, 1)
            levelCompleteN.setFrameLineWidth(5.0)
            # textNp.node().setGlyphShift(1.0)
            textNodePath = self.aspect2d.attachNewNode(levelCompleteN)
            textNodePath.setPos(-0.9, 1.5, 0.5)
            textNodePath.setScale(0.2)
            if self.pos.getZ() < -49.0:
                self.gameOverSound.play()

        elif self.pos.getZ() < -50.0:
            if self.gameOverSound.status() != self.gameOverSound.PLAYING:
                sys.exit(1)

        elif self.pos.getY() > 1300.0:
            title = "Level 1 \n Complete"
            levelCompleteN = TextNode('level-complete')
            font = loader.loadFont("font/Caveman.ttf")
            levelCompleteN.setFont(font)
            levelCompleteN.setText(title)
            levelCompleteN.setTextColor(1, 1, 1, 1)
            levelCompleteN.setSlant(0.1)
            levelCompleteN.setShadow(0.03)
            levelCompleteN.setShadowColor(0, 0, 200, 1)
            # levelN.setFrameAsMargin(0, 0, 0, 0)
            levelCompleteN.setFrameColor(200, 0, 0, 1)
            levelCompleteN.setFrameLineWidth(5.0)
            # textNp.node().setGlyphShift(1.0)
            textNodePath = self.aspect2d.attachNewNode(levelCompleteN)
            textNodePath.setPos(-0.6, 1.5, 0.5)
            textNodePath.setScale(0.2)
            if self.levelCompleteSound.status() != self.levelCompleteSound.PLAYING:
                self.levelCompleteSound.play()
        else:
            pass
开发者ID:anto004,项目名称:game-programming,代码行数:49,代码来源:Ecco.py

示例13: loadWitch

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def loadWitch(self):
     self.airplane = loader.loadModel('phase_4/models/props/tt_m_prp_ext_flyingWitch.bam')
     self.airplane.setScale(2)
     self.airplane.setPos(0, 0, 1)
     self.airplane.find('**/').setH(180)
     bannerText = TextNode('bannerText')
     bannerText.setTextColor(1, 0, 0, 1)
     bannerText.setAlign(bannerText.ACenter)
     bannerText.setFont(ToontownGlobals.getSignFont())
     bannerText.setText(TTLocalizer.EstatePlaneHoliday)
     self.bn = self.airplane.attachNewNode(bannerText.generate())
     self.bn.setPos(-20.0, -.1, 0)
     self.bn.setH(180)
     self.bn.setScale(2.35)
     self.bn.setDepthTest(1)
     self.bn.setDepthWrite(1)
     self.bn.setDepthOffset(500)
     base.airplane = self.airplane
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:20,代码来源:EstatePlane.py

示例14: loadAirplane

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def loadAirplane(self):
     self.airplane = loader.loadModel('phase_4/models/props/airplane.bam')
     self.airplane.setScale(4)
     self.airplane.setPos(0, 0, 1)
     self.banner = self.airplane.find('**/*banner')
     bannerText = TextNode('bannerText')
     bannerText.setTextColor(1, 0, 0, 1)
     bannerText.setAlign(bannerText.ACenter)
     bannerText.setFont(ToontownGlobals.getSignFont())
     bannerText.setText(TTLocalizer.EstatePlaneReturn)
     self.bn = self.banner.attachNewNode(bannerText.generate())
     self.bn.setHpr(180, 0, 0)
     self.bn.setPos(-5.8, 0.1, -0.25)
     self.bn.setScale(0.95)
     self.bn.setDepthTest(1)
     self.bn.setDepthWrite(1)
     self.bn.setDepthOffset(500)
     base.airplane = self.airplane
开发者ID:ToontownModder101,项目名称:Toontown-Offline-Squirting-Flower-Modded-,代码行数:20,代码来源:EstatePlane.py

示例15: setupLevelDisplay2

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setFont [as 别名]
 def setupLevelDisplay2(self):
     LEVEL_2 = "Level 2"
     levelDisplay(LEVEL_2)
     levelN = TextNode('level-display')
     levelN.setText(LEVEL_2)
     # www.webpagepublicity.com
     font = loader.loadFont("font/Caveman.ttf")
     levelN.setFont(font)
     levelN.setTextColor(1, 1, 1, 1)
     levelN.setSlant(0.1)
     levelN.setShadow(0.05)
     levelN.setShadowColor(255, 0, 0, 1)
     # levelN.setFrameAsMargin(0, 0, 0, 0)
     # levelN.setFrameColor(0, 0, 255, 1)
     # levelN.setFrameLineWidth(5.0)
     # # textNp.node().setGlyphShift(1.0)
     textNodePath = self.aspect2d.attachNewNode(levelN)
     textNodePath.setPos(-0.45, 0, 0)
     textNodePath.setScale(0.2)
开发者ID:anto004,项目名称:game-programming,代码行数:21,代码来源:Ecco.py


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