Code: Select all
CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().loadWindowLayout((CEGUI::utf8*)"gui.xml");
mGUISystem->setGUISheet(sheet);
try
{
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&MarchDemo::startAnimation, this)
);
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::Window::EventMouseEnters,
CEGUI::Event::Subscriber(&MarchDemo::handleMouseEnters, this)
);
wmgr.getWindow((CeStr)"StartButton")
->subscribeEvent(
CEGUI::Window::EventMouseLeaves,
CEGUI::Event::Subscriber(&MarchDemo::handleMouseExits, this)
);
}
catch (CEGUI::UnknownObjectException e)
{
MessageBox(NULL, e.getMessage().c_str(), "Error", MB_OK);
}
///More misc code
bool MarchDemo::startAnimation(const CEGUI::EventArgs& e)
{
MessageBox(NULL, "Button Clicked", "", MB_OK);
mController->startAnimation();
return true;
}
bool MarchDemo::handleMouseEnters(const CEGUI::EventArgs& e)
{
MessageBox(NULL, "Testing", "", MB_OK);
mController->setGUIActive(true);
return true;
}
bool MarchDemo::handleMouseExits(const CEGUI::EventArgs& e)
{
mController->setGUIActive(false);
return true;
}