I dont see the gui with MyGui 3.0.1

Ilovechocolat

31-01-2011 18:23:13

Hello World !

First, i'm french so i can make some gramatical error in this message .

I created a program and i want a gui in it, i dont like CEGUI so i choose MyGui but it dont work :( .
It is compile but i dont see my gui .

here it is a part of my code :
GUIEngine::GUIEngine(Ogre::RenderWindow* win, Ogre::SceneManager* sceneManager)
{
m_window = win;
m_sceneManager = sceneManager;
m_platform = new MyGUI::OgrePlatform();
m_platform->initialise(win, sceneManager);
m_gui = new MyGUI::Gui();
m_gui->initialise();
}
GUIEngine::~GUIEngine()
{
m_gui->shutdown();
delete m_gui;
m_platform->shutdown();
delete m_platform;
}
bool GUIEngine::printButton(Ogre::Root* root, io::EventEngine* eventEngine)
{
MyGUI::ButtonPtr button = m_gui->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::Align::Default, "Main");
button->setCaption("exit");
while(eventEngine->update())
{
m_gui->injectFrameEntered(eventEngine->getTimeSinceLastFrame());
Ogre::WindowEventUtilities::messagePump();

if(m_window->isClosed() || button->getButtonPressed())
return false;;
root->renderOneFrame();
}
return true;
}


And the viewport/camera/sceneManager declaration :

m_sceneManager = m_root->createSceneManager("DefaultSceneManager");
//on ajoute la camera
m_camera = m_sceneManager->createCamera("SceneCamera");
m_camera->setPosition(Ogre::Vector3(0, 0, 0));
m_camera->setPosition(Ogre::Vector3(0, 0, 0));
m_camera->lookAt(Ogre::Vector3(0, 0, 0));
m_camera->setNearClipDistance(5);
m_camera->setFarClipDistance(50000);
if(m_root->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
{
m_camera->setFarClipDistance(0);
}
//et son viewport
Ogre::Viewport* vp = m_root->getAutoCreatedWindow()->addViewport(m_camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
m_camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
//on s'occupe de la gui et de l'ecran de login
m_guiEngine = new gui::GUIEngine(win, m_sceneManager);
m_guiEngine->loginMenu(root, m_eventEngine);


thanks for your future help !

Altren

31-01-2011 19:02:58

First of all - looks through MyGUI.log. Usually main problem in such cases is that gui can't find resources.

Ilovechocolat

31-01-2011 20:02:34

Thank you, your were right, i move the .png file next to my executable and it work fine .