本文整理汇总了Python中panda3d.core.TextNode.setAlign方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setAlign方法的具体用法?Python TextNode.setAlign怎么用?Python TextNode.setAlign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.TextNode
的用法示例。
在下文中一共展示了TextNode.setAlign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadGUI
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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: renderClickableModel
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [as 别名]
def renderClickableModel(self, showModel=True, showName=False):
''' Render just the clickable (reference) model '''
# Hide all non clickable objects
self.nonClickable.clearColor()
self.nonClickable.hide()
# Show the clickable model with the original texture and color
self.clickableModel.clearColor()
self.clickableModel.clearColorScale()
if showModel:
# Place it in front of the user, face-to-face (we try to randomly parametrize the position and orientation of the reference model but in a way that the user can clearly see it face-to-face)
self.clickableModel.setPos(0,40,0)
self.clickableModel = self.normalizeModelSize(self.clickableModel, self.minModelSize, self.maxModelSize, self.clickableModelSize) # set size (normalize size and set a random size in the normalized range)
self.clickableModel.setHpr(random.uniform(-45, 45), random.uniform(-15, 15), 0)
self.clickableModel.setColorScale(random.random(), random.random(), random.random(), 1.0)
else:
self.clickable.hide()
if showName:
if not hasattr(self, 'clickableText') or self.clickableText != self.clickableModelName:
if hasattr(self, 'clickableText'):
self.clickableText.remove()
text = TextNode('reference model name')
text.setText(self.clickableModelName)
text.setAlign(TextNode.ACenter)
self.clickableText = render2d.attachNewNode(text)
self.clickableText.setScale( 0.2 )
self.clickableText.setPos( 0, 0, -0.8 )
示例3: addAvatar
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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]
示例4: loadSign
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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: attachHostNameToSign
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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)
示例6: EndScreenHUD
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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
示例7: draw
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [as 别名]
def draw(self):
# stuffandeer stuffandeer otus
for card in self.hand:
textn = TextNode(card.name)
textn.setText(card.name)
textnp = card.model.attachNewNode(textn)
textnp.setScale(0.3)
textnp.setPos(card.model, -2, 0, 1)
textnp.setHpr(card.model, 0, -90, -90)
textn.setAlign(TextNode.ACenter)
示例8: addText
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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
示例9: init_player
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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
示例10: displayText
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [as 别名]
def displayText(self,text):
newTextNode = TextNode('text')
newTextNode.setText(text)
newTextNode.setAlign(TextNode.ACenter)
newTextNode.setWordwrap(16.0)
text_generate = newTextNode.generate()
newTextNodePath = render.attachNewNode(text_generate)
newTextNodePath.setPos(0,1000,190)
newTextNodePath.setScale(30,30,30)
self.textEffects(newTextNodePath)
return newTextNodePath
示例11: load
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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)
示例12: Text
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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)
示例13: loadWitch
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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
示例14: loadAirplane
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [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
示例15: __init__
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setAlign [as 别名]
def __init__(self, team, position, direction):
self._orders = Actions.DoNothing
self._hp = 5
self._death_played = False
self._interval = None
self.kills = 0
self.team = team
self._model = NodePath('bot')
self._model.reparentTo(render)
self._model.setPos(position)
self._model.setHpr(direction, 0, 0)
self._model.setColorScale(*self.team)
self._model.setScale(.2, .2, .2)
# Load the animations
self._actor = Actor("models/RockGolem", {
'idle': 'models/RockGolem-idle',
'walk': 'models/RockGolem-walk',
'reverse-walk': 'models/RockGolem-walk',
'punch': 'models/RockGolem-punch',
'death': 'models/RockGolem-death',
'throw': 'models/RockGolem-throw',
})
self._actor.setPlayRate(2.65, 'walk')
self._actor.setPlayRate(-2.65, 'reverse-walk')
self._actor.setPlayRate(4, 'punch')
self._actor.setPlayRate(5.25, 'throw')
self._actor.setBlend(frameBlend=True)
self._actor.reparentTo(self._model)
self._actor.loop('idle')
self._actor.setH(180)
# Floating Label
text = TextNode('node name')
text.setText(self.__class__.__name__)
text.setAlign(TextNode.ACenter)
self._name_label = self._model.attachNewNode(text)
self._name_label.setBillboardPointEye()
self._name_label.setPos(Vec3(0, 0, 6))
self._name_label.setScale(3, 3, 3)