本文整理汇总了Python中panda3d.core.TextNode.setShadowColor方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setShadowColor方法的具体用法?Python TextNode.setShadowColor怎么用?Python TextNode.setShadowColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.TextNode
的用法示例。
在下文中一共展示了TextNode.setShadowColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadGUI
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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: attachHostNameToSign
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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)
示例3: setupLevelDisplay
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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)
示例4: cityLabels
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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()
示例5: checkIfEccoDied
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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
示例6: setupLevelDisplay2
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [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)
示例7: __init__
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [as 别名]
def __init__(self):
ShowBase.__init__(self)
base.setBackgroundColor(0, 0, 0)
game_title = "ECCO"
titleN = TextNode('game-title')
font = loader.loadFont("font/Caveman.ttf")
titleN.setFont(font)
titleN.setText(game_title)
titleN.setTextColor(1, 1, 1, 1)
titleN.setSlant(0.1)
titleN.setShadow(0.05)
titleN.setShadowColor(0, 0, 200, 1)
titleN.setFrameColor(0, 0, 255, 1)
titleN.setFrameLineWidth(5.0)
textNodePath = self.aspect2d.attachNewNode(titleN)
textNodePath.setPos(-0.4, 1.5, 0.5)
textNodePath.setScale(0.2)
self.level1Button = DirectButton(text=("Level 1"), scale=.1, pos=(0, 0, 0.2), command=self.level1)
self.level2Button = DirectButton(text=("Level 2"), scale=.1, pos=(0, 0, 0), command=self.level2)
示例8: getBackgroundSet
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [as 别名]
def getBackgroundSet(menuItem, frame, arrowhead):
item = menuItem.item
kind = item['kind']
txt = item['txt']
grphcs = []
slctrs = ['menu '+kind]
if 'class' in item: # class after kind: class has higher priority
slctrs.append('.'+item['class'])
if 'id' in item: # id after class: id has higher priority
slctrs.append('#'+item['id'])
style = getStyle(slctrs, menuItem.cssFName)
if 'enter-sound' in style: loadSound(menuItem, menuItem.getEnterEvent(), style, 'enter-sound')
if 'exit-sound' in style: loadSound(menuItem, menuItem.getExitEvent(), style, 'exit-sound')
if 'press-sound' in style: loadSound(menuItem, menuItem.getPressEvent(MouseButton.one()), style, 'press-sound')
if 'release-sound' in style: loadSound(menuItem, menuItem.getReleaseEvent(MouseButton.one()), style, 'release-sound')
if 'drag-sound' in style: loadSound(menuItem, None, style, 'drag-sound')
for state in STATES:
slctrs = ['menu '+kind+' :'+stateName[state].lower()]
if 'class' in item: # class after kind: class has higher priority
slctrs.append('.'+item['class']+' :'+stateName[state].lower())
if 'id' in item: # id after class: id has higher priority
slctrs.append('#'+item['id']+' :'+stateName[state].lower())
style = getStyle(slctrs, menuItem.cssFName)
# Want to add more style properties?
# Do it here:
# Match style keys here to property names in .ccss
fontSize = style['font-size']
bevel = style['bevel']*fontSize
font = style['font']
color = style['color']
tn = TextNode(txt)
tn.setText(txt)
tn.setFont(loader.loadFont(font))
tn.setSlant(style['slant'])
tn.setTextColor(color)
tn.setShadow(*style['shadow-offset'])
tn.setShadowColor(*style['shadow-color'])
NodePath(tn).setScale(fontSize)
sHolder = NodePath(PandaNode('sHolder'))
sHolder.attachNewNode(tn)
grphcs.append(sHolder)
sHolder.attachNewNode(tn)
borderColor = style['border-Color']
thk = style['border-thickness']
if 'background-Color' in style and\
style['background-Color'] != 'transparent':
bgColor = style['background-Color']
else: bgColor = None
if kind=='parent':
if state==HOVER: ar = arrowhead*2
else: ar = arrowhead
grphcs[state].attachNewNode(bevelArrow(frame, bevel, ar, thk, color, borderColor, bgColor))
elif kind in ('horizontal', 'titleBar', 'close'):
grphcs[state].attachNewNode(rectangle(frame, thk, color, borderColor, bgColor))
elif kind=='checkBox':
grphcs[state].attachNewNode(checkBox(frame, bevel, thk, color, borderColor, bgColor))
cb = grphcs[state].attachNewNode(checkedBox(frame, bevel, thk, color, borderColor, bgColor))
cb.hide()
elif kind=='radioBTN':
grphcs[state].attachNewNode(radioBTN(frame, bevel, thk, color, borderColor, bgColor))
cb = grphcs[state].attachNewNode(checkedRadioBTN(frame, bevel, thk, color, borderColor, bgColor))
cb.hide()
else:
grphcs[state].attachNewNode(bevelBG(frame, bevel, thk, borderColor, bgColor))
return grphcs
示例9: MessageWriter
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [as 别名]
class MessageWriter(DirectObject):
def __init__(self):
# the tasktime the last sign in the textfield was written
self.lastSign = 0.0
# the sign that is actually written in the textfield
self.currentSign = 0
# the text to write in the textfield
self.textfieldText = ""
# stop will be used to check if the writing is finished or
# somehow else stoped
self.stop = False
# the speed new letters are added to the text
# the time, how long the text is shown after it is fully written
self.showlength = 4
# the textfield to put instructions hints and everything else, that
# should be slowly written on screen and disappear after a short while
self.textfield = TextNode('textfield')
self.textfield.clearText()
self.textfield.setShadow(0.005, 0.005)
self.textfield.setShadowColor(0, 0, 0, 1)
self.textfield.setWordwrap(base.a2dRight*2-0.4)
self.textfield.setCardActual(
-0.1, base.a2dRight*2-0.3,
0.1, base.a2dBottom+0.5)
self.textfield.setCardColor(0,0,0,0.45)
self.textfield.setFlattenFlags(TextNode.FF_none)
self.textfield.setTextScale(0.06)
self.textfieldNodePath = aspect2d.attachNewNode(self.textfield)
self.textfieldNodePath.setScale(1)
self.textfieldNodePath.setPos(base.a2dLeft+0.2, 0, -0.4)
self.hide()
def show(self):
self.textfieldNodePath.show()
def hide(self):
self.textfield.clearText()
self.textfieldNodePath.hide()
def clear(self):
"""Clear the textfield and stop the current written text"""
self.hide()
taskMgr.remove("writeText")
self.stop = False
self.writeDone = False
self.currentSign = 0
self.lastSign = 0.0
self.textfield.clearText()
def cleanup(self):
"""Function that should be called to remove and reset the
message writer"""
self.clear()
self.ignore("showMessage")
def run(self):
"""This function can be called to start the writer task."""
self.textfield.setFlattenFlags(TextNode.FF_none)
taskMgr.add(self.__writeText, "writeText", priority=30)
def setMessageAndShow(self, message):
"""Function to simply add a new message and show it if no other
message is currently shown"""
self.clear()
logging.debug("show message %s" % message)
self.textfieldText = message
self.show()
# start the writer task
self.run()
def __writeText(self, task):
elapsed = globalClock.getDt()
if(self.stop):
# text is finished and can be cleared now
self.clear()
return task.done
if self.currentSign == len(self.textfieldText)-1:
self.textfield.setFlattenFlags(TextNode.FF_dynamic_merge)
if self.currentSign >= len(self.textfieldText):
# check if the text is fully written
if task.time - self.lastSign >= self.showlength:
# now also check if the time the text should
# be visible on screen has elapsed
self.stop = True
self.textfieldNodePath.flattenStrong()
elif (task.time - self.lastSign > base.textWriteSpeed) and (not self.stop):
# write the next letter of the text
self.textfield.appendText(self.textfieldText[self.currentSign])
self.currentSign += 1
self.lastSign = task.time
return task.cont
示例10: __init__
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setShadowColor [as 别名]
def __init__(self):
ShowBase.__init__(self)
self.disableMouse()
self.camLens.setNear(0.01)
self.camLens.setFar(100)
self.camLens.setFov(config.camera_angle)
self.setBackgroundColor(Vec4(0, 0, 0, 0))
self.setFrameRateMeter(True)
self.level = load_level(config.start_level)
self.dir = Direction()
self.pos = Vector([0, 0])
level_node = render_level(self.level)
level_node.reparentTo(self.render)
self.accept("escape", exit)
self.accept("arrow_up", self.forward)
self.accept("arrow_down", self.reverse)
self.accept("arrow_down", self.backwards)
self.accept("arrow_left", self.turn_left)
self.accept("arrow_right", self.turn_right)
self.accept("1", self.set_camera_in)
self.accept("2", self.set_camera_out)
self.accept("3", self.spin_camera_left)
self.accept("4", self.spin_camera_right)
self.accept("s", self.toggle_smoke)
title = OnscreenText(text="Bard's Tale I",
style=1, fg=(1,1,1,1),
pos=(0.7,0.92), scale = .07)
slight = PointLight('slight')
slight.setColor(Vec4(1, 1, 1, 1))
slnp = render.attachNewNode(slight)
#slight.setAttenuation((1, 0, 0.02))
render.setLight(slnp)
self.slight = slight
self.light = slnp
alight = AmbientLight('alight')
amb = 0.05
alight.setColor((amb, amb, amb, 1))
alnp = render.attachNewNode(alight)
self.alight = alight
render.setLight(alnp)
text = TextNode("foo")
text.setText("")
text.setShadow(0.2,0.2)
text.setShadowColor(0, 0, 0, 1)
tn = NodePath(text)
tn.setScale(0.1)
tn.reparentTo(aspect2d)
tn.setPos(-1, -1, 0)
self.text = text
print self.eventMgr
from panda3d.core import AntialiasAttrib
self.render.setAntialias(AntialiasAttrib.MMultisample)
self.follow = True
self.set_camera()
render.setAttrib(LightRampAttrib.makeIdentity())
render.setShaderAuto()