本文整理汇总了Python中pandac.PandaModules.WindowProperties.setMouseMode方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.setMouseMode方法的具体用法?Python WindowProperties.setMouseMode怎么用?Python WindowProperties.setMouseMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.setMouseMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: activate
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
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")
示例2: togglePause
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def togglePause(self):
print ("pause pressed")
if MyApp.paused:
self.makeMouseRelative()
MyApp.paused = False
else:
props = WindowProperties() # initiates window node
props.setCursorHidden(False) # cursor shows
props.setMouseMode(WindowProperties.M_absolute) # cursor moves
self.win.requestProperties(props) # window accepts changes
MyApp.paused = True
示例3: disable
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def disable( self ):
''' disable first person camera rotation of mouse and free/show the mouse
'''
self.rotationSpeed = 0
# disable the mouse rotation task
taskMgr.remove('cameraRotationTask')
# show mouse cursor
wp = WindowProperties()
wp.setCursorHidden(False)
# 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)
# remove the cross from the window
self.aimingCross.detachNode()
self.enabled = False
示例4: deactivate
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def deactivate(self):
print "Deactivating 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)
self.ignore("s")
self.ignore("s-up")
self.ignore("w")
self.ignore("w-up")
self.ignore("d")
self.ignore("d-up")
self.ignore("a")
self.ignore("a-up")
base.taskMgr.remove("update_camera_task")
示例5: enable
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def enable( self ):
''' enable first person camera rotation by mouse and bind/hide the mouse
'''
# the mouse is not centered
self.mouseCentered = False
# enable the mouse rotation task
taskMgr.add(self.rotationTask, 'cameraRotationTask')
# hide mouse cursor
wp = WindowProperties()
wp.setCursorHidden(True)
# does not exist panda 1.3.2 / but is reqired for osx-mouse movement
try: wp.setMouseMode(WindowProperties.MRelative)
except: pass
base.win.requestProperties(wp)
# add the cross to the window
self.aimingCross.reparentTo( render2d )
self.enabled = True
示例6: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def __init__(self):
ShowBase.__init__(self)
self.title = "Monkeys"
self.setFrameRateMeter(True)
# Disable the camera trackball controls.
self.disableMouse()
props = WindowProperties()
props.setCursorHidden(True)
props.setTitle("Stay Away From The Monkeys")
props.setMouseMode(WindowProperties.M_relative)
self.win.requestProperties(props)
# set scene
self.scene = self.loader.loadModel("models/skyTest.egg")
self.scene.reparentTo(self.render)
m = 37
self.scene.setScale(m, m, m)
self.scene.setPos(0, 0, -5)
# set camera
self.camera.setPos(0, 0, 1)
self.camera.setHpr(0, 0, 0)
self.cameraSpeed = (0, 0, 0)
self.maxSpeed = 0.09
self.lastKeyPressed = ""
self.blockList = []
self.mobMax = 0
self.player = Player(self.camera)
self.loadModel()
self.createBars()
self.die = False
self.paused = True
self.helpScreen()
self.accept("p",self.flipPause)
self.accept("h",self.helpFlip)
self.accept("escape",sys.exit)
self.taskMgr.add(self.update, "updateAll")
示例7: makeMouseRelative
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setMouseMode [as 别名]
def makeMouseRelative(self):
props = WindowProperties() # initates window node
props.setCursorHidden(True) # hides cursor
props.setMouseMode(WindowProperties.M_relative) # cursor stays
self.win.requestProperties(props) # window accepts changes