casio
21-12-2008 11:36:30
Hi, I'm having a problem using MYGui. Using the code below I get a window with the gui layout loaded from FL_StartScreen.layout This contains only 3 buttons. It all looks ok but when I move the mouse over any button it doesn't hightlight it, Nor does it go to my onQuit function when I click on the button.
I'm obviously missing something fundamental, any ideas guys?
It's like they are disabled, but I've checked and they are all enabled.
MyGUI looks great by the way. The best one I've seen so far.
Thanks.
I should add I'm using the demo_itembox code which has this in it too:
When I create a button dynamically instead of loading a template it
all works fine. Here is the code that works.
I'm obviously missing something fundamental, any ideas guys?
It's like they are disabled, but I've checked and they are all enabled.
MyGUI looks great by the way. The best one I've seen so far.
Thanks.
MyGUI::Gui * gui = MyGUI::Gui::getInstancePtr();
int width = (int)gui->getViewWidth();
int height = (int)gui->getViewHeight();
MyGUI::FontManager::getInstance().load("core.font");
MyGUI::SkinManager::getInstance().load("core.skin");
MyGUI::LayerManager::getInstance().load("core.layer");
MyGUI::PointerManager::getInstance().load("core.pointer");
MyGUI::StaticImagePtr back = gui->createWidget<MyGUI::StaticImage>("StaticImage", MyGUI::IntCoord(0, 0, width, height), MyGUI::ALIGN_STRETCH, "Back");
back->setImageTexture("FL_StartScreen.jpg");
MyGUI::LayoutManager::getInstance().load("FL_StartScreen.layout");
MyGUI::ButtonPtr button = gui->findWidget<MyGUI::Button>("QUIT");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &Game::onQUIT);
}
void Game::onQUIT(MyGUI::WidgetPtr _sender)
{
INT32 i=0;
}
I should add I'm using the demo_itembox code which has this in it too:
bool BasisManager::mouseMoved( const OIS::MouseEvent &arg )
{
mGUI->injectMouseMove(arg);
return true;
}
bool BasisManager::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMousePress(arg, id);
return true;
}
bool BasisManager::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
mGUI->injectMouseRelease(arg, id);
return true;
}
When I create a button dynamically instead of loading a template it
all works fine. Here is the code that works.
MyGUI::ButtonPtr button = gui->createWidget<MyGUI::Button>("Button", 10, 10, 300, 26, MyGUI::ALIGN_DEFAULT , "Main");
button->setCaption("exit");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &Game::onQUIT); // CLASS_POINTER is pointer to instance of a CLASS (usually this)