本文整理汇总了Python中direct.gui.DirectFrame.DirectFrame.set_transparency方法的典型用法代码示例。如果您正苦于以下问题:Python DirectFrame.set_transparency方法的具体用法?Python DirectFrame.set_transparency怎么用?Python DirectFrame.set_transparency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectFrame.DirectFrame
的用法示例。
在下文中一共展示了DirectFrame.set_transparency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Menu
# 需要导入模块: from direct.gui.DirectFrame import DirectFrame [as 别名]
# 或者: from direct.gui.DirectFrame.DirectFrame import set_transparency [as 别名]
class Menu(object):
def __init__(self,main):
self.main=main
wx = base.win.get_x_size()
wy = base.win.get_y_size()
kx = 1920
ky = 1080
self.myFrame = DirectFrame(frameColor=(1,1,1,1),
frameSize=(0, kx,0, ky))
menu_tex = loader.loadTexture("res/menu.png")
menu_tex.set_minfilter(SamplerState.FT_nearest)
menu_tex.set_magfilter(SamplerState.FT_linear)
self.myFrame["frameTexture"] = menu_tex
self.myFrame.reparentTo(base.pixel2d)
self.myFrame.set_pos( (wx-kx) / 2, 0, -(wy+ky) / 2)
self.myFrame.set_transparency(True)
self.startButton = DirectButton(
text = "",
text_scale=1.0,
text_fg=(0.2,0.2,0.2,1),
frameTexture="res/start_game.png",
frameColor=(1,1,1,1),
frameSize=(-64, 64, -20, 20),
command=self.main.startGame,
relief=DGG.FLAT,
rolloverSound=None,
clickSound=None,
parent=self.myFrame,
scale=2.0,
pos=(wx/2 + 160, 0, wy/2 + 50)
)
self.startButton.setTransparency(1)
self.exitButton = DirectButton(
text = ("Exit Game"),
pos=(0,0,-.8),
text_scale=.1,
frameColor=(0,0,0,0),
relief=1,
frameVisibleScale=(2,3),
command=exit,
rolloverSound=None,
clickSound=None,
parent=self.myFrame,
)
self.exitButton.setTransparency(1)
self.resumeButton = DirectButton(
text = ("Resume"),
pos=(.0,0,.3),
text_scale=.1,
frameColor=(0,0,0,0),
relief=1,
frameVisibleScale=(2,3),
command=self.main.resumeGame,
rolloverSound=None,
clickSound=None,
parent=self.myFrame,
)
self.resumeButton.setTransparency(1)
self.resumeButton.hide()
self.selectFrame= DirectFrame( frameColor=(1,1,1,1) , frameSize=(-64, 64, -20, 20) , frameTexture="res/select.png")
self.selectFrame.setTransparency(1)
self.selectFrame.reparentTo(self.startButton)
self.entries = [self.exitButton,self.startButton,self.resumeButton]
self.activeEntry = 1
def clearKeys(self):
base.ignore("arrow_up")
base.ignore("arrow_down")
base.ignore("arrow_left")
base.ignore("arrow_right")
base.ignore("escape")
base.ignore("enter")
def execSelection(self):
self.entries[self.activeEntry]["command"]()
def selectDown(self):
if self.activeEntry == 0:
self.activeEntry = len(self.entries)-1
else:
self.activeEntry -=1
if self.entries[self.activeEntry].isHidden():
self.selectDown()
return
self.selectFrame.reparentTo(self.entries[self.activeEntry])
def selectUp(self):
#.........这里部分代码省略.........