本文整理汇总了Python中pandac.PandaModules.WindowProperties类的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties类的具体用法?Python WindowProperties怎么用?Python WindowProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
ShowBase.__init__(self)
self.decisions = []
self.isReady = False
self.red = 0
self.messageNode = TextNode("Message")
self.choiceOneNode = TextNode("ChoiceOne")
self.choiceTwoNode = TextNode("ChoiceTwo")
self.instructionsNode = TextNode("Instructions")
self.messageNode.setText('"Antigone, stop screaming!"')
self.choiceOneNode.setText("[stop]")
self.choiceTwoNode.setText("[scream louder]")
self.instructionsNode.setText("Use the arrow keys to make a choice.")
base.setBackgroundColor(self.red, 0, 0)
base.disableMouse()
props = WindowProperties()
props.setTitle("Antigo Me")
base.win.requestProperties(props)
self.textDisplay()
self.showText()
self.isReady = True
self.accept("arrow_left", self.decision, [0])
self.accept("arrow_right", self.decision, [1])
示例2: __init__
def __init__(self):
ShowBase.__init__(self)
########## Window configuration #########
wp = WindowProperties()
wp.setSize(1024, 860)
self.win.requestProperties(wp)
########## Gameplay settings #########
self.GAME_MODE = PLAY
self.play_mode = SPACE
self.level = 1.5
self.mode_initialized = False
######### Camera #########
self.disableMouse()
self.mainCamera = Camera(self.camera)
self.mainCamera.camObject.setHpr(0, 0, 0)
#Trigger game chain
self.loadLevel(LEVEL)
######### Events #########
self.taskMgr.add(self.gameLoop, "gameLoop", priority = 35)
self.keys = {"w" : 0, "s" : 0, "a" : 0, "d" : 0, "space" : 0}
self.accept("w", self.setKey, ["w", 1])
self.accept("w-up", self.setKey, ["w", 0])
self.accept("s", self.setKey, ["s", 1])
self.accept("s-up", self.setKey, ["s", 0])
self.accept("a", self.setKey, ["a", 1])
self.accept("a-up", self.setKey, ["a", 0])
self.accept("d", self.setKey, ["d", 1])
self.accept("d-up", self.setKey, ["d", 0])
self.accept("space", self.setKey, ["space", 1])
self.accept("space-up", self.setKey, ["space", 0])
self.accept("wheel_up", self.zoomCamera, [-1])
self.accept("wheel_down", self.zoomCamera, [1])
self.accept("escape", self.switchGameMode, [IN_GAME_MENU])
self.accept("window-event", self.handleWindowEvent)
self.accept("playerGroundRayJumping-in", self.avatar.handleCollisionEvent, ["in"])
self.accept("playerGroundRayJumping-out", self.avatar.handleCollisionEvent, ["out"])
######### GUI #########
self.gui_elements = []
示例3: __init__
def __init__(self, useJOD=None):
"""
@keyword useJOD: connected to actual drumpads and spinners to read from (default: read from config.prc)
@type useJOD: bool
"""
self.configPath = Filename("/c/jamoconfig.txt")
self.logPath = Filename("/c/jamoconfig.log")
self.clearConfig()
self.simulate()
self.log = sys.stdout
self.configMissing = 0
self.hardwareChanged = 0
if (useJOD==None):
useJOD = base.config.GetBool("want-jamodrum", True)
self.useJOD = useJOD
if (useJOD):
self.setLog(self.logPath)
self.devindices = range(1,base.win.getNumInputDevices())
self.readConfigFile(self.configPath)
self.prepareDevices()
props = WindowProperties()
props.setCursorHidden(1)
if (sys.platform == "win32"):
props.setZOrder(WindowProperties.ZTop)
base.win.requestProperties(props)
self.setLog(None)
示例4: activate
def activate(self, position = Vec3(5.0, 5.0, 5.0)):
print "Activating FreeLook Camera"
# No moar cursor!
wp = WindowProperties()
wp.setCursorHidden(True)
# does not exist panda 1.3.2 / but is reqired for osx-mouse movement
try: wp.setMouseMode(WindowProperties.MAbsolute)
except: pass
base.win.requestProperties(wp)
# initialize camera
base.camLens.setFov(70) # field of view
base.camera.reparentTo(base.render) # attach it to the render
## set position
base.camera.setPos(position)
base.camera.setR(0)
# initialize mouse controls
## walking and stopping if input is lost
self.accept("s" , self.set_walk, [self.BACK])
self.accept("s-up" , self.set_walk, [self.STOP])
self.accept("w" , self.set_walk, [self.FORWARD])
self.accept("w-up" , self.set_walk, [self.STOP])
self.accept("d" , self.set_strafe, [self.RIGHT])
self.accept("d-up" , self.set_strafe, [self.STOP])
self.accept("a" , self.set_strafe, [self.LEFT])
self.accept("a-up" , self.set_strafe, [self.STOP])
# initialize camera task
base.taskMgr.add(self.update, "update_camera_task")
示例5: __init__
def __init__(self):
""" Initialisiert die Kamera, die Runtime und den Eventhandler. Ladet die Planeten und startet das Programm
"""
props = WindowProperties()
props.setTitle('Solarsystem')
base.win.requestProperties(props)
base.setBackgroundColor(0, 0, 0)
# The global variables we used to control the speed and size of objects
self.yearscale = 60
self.dayscale = self.yearscale / 365.0 * 5
self.orbitscale = 10
self.sizescale = 0.6
self.skySize = 80
self.runtime = RuntimeHandler()
self.camera = Camera(render, self.skySize)
self.loadLuminaries()
self.runtime.rotateLuminaries()
self.eventHandler = EventHandler(self.runtime, self.camera, self.runtime.getLuminary('sun'))
示例6: onSize
def onSize(self, evt):
"""Invoked when the viewport is resized."""
if self.win != None:
wp = WindowProperties()
wp.setOrigin(0, 0)
wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
self.win.requestProperties(wp)
示例7: toggleMouseLook
def toggleMouseLook():
global _MOUSELOOK
_MOUSELOOK = not _MOUSELOOK
props = WindowProperties()
props.setCursorHidden(_MOUSELOOK)
base.win.requestProperties(props)
return _MOUSELOOK
示例8: buildInGameMenu
def buildInGameMenu(self):
props = WindowProperties()
props.setCursorHidden(False)
base.win.requestProperties(props)
resume_button = DirectButton(text = "Resume", scale = .1, command = (lambda: self.switchGameMode(PLAY)),
rolloverSound=None)
main_menu_button = DirectButton(text = "Main Menu", scale = .1, command = self.b,
rolloverSound=None)
options_button = DirectButton(text = "Options", scale = .1, command = self.b,
rolloverSound=None)
exit_button = DirectButton(text = "Exit", scale = .1, command = exit,
rolloverSound=None)
BUTTON_SPACING = .2
BUTTON_HEIGHT = resume_button.getSy()
button_positions = self.evenButtonPositions(BUTTON_SPACING, BUTTON_HEIGHT, 4)
resume_button.setPos(Vec3(0, 0, button_positions[0]))
main_menu_button.setPos(Vec3(0, 0, button_positions[1]))
options_button.setPos(Vec3(0, 0, button_positions[2]))
exit_button.setPos(Vec3(0, 0, button_positions[3]))
self.gui_elements.append(resume_button)
self.gui_elements.append(main_menu_button)
self.gui_elements.append(options_button)
self.gui_elements.append(exit_button)
示例9: OnResize
def OnResize( self, event ):
"""When the wx-panel is resized, fit the panda3d window into it."""
frame_size = event.GetSize()
wp = WindowProperties()
wp.setOrigin( 0, 0 )
wp.setSize( frame_size.GetWidth(), frame_size.GetHeight() )
self._win.requestProperties( wp )
示例10: buildMainMenu
def buildMainMenu(self):
props = WindowProperties()
props.setCursorHidden(False)
base.win.requestProperties(props)
start_game_button = DirectButton(text = "Start", scale = .1,
command = self.b)
select_level_button = DirectButton(text = "Select Level", scale = .1,
command = self.b)
game_options_button = DirectButton(text = "Options", scale = .1,
command = self.b)
exit_button = DirectButton(text = "Exit", scale = .1,
command = exit)
BUTTON_SPACING = .2
BUTTON_HEIGHT = start_game_button.getSy()
button_positions = self.evenButtonPositions(BUTTON_SPACING, BUTTON_HEIGHT)
start_game_button.setPos(Vec3(0, 0, button_positions[0]))
select_level_button.setPos(Vec3(0, 0, button_positions[1]))
game_options_button.setPos(Vec3(0, 0, button_positions[2]))
exit_button.setPos(Vec3(0, 0, button_positions[3]))
self.gui_elements.append(start_game_button)
self.gui_elements.append(select_level_button)
self.gui_elements.append(game_options_button)
self.gui_elements.append(exit_button)
示例11: __init__
def __init__(self):
ShowBase.__init__(self)
self.disableMouse()
props = WindowProperties()
props.setTitle('Test')
self.win.requestProperties(props)
# self.render.setAntiAlias(AntialiasAttrib.MAuto)
self.transitions = Transitions(self.loader)
self.transitions.setFadeColor(0, 0, 0)
self.filters = CommonFilters(self.win, self.cam)
# self.filters.setCartoonInk()
self.filters.setBlurSharpen(1)
# self.filters.setVolumetricLighting(self.render)
# self.buffer = self.win.makeTextureBuffer("Post-processing buffer", self.win.getXSize(), self.win.getXSize())
# print self.buffer.getYSize()
# self.texture = self.buffer.getTexture()
# self.buffer.setSort(-100)
#
# self.originalCamera = self.camera
# self.offScreenCamera = self.makeCamera(self.buffer)
# self.camera = self.offScreenCamera
#
# self.img = OnscreenImage(image=self.texture, pos=(0, 0, 0.5))
self.scene = None
self.channel = Channel()
示例12: createBuffer
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
""" Low-level buffer creation. Not intended for public use. """
winprops = WindowProperties()
winprops.setSize(xsize, ysize)
props = FrameBufferProperties()
props.setRgbColor(1)
props.setDepthBits(depthbits)
depthtex, colortex, auxtex0, auxtex1 = texgroup
if (auxtex0 != None):
props.setAuxRgba(1)
if (auxtex1 != None):
props.setAuxRgba(2)
buffer=base.graphicsEngine.makeOutput(
self.win.getPipe(), name, -1,
props, winprops, GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
self.win.getGsg(), self.win)
if (buffer == None):
return buffer
if (depthtex):
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
if (colortex):
buffer.addRenderTexture(colortex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPColor)
if (auxtex0):
buffer.addRenderTexture(auxtex0, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba0)
if (auxtex1):
buffer.addRenderTexture(auxtex1, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba1)
buffer.setSort(self.nextsort)
buffer.disableClears()
buffer.getDisplayRegion(0).disableClears()
self.nextsort += 1
return buffer
示例13: _init_graphics
def _init_graphics(self):
base.disableMouse()
props = WindowProperties()
props.setCursorHidden(True)
base.win.requestProperties(props)
base.setFrameRateMeter(True)
render.setShaderAuto()
render.setAntialias(AntialiasAttrib.MAuto)
示例14: onSize
def onSize(self, event):
wp = WindowProperties()
wp.setOrigin(0, 0)
x,y = self.GetClientSize()
wp.setSize(x,y)
base.camLens.setAspectRatio(1.0*y/x)
base.win.requestProperties(wp)
event.Skip()
示例15: show_cursor
def show_cursor():
props = WindowProperties()
props.setCursorHidden(False)
# set the filename to the mouse cursor
# at the time the realization is valid for Windows only
win = "assets/gui/Cursor.cur"
props.setCursorFilename(win)
base.win.requestProperties(props)