Nekomaru
28-10-2010 17:35:19
Hello there. I have a problem while init MyGUI
Code:
I run the application and get a runtime error. What should i do?
Code:
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
{
//Root, SceneManager and RenderWindow
//=========================================//
Ogre::Root *mRoot;
Ogre::SceneManager *mScnMgr;
Ogre::RenderWindow *mRndWindow;
mRoot = OGRE_NEW Ogre::Root(pluginsCfg, ogreCfg);
mScnMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
mRoot->showConfigDialog();
mRoot->saveConfig();
mRoot->initialise(true, "Game Framework");
mRndWindow = mRoot->getAutoCreatedWindow();
//=========================================//
//Camera, Viewport
//=========================================//
Ogre::Viewport *mVp;
Ogre::Camera *mCamera;
mCamera = mScnMgr->createCamera("MainCamera");
mCamera->setPosition(0, 0, -50);
mCamera->lookAt(Ogre::Vector3(0,0,0));
mCamera->setNearClipDistance(5);
mCamera->setFarClipDistance(1000);
mVp = mRndWindow->addViewport(mCamera);
mVp->setBackgroundColour(Ogre::ColourValue(0.45,0.3,0.58));
mCamera->setAspectRatio(
Ogre::Real(mVp->getActualWidth()) / Ogre::Real(mVp->getActualHeight()));
//=========================================//
//MyGUI
//=========================================//
MyGUI::Gui* mGUI;
MyGUI::OgrePlatform* mPlatform;
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mRndWindow, mScnMgr); // mWindow is Ogre::RenderWindow*, mSceneManager is Ogre::SceneManager*
mGUI = new MyGUI::Gui();
mGUI->initialise();
//RenderLoop
//=========================================//
while(true)
{
// Pump window messages for nice behaviour
Ogre::WindowEventUtilities::messagePump();
if(mRndWindow->isClosed())
{
return 0;
}
// Render a frame
if(!mRoot->renderOneFrame()) return 0;
}
//=========================================//
return 0;
}
I run the application and get a runtime error. What should i do?