Пример #1
0
	def setupScene(self):
		sceneManager = self.root.createSceneManager(ogre.ST_GENERIC, "Default SceneManager")

		level = Level.newLevel(sceneManager)

		self.camera = sceneManager.createCamera("Camera")
		self.camera.position = (0, 150, -500)
		self.camera.lookAt ((0, 0, 0))
		self.camera.nearClipDistance = 5

		Input.onKey('W', self.forward)
		Input.onKey('S', self.back)
				
		viewPort = self.root.getAutoCreatedWindow().addViewport(self.camera)
		self.camera.aspectRatio = float (viewPort.actualWidth) / float (viewPort.actualHeight)
Пример #2
0
	def setupInputSystem(self):
		windowHandle = 0
		renderWindow = self.root.getAutoCreatedWindow()
		windowHandle = renderWindow.getCustomAttributeInt("WINDOW")
		paramList = [("WINDOW", str(windowHandle))]
		self.inputManager = OIS.createPythonInputSystem(paramList)
 
		# Now InputManager is initialized for use. Keyboard and Mouse objects
		# must still be initialized separately
		try:
			Input.init(
				self.inputManager.createInputObjectKeyboard(OIS.OISKeyboard, False), 
				self.inputManager.createInputObjectMouse(OIS.OISMouse, False)
			)
		except Exception, e:
			raise e
Пример #3
0
	def createFrameListener(self):
		self.root.addFrameListener(Input.getFrameListener())