Пример #1
0
//Run the app
void Application::go()
{
	Ogre::Timer loopTimer;	
	long lastTick,currentTick;
	lastTick=loopTimer.getMillisecondsCPU();
	float fpsStep = 1.0f/(float)FPS;
	float frameDelta;
	bool continueRunning=true;
	while(continueRunning)
	{
		Ogre::WindowEventUtilities::messagePump();
		capture();

		currentTick=loopTimer.getMillisecondsCPU();
		frameDelta = (currentTick-lastTick)*0.001;
		static float logicUpdateCounter=0;
		logicUpdateCounter+=frameDelta;
		while (logicUpdateCounter>fpsStep)
		{
			logicUpdateCounter-=fpsStep;
			updateLogic(fpsStep);
			updateGraphics(fpsStep);
		}
		bool windowClosed = m_window->isClosed();
		continueRunning &= ! windowClosed;
		bool renderFrameSuccess = m_root->renderOneFrame();

		continueRunning &= renderFrameSuccess;
		continueRunning &= ! m_exitRequested;
		lastTick=currentTick;
	}
}