예제 #1
0
	void Application::initialise(void)
	{

		mOgreWidget->show();
		mOgreWidget->resize(800,600);
		centerWidget(mOgreWidget);

		centerWidget(mLogManager, mOgreWidget);

		mLogManager->setForceProcessEvents(true);
		initialiseOgre();
		
		
		mLogManager->setForceProcessEvents(false);

		//mLogManager->hide();




		mOgreWidget->setEventHandler(mGameLogic);

		//This is a bit of a hack, necessary because we want to use the settings dialog in two different
		//ways. The first time it is shown (by Application::exec()) no slot is connected - the Accepted
		//event is handled explicitly because the system is not initialised at that point. But now (and
		//when the dialog is shown in future) we are ready for it, so we connect the accepted() signal.
		//We also call accept, to do the initial setup. See also Application::exec().
		connect(mSettingsDialog, SIGNAL(accepted()), this, SLOT(applySettings()));
		mSettingsDialog->accept();

		Ogre::NameValuePairList ogreWindowParams;
		//ogreWindowParams["FSAA"] = "8";
		mOgreWidget->initialise(&ogreWindowParams);

		//Set up resource paths. This can't be done until the OgreWidget
		//is initialised, because we need the GPUProgramManager.
		if(QFile::exists("resources.cfg"))
		{
			loadResourcePathsFromConfigFile("resources.cfg");
			Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		}

		mFPSDialog = new FPSDialog(mOgreWidget, Qt::ToolTip);
		mFPSDialog->setWindowOpacity(settings()->value("System/DefaultWindowOpacity", 1.0).toDouble());
		mFPSDialog->move(mainWidget()->geometry().topLeft() + QPoint(10,10));

		mLogManager->move(mainWidget()->geometry().left() + 10, mainWidget()->geometry().top() + mainWidget()->geometry().height() - mLogManager->frameGeometry().height() - 10);

		mGameLogic->initialise();

		if(mAutoUpdateEnabled)
		{
			mAutoUpdateTimer->start();
		}

		mIsInitialised = true;
	}
예제 #2
0
void OgreSys::initialise(void)
{
	initialiseOgre();

	//Set up resource paths. This can't be done until the OgreWidget
	//is initialised, because we need the GPUProgramManager.
	//if(QFile::exists("resources.cfg"))
	{
		loadResourcePathsFromConfigFile("resources.cfg");
		Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	}

	mGameLogic->initialise();
}