本文整理汇总了Python中panda3d.core.WindowProperties.setMouseMode方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.setMouseMode方法的具体用法?Python WindowProperties.setMouseMode怎么用?Python WindowProperties.setMouseMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.setMouseMode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: catchCursor
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def catchCursor(self):
# center the mouse in the middle of the window
base.win.movePointer(0, self.win_width_half, self.win_height_half)
# Set mouse mode to relative which should work best for our purpose
wp = WindowProperties()
wp.setMouseMode(WindowProperties.M_relative)
base.win.requestProperties(wp)
示例2: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def __init__(self):
ShowBase.__init__(self)
Globals.OFFLINE = False
self.client = 0
self.engine = 0
#PStatClient.connect()
wp = WindowProperties()
wp.setSize(Settings.WIDTH, Settings.HEIGHT)
wp.setTitle("Modifire")
wp.setMouseMode(WindowProperties.MRelative)
#wp.setCursorHidden(True)
base.win.requestProperties(wp)
base.setBackgroundColor(0.133, 0.133, 0.133)
self.disableMouse()
self.client = Client()
self.mainMenu = MainMenu()
self.SetupEventHandlers()
self.pid = -1
self.loadingScreen = None
SettingsController.LoadClientSettings()
version = OnscreenText(text = Globals.VERSION, pos = (0.3, -0.07), scale = 0.07, fg = (1, 1, 1, 1))
version.reparentTo(base.a2dTopLeft)
version.setBin('fixed', 200)
Preloader.Preload()
示例3: setMouseModeRelative
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def setMouseModeRelative(self, state):
props = WindowProperties()
if not state:
props.setMouseMode(WindowProperties.MAbsolute)
else:
props.setMouseMode(WindowProperties.MRelative)
self.targetWin.requestProperties(props)
示例4: setMouseLook
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def setMouseLook(self, mouseLook):
self.mouseLook = mouseLook
self.mouseGrabbed = mouseLook # for now
wp = WindowProperties()
wp.setMouseMode(mouseLook and WindowProperties.MConfined or WindowProperties.MAbsolute)
wp.setCursorHidden(mouseLook)
self.base.win.requestProperties(wp)
self.base.taskMgr.doMethodLater(0, self.resolveMouse, "resolve mouse")
示例5: setMouseMode
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def setMouseMode(self, mode):
print "Changing mode to",mode
self.mouseMode = mode
wp = WindowProperties()
wp.setMouseMode(mode)
self.base.win.requestProperties(wp)
# these changes may require a tick to apply
self.base.taskMgr.doMethodLater(0, self.resolveMouse, "Resolve mouse setting")
示例6: __init__
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def __init__(self, mouse):
ShowBase.__init__(self)
self.mouse = mouse
self.joy_x = None
self.joy_y = None
props = WindowProperties()
props.setMouseMode(WindowProperties.MRelative) # keep mouse in screen
self.disableMouse()
self.win.requestProperties(props)
self.setBackgroundColor(0, 0, 0)
# Make missiles glow
self.filters = CommonFilters(self.win, self.cam)
self.filters.setBloom(blend=(0, 0, 0, 1), desat=-0.5, intensity=3.0, size="large")
self.screen_width = self.win.getXSize()
self.screen_height = self.win.getYSize()
self.center_x = self.screen_width/2
self.center_y = self.screen_height/2
# self.win.movePointer(0, self.center_x, self.center_y)
self.enableParticles()
self.cTrav = CollisionTraverser()
# self.cTrav.setRespectPrevTransform(True)
self.pusher = PhysicsCollisionHandler()
self.pusher.addInPattern('%fn-into-%in')
self.target = None
self.maxvel = 50
self.roll_time = 0
self.fuel = 1000
self.ship()
self.sounds()
self.hud()
self.part = Spacedust(self)
self.events()
self.camLens.setFov(70)
self.camLens.setNear(1)
self.camLens.setFar(500)
self.get_key = {
"ACCEL": False,
"DECEL": False,
"FORWARD_THRUST": False,
"REVERSE_THRUST": False,
"ROLL_LEFT": False,
"ROLL_RIGHT": False,
"ROLL_LEFT_BEG": False,
"ROLL_RIGHT_BEG": False,
"FIRE": False,
"FIRING": False,
"LOCK": False,
"LOCKING": False,
}
self.AIworld = AIWorld(self.render)
self.taskMgr.add(self.update, "task-update")
self.taskMgr.doMethodLater(1, self.fuel_usage, "task-fuel-usage")
self.taskMgr.add(self.AI_update, "AI-update")
self.gen_enemy()
示例7: toggleMouseFocus
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def toggleMouseFocus(self):
self.hasMouse = not self.hasMouse
wp = WindowProperties()
if self.hasMouse:
wp.setMouseMode(WindowProperties.MAbsolute)
if self.fpscamera:
self.fpscamera.setEnabled(False)
else:
wp.setMouseMode(WindowProperties.MRelative)
if self.fpscamera:
self.fpscamera.setEnabled(True)
wp.setCursorHidden(self.hasMouse)
self.base.win.requestProperties(wp)
示例8: freeCursor
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def freeCursor(self):
# free the cursor
wp = WindowProperties()
wp.setMouseMode(WindowProperties.M_absolute)
base.win.requestProperties(wp)
示例9: showMouse
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def showMouse(self):
props = WindowProperties()
props.setCursorHidden(False)
props.setMouseMode(WindowProperties.M_absolute)
base.win.requestProperties(props)
示例10: hideMouse
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
def hideMouse(self):
props = WindowProperties()
props.setCursorHidden(True)
props.setMouseMode(WindowProperties.M_relative)
base.win.requestProperties(props)
示例11: MetalSlender
# 需要导入模块: from panda3d.core import WindowProperties [as 别名]
# 或者: from panda3d.core.WindowProperties import setMouseMode [as 别名]
class MetalSlender(ShowBase):
VERSION=0.1
GRAVITY = 9.81
def __init__(self):
ShowBase.__init__(self)
self.initVideo()
self.initGame()
def initVideo(self):
self.render.setShaderAuto()
#TODO: Not working
self.render.setAntialias(AntialiasAttrib.MMultisample)
self.props = WindowProperties()
# self.props.setFullscreen(True)
# self.props.setSize(1920, 1080)
self.props.setSize(1280, 720)
self.props.setCursorHidden(False)
self.props.setMouseMode(self.props.M_absolute)
self.win.requestProperties(self.props)
self.win.movePointer(0, 100, 100)
def initGame(self):
self.paused = False
self.initTimer = True
self.time = 0
self.gameOver = True
# self.setFrameRateMeter(True)
self.taskMgr.add(self.menuDisplay, "menuDisplay")
self.mainMenu = MainMenu(self)
self.introSound = self.loader.loadSfx('assets/sounds/intro.mp3')
self.introSound.setLoop(True)
self.introSound.play()
#TODO: Refactor environment into a class that inherits from nodepath
def setupEnvironment(self):
self.setBackgroundColor(0,0,0)
self.setupLighting()
self.setupFog()
self.setupSkydome()
self.setupPhysics()
def setupFog(self):
self.fog = Fog("fog")
self.fog.setColor(FOG_COLOR)
self.fog.setExpDensity(FOG_EXP_DENSITY)
self.render.setFog(self.fog)
def setupSkydome(self):
self.skydome = self.loader.loadModel(EGG_SKYDOME)
self.skydome.setBin('background', 0)
self.skydome.setDepthWrite(False)
self.skydome.reparentTo(self.cam)
self.skydome.setCompass()
self.skydome.setLight(self.shadeless)
self.skydome.setScale(20)
def setupLighting(self):
alight = AmbientLight("AmbientLight")
alight.setColor(AMBIENT_LIGHT)
self.amblight = self.render.attachNewNode(alight)
self.render.setLight(self.amblight)
alight = AmbientLight("ShadelessLight")
alight.setColor((1.0, 1.0, 1.0, 1.0))
self.shadeless = self.render.attachNewNode(alight)
def setupPhysics(self):
self.cTrav = CollisionTraverser()
plane = self.render.attachNewNode(CollisionNode('WorldBottom'))
plane.node().addSolid(CollisionPlane(Plane(0, 0, 1, 30)))
plane.node().setIntoCollideMask(CollisionMask.SCENE)
#TODO: Set the scenario's into collide mask to a special value
def loadScenario(self):
self.rooms = []
self.rooms.append(Room(self, self.render, "LCG" , "assets/chicken/lcg" ))
self.rooms.append(Room(self, self.render, "Bloco H" , "assets/chicken/blocoh" ))
self.rooms.append(Room(self, self.render, "Bloco H2" , "assets/chicken/blocoh2"))
self.rooms.append(Room(self, self.render, "Collision", "assets/chicken/collision" ))
self.rooms[-1].root.setCollideMask(CollisionMask.SCENE)
def addCommands(self):
self.accept('escape', self.userExit)
self.accept('g', self.endGame)
self.accept('i', self.actionKeys, ['i'])
self.accept('p', self.pauseGame)
self.accept('z', self.restartGame)
#.........这里部分代码省略.........