本文整理汇总了Python中panda3d.core.TextNode.setTextColor方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setTextColor方法的具体用法?Python TextNode.setTextColor怎么用?Python TextNode.setTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.TextNode
的用法示例。
在下文中一共展示了TextNode.setTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadGUI
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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
示例2: addAvatar
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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]
示例3: attachHostNameToSign
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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)
示例4: loadSign
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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()
示例5: EndScreenHUD
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
class EndScreenHUD(DirectObject):
def __init__(self, gameScreenFSM, winnerPlayer):
self.gameScreenFSM = gameScreenFSM
self.endScreenFrame = None
self.isoScale = 3.2
self.scale = (self.isoScale,1,self.isoScale)
self.winnerName = winnerPlayer
def __del__(self):
if (self.endScreenFrame != None):
self.endScreenFrame.destroy()
def initHUD(self):
self.endScreenFrame = DirectFrame(HUD_models,
image = '../HUD images/winnerScreen.png',
frameColor=(0,0,0,0.0),
frameSize=(-1, 1, -1, 1),
scale = self.scale,
)
self.winner = TextNode('Winner Name')
self.winner.setText(self.winnerName)
self.winner.setTextColor(255, 255, 0, 1)
self.winner.setAlign(TextNode.ALeft)
textNodePath = aspect2d.attachNewNode(self.winner)
textNodePath.setScale(0.1)
textNodePath.setPos(-0.1,0,0)
#button = DirectButton(HUD_models, image='../HUD images/creditsButton.png', image_scale = (3.75,1,1) , pos = [-0.0/self.isoScale,0,-0.80/self.isoScale], scale = 0.06/self.isoScale , command= self.changeScene)
def changeScene(self):
clickButtonSound.play()
self.gameScreenFSM.request("CreditScreen")
def update(self):
return
示例6: _show
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
def _show(self, ctb, identifier, parentnode):
if self.node is not None: self.node.removeNode()
tnode = TextNode(identifier)
tnode.setText(ctb.text)
r, g, b, a = ctb.textcolor.r / 255.0, ctb.textcolor.g / 255.0, ctb.textcolor.b / 255.0, ctb.textcolor.a / 255.0
tnode.setTextColor(r, g, b, a)
node = NodePath(tnode)
self._scale(tnode, node)
node.reparentTo(parentnode)
self.node = node
示例7: addText
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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
示例8: init_player
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
def init_player(self, left_btn, right_btn, player_number ,pos=(0,0,0), heading=0):
color = (configs.COLORS_MAP[player_number][0])
nodePath = loadObject()
nodePath.setPos(pos)
nodePath.setScale(configs.SCALE*0.004)
nodePath.setColor(color)
p = ParticleEffect()
p.loadConfig('textures/flare.ptf')
p.start(parent = nodePath, renderParent = render)
p0 = p.getParticlesList()[0]
p0.emitter.setRadiateOrigin(Point3(0.05*cos(heading* pi/180), 0.0, 0.05*sin(heading* pi/180)))
p.setPos(0,-1,0)
# p.setBin("unsorted", 0)
# p.setDepthTest(False)
p.setTwoSided(True)
text= TextNode('text')
text.setText(str("%s" % player_number))
text.setTextColor(color)
text.setAlign(TextNode.ACenter)
# text.font = self.font
text3d = NodePath(text)
text3d.setTwoSided(True)
text3d.setPos(nodePath, -1,-3,-4)
text3d.reparentTo(render)
circle = loadObject(tex='circle.png')
circle.reparentTo(render)
circle.setPos(nodePath, 0,-2,0)
text3d.setScale(0.13)
circle.setScale(0.09)
text3d.setColorScale(color)
circle.setColorScale(color)
new_line, line_vertex, line_node = start_new_line(self, pos[0], pos[2], color)
line_id = configs.ENTITY_ID
configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'line', 'GEOM':new_line, 'VERTEX':line_vertex, "NODE": line_node}
configs.ENTITY_ID += 1
speed = configs.FORWARD_SPEED
right_angle = configs.FORCE_RIGHT_ANGLE_TURN
# print left_btn
# print right_btn
self.accept(("%s" % left_btn), player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 1])
self.accept(("%s-up" % left_btn), player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 0])
self.accept(("%s" % right_btn), player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 1])
self.accept(("%s-up" % right_btn), player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 0])
configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'player','ALIVE':True, 'NODE':nodePath,'PARTICLE_PARENT':p, 'PARTICLE':p0,
'HEADING':heading, 'CURRENT_LINE':line_id, 'TICKNESS':configs.SCALE, 'TURN_LEFT':0, 'TURN_RIGHT':0, 'COLOR':color,
'PLAYER_ID':text3d, 'CIRCLE_NODE':circle, 'LEFT_ARMED':True, 'RIGHT_ARMED':True, 'PLAYER_NUMBER': player_number, 'SPEED':speed,
'RIGHT_ANGLE_TURN':right_angle }
configs.ENTITY_ID += 1
示例9: generate
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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)
示例10: _show
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
def _show(self, ctb, identifier):
if self.node is not None: self.node.removeNode()
tnode = TextNode(identifier)
tnode.setText(ctb.text)
r, g, b, a = ctb.textcolor
tnode.setTextColor(r, g, b, a)
r, g, b, a = ctb.boxcolor
tnode.setCardColor(r, g, b, a)
tnode.setCardAsMargin(0, 0, 0, 0)
tnode.setCardDecal(True)
node = NodePath(tnode)
self._scale(tnode, node)
node.reparentTo(self.pnode)
self.node = node
示例11: setupLevelDisplay
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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)
示例12: load
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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)
示例13: cityLabels
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
def cityLabels(self, citylabels, terrain):
children = self.cityLabels.getChildren()
for child in children:
child.removeNode()
for ident, city in citylabels.items():
text = city['name'] + "\n" + city["mayor"] + "\n" + "Population: " + str(city['population'])
label = TextNode(str(ident) + " label")
label.setText(text)
label.setTextColor(1, 1, 1, 1)
label.setShadowColor(0, 0, 0, 1)
label.setCardDecal(True)
textNodePath = self.cityLabels.attachNewNode(label)
textNodePath.setPos(city['position'][0], city["position"][1], city['position'][2])
textNodePath.setLightOff()
textNodePath.setBillboardPointEye()
示例14: checkIfEccoDied
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [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
示例15: Text
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setTextColor [as 别名]
class Text(object):
def __init__(self, parent = None,
nameNode = '',
text = None,
align = 'left',
wordwrap = 0,
scale = .05,
pos = (0, 0, 0),
cor = (1, 1, 1, 1)):
if align == 'center':
align = TextNode.ACenter
elif align == 'left':
align = TextNode.ALeft
elif align == 'rigth':
align = TextNode.ARight
else :
align = TextNode.ALeft
self.textNode = TextNode(nameNode)
self.textNode.setTextColor(cor)
self.textNode.setAlign(align)
self.textNode.setText(text)
self.textNode.setWordwrap(wordwrap)
self.textNodePath = parent.attachNewNode(self.textNode)
self.textNodePath.setScale(scale)
height = (scale*self.textNode.getNumRows())
self.textNodePath.setPos((pos[0], pos[1], pos[2]+height))
def remove(self):
self.textNodePath.remove()
def billboardEffect(self):
self.textNodePath.setBillboardAxis()
self.textNodePath.setBillboardPointWorld()
self.textNodePath.setBillboardPointEye()
def getScale(self):
return self.textNodePath.getScale()[0]
def setPos(self, pos):
self.textNodePath.setPos(pos)