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


Python TextNode.setSlant方法代码示例

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


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

示例1: setupCoins2

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [as 别名]
    def setupCoins2(self):
        # display coins = 0
        textN = TextNode('coin-score')
        textN.setText(str("Coins: " + str(self.coinsCollected2)))
        textN.setSlant(0.1)
        textNodePath = self.aspect2d.attachNewNode(textN)
        textNodePath.setPos(0, 0.95, 0.9)
        textNodePath.setScale(0.08)
        randNum = random.sample(range(0, 1500, 200), 6)

        # coins
        for i in range(6):
            randX = random.uniform(-3.0, 3.2)
            randY = float(randNum[i])
            shape = BulletSphereShape(0.3)
            coinNode = BulletGhostNode('Coin-' + str(i))
            coinNode.addShape(shape)
            np = self.render.attachNewNode(coinNode)
            np.setCollideMask(BitMask32.allOff())
            np.setPos(randX, randY, 2)

            # Adding sphere model
            sphereNp = loader.loadModel('models/smiley.egg')
            sphereNp_tex = loader.loadTexture("models/sky/coin_2_tex.jpg")
            sphereNp.setTexture(sphereNp_tex, 1)
            sphereNp.reparentTo(np)
            sphereNp.setScale(0.45)
            sphereNp.hprInterval(2.5, Vec3(360, 0, 0)).loop()

            self.world2.attachGhost(coinNode)
            self.coins2.append(coinNode)
            print "node name:" + str(coinNode.getName())
开发者ID:anto004,项目名称:game-programming,代码行数:34,代码来源:Ecco.py

示例2: getTextSize

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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

示例3: setupLevelDisplay

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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

示例4: checkIfEccoDied

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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

示例5: setupLevelDisplay2

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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

示例6: __init__

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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)
开发者ID:anto004,项目名称:game-programming,代码行数:22,代码来源:Ecco.py

示例7: getBackgroundSet

# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import setSlant [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
开发者ID:rll,项目名称:labeling_tool,代码行数:67,代码来源:buttonjoe.py


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