Binkster
23-07-2012 15:40:36
Hey there!
I've recently rebooted an old project of mine. I used to be in VS2005 with Ogre 1.6 and CEGUI, but since the latter was discontinued and I prefer to work in VS2010 nowadays, I've converted the project to Ogre 1.7.4 and changed to MyGUI 3.2.0 . Unfortunatly these things never really work out of the box for me. I've been bumping in this problem for weeks now, and I figure it's time for professional help:
In main.cpp I initialize MyGui
In InputHandler I find out about OIS event, ie
In MainMenuDlg I create MyGUI widgets within its constructor:
Then there's the callback function
Most of this all works fine, the project runs, I'm seeing the button and a mouse pointed, and upon clicking anywhere, the InputHandler::mousePressed is called. The Quit_OnClick in MainMenuDlg however, is never entered.
Afaik, I've followed all the steps in QuickStart, the rest of the MyGUI documentation/FAQs and godknowshowmany threads/google searches. Could anyone tell me what I'm missing?
I've recently rebooted an old project of mine. I used to be in VS2005 with Ogre 1.6 and CEGUI, but since the latter was discontinued and I prefer to work in VS2010 nowadays, I've converted the project to Ogre 1.7.4 and changed to MyGUI 3.2.0 . Unfortunatly these things never really work out of the box for me. I've been bumping in this problem for weeks now, and I figure it's time for professional help:
In main.cpp I initialize MyGui
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(win, mSceneMgr);
mGUI = new MyGUI::Gui();
mGUI->initialise();
mPlatform->getRenderManagerPtr()->setActiveViewport(win->getNumViewports()-1);
In InputHandler I find out about OIS event, ie
bool InputHandler::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID btn)
{
MyGUI::InputManager::getInstance().injectMousePress(evt.state.X.abs, evt.state.Y.abs, MyGUI::MouseButton::Enum(btn));
if (m_simulation)
m_simulation->mousePressed(evt, btn);
return true;
}
In MainMenuDlg I create MyGUI widgets within its constructor:
MainMenuDlg::MainMenuDlg(MyGUI::Gui* mgui, InputFrameListener *pSimulation)
{
mGUI = mgui;
{....}
MyGUI::ButtonPtr pQuitButton = mGUI->createWidget<MyGUI::Button>("Button", 0, 0, 80, 30, MyGUI::Align::Default, "Main");
pQuitButton->setCaption("Quit");
pQuitButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenuDlg::Quit_OnClick);
}
Then there's the callback function
void MainMenuDlg::Quit_OnClick(MyGUI::WidgetPtr sender)
{
m_pSimulation->mContinue = false;
}
Most of this all works fine, the project runs, I'm seeing the button and a mouse pointed, and upon clicking anywhere, the InputHandler::mousePressed is called. The Quit_OnClick in MainMenuDlg however, is never entered.
Afaik, I've followed all the steps in QuickStart, the rest of the MyGUI documentation/FAQs and godknowshowmany threads/google searches. Could anyone tell me what I'm missing?