Beispiel #1
0
	bool frameStarted(const Ogre::FrameEvent& evt)
	{
		if (mExit)
			return false;
		if (mWindow->isClosed())
			return false;

		mKeyboard->capture();
		mMouse->capture();

		if (mKeyboard->isKeyDown(OIS::KC_A) || mKeyboard->isKeyDown(OIS::KC_LEFT))
			mCamera->moveRelative(Ogre::Vector3(-evt.timeSinceLastFrame*20, 0, 0));

		if (mKeyboard->isKeyDown(OIS::KC_D) || mKeyboard->isKeyDown(OIS::KC_RIGHT))
			mCamera->moveRelative(Ogre::Vector3(evt.timeSinceLastFrame*20, 0, 0));

		if (mKeyboard->isKeyDown(OIS::KC_W) || mKeyboard->isKeyDown(OIS::KC_UP))
			mCamera->moveRelative(Ogre::Vector3(0, 0, -evt.timeSinceLastFrame*20));

		if (mKeyboard->isKeyDown(OIS::KC_S) || mKeyboard->isKeyDown(OIS::KC_DOWN))
			mCamera->moveRelative(Ogre::Vector3(0, 0, evt.timeSinceLastFrame*20));

		mGUI->injectFrameEntered(evt.timeSinceLastFrame);

		return true;
	}
Beispiel #2
0
bool GraphicsImpl::doStep()
{
	if (newWorld) {
		boost::mutex::scoped_lock lock(worldMutex);
		std::swap(frontWorld, backWorld);
		newWorld = false;
	}

	gui->injectFrameEntered(timeSinceLastFrame());

	moveScale = timeSinceLastFrame() * 100;
	camera->moveRelative(movementVector * moveScale);
	updatePositions();
	Ogre::WindowEventUtilities::messagePump();
	caelumSystem->notifyCameraChanged(camera);
	return root->renderOneFrame();
}