Page 1 of 1
need help Handling CEGUI events
Posted: Sun May 22, 2005 13:41
by jed
Hi Guys, I'm having trouble getting event handling to work. I also set up event hanlders for mouseEnter and MouseLeave but none get called? All these things display fine.
[code]CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow("Spellbar")->subscribeEvent(
CEGUI::Window::EventMouseClick,
CEGUI::Event::Subscriber(&Spellbar::handleMouseClick, this));
from my .layout file:
<GUILayout>
<Window Type="DefaultGUISheet" Name="root">
<Window Type="DefaultGUISheet" Name="Spellbar">
<Property Name="Position" Value="x:0 y:.85" />
<Property Name="Size" Value="w:1 h:.2" />
<Window Type="TaharezLook/StaticImage" Name="Spellbar/background">
<Property Name="MetricsMode" Value="Absolute" />
<Property Name="Position" Value="x:0 y:0" />
<Property Name="Size" Value="w:600 h:68" />
<Property Name="Image" Value="set:MainScreen image:Spellbar" />
<Property Name="FrameEnabled" Value="false" />
</Window>
</Window>
</Window>
</GUILayout>[/code]
Any ideas whatelse I need to do?
Re: need help Handling CEGUI events
Posted: Sun May 22, 2005 14:35
by lindquist
try changing this line:
Code: Select all
CEGUI::Event::Subscriber(&Spellbar::handleMouseClick, this));
to this:
Code: Select all
CEGUI::Event::Subscriber(Spellbar::handleMouseClick, this));
That's how I do it...
If this does not work, I'll look more into the event system. This is'nt the first time trouble like this is posted...
Re: need help Handling CEGUI events
Posted: Sun May 22, 2005 15:57
by jed
No it still doesn't get any events.
I looked at trying the latest CEGUI in cvs since it seems like a lot has changed but I don't see an Ogre renderer there? Is there an easy way to get the currrent cvs version to work with ogre?
Re: need help Handling CEGUI events
Posted: Sun May 22, 2005 16:46
by lindquist
The Ogre renderer has been moved outside of CEGUI and into Ogre itself instead.
Re: need help Handling CEGUI events
Posted: Sun May 22, 2005 19:06
by jed
Thanks I got it working. Stupid mistake on my part.
Re: need help Handling CEGUI events
Posted: Mon Aug 29, 2005 01:37
by Viper
jed,
If you happen to still be reading this forum, could you please post what your solution was? I am now having the same problem and came across this post. I just found ceGUI and am trying to implement it into a game that I have been working on. My layout and everything loads, I get the event registered with no errors now, but my handler never gets called. I am currently only trying to implement a handler for MouseEnter.
Thanks for the help.
During GUI setup:
Code: Select all
wmgr.getWindow("btnSingle")->subscribeEvent(CEGUI::ButtonBase::EventNamespace+"/"+CEGUI::ButtonBase::EventMouseEnters,CEGUI::Event::Subscriber(EventMouseOver));
And the handler:
Code: Select all
bool EventMouseOver(const CEGUI::EventArgs& e)
{
SoundManager->PlaySound(g_iGameSounds[MENU_DRAGOVER]);
return true;
};
I have set a breakpoint in the handler, but it never gets called. Also, I am injecting inputs properly as the cursor moves and the buttons highlight when moved over.
Re: need help Handling CEGUI events
Posted: Mon Aug 29, 2005 01:53
by Viper
Okay, found my problem. I was making the event subscription
way too complicated. I changed:
Code: Select all
wmgr.getWindow("btnSingle")->subscribeEvent(CEGUI::ButtonBase::EventNamespace+"/"+CEGUI::ButtonBase::EventMouseEnters,CEGUI::Event::Subscriber(EventMouseOver));
to
Code: Select all
wmgr.getWindow("btnSingle")->subscribeEvent("MouseEnter",EventMouseOver);
It works fine now!
BTW, CrazyEddie, great piece of software! Once I get this all figured out, I would be interested in helping you write tutorials to make the learning curve less steep.
Re: need help Handling CEGUI events
Posted: Mon Aug 29, 2005 07:59
by CrazyEddie
Viper wrote:
BTW, CrazyEddie, great piece of software! Once I get this all figured out, I would be interested in helping you write tutorials to make the learning curve less steep.
Thanks
Any and tutorials should now be done via the wiki - and we're most grateful for all efforts in this area.