Hi there, I was having some troubles with mouse events in a 3D environment rendered by Ogre, while having a CEGUI interface. It seems that when I'd click on a GUI element, the click would both interact with the GUI and with the world behind it. Despite lots of searching and experimentation, I haven't found a good way of countering this behaviour.
As an example, I stumbled on a GLSL demo posted in the Ogre forums (by nfz, I believe) that featured something very similar to my scene: a 3D environment that reacted to mouse input, but only had the GUI react when those elements were clicked by mouse. I've been trying to emulate that with little success. Any advice anyone is able to offer on the issue, or perhaps thoughts on what code I might post to clarify the issue? Thanks!
Differentiating mouse events between CEGUI and Ogre
Moderators: CEGUI MVP, CEGUI Team
Re: Differentiating mouse events between CEGUI and Ogre
Hi yeah i've seen someone else fix a similar problem by doing a test on the mouse position in relation to the interface's area. If the mouse is over the interface they then only allowed interactions with the interface if it wasn't it affected the world.
All you need is a boolean to switch on and off and do ur world interactions based on the state of the boolean.
All you need is a boolean to switch on and off and do ur world interactions based on the state of the boolean.
- Exsortis
- CEGUI Team (Retired)
- Posts: 42
- Joined: Mon Feb 07, 2005 17:13
- Location: Palmdale, CA
- Contact:
Re: Differentiating mouse events between CEGUI and Ogre
You want to consume the event if CEGUI uses it:
-E
Code: Select all
if(CEGUI::System::getSingleton().injectMouseButtonDown(_mapMouseButton(e->getButtonID())))
{
e->consume();
}
-E
Re: Differentiating mouse events between CEGUI and Ogre
Sorry, should have clarified a couple extra things that I did.
Exsortis: I was basing my work from the GUI demo in Ogre; that is, all of the mouse events have already been programmed to consume input. My function is basically the same as yours, except that it steps through a local function to convert the input to Ogre instead of your _mapMouseButton method (could you clarify where you got this, btw? I can't seem to find it in the API). Evidently I'm not doing something though, as the consumes aren't processing for some reason.
Rellik: Someone already suggested something like this on the Ogre forums; I've just been having problems implementing it. Since my GUI isn't static (it changes shapes and such based on the state), I needed a dynamic way of doing this. To this point, I was attempting to use the CEGUI::Window::getChildAtPosition function, but this was always returning true to me, no matter what. This might have something to do with how I setup my layout though; each of the states is its own "window", so maybe that's why it's catching the input....
Anyhow, thanks for the reply, both.
Exsortis: I was basing my work from the GUI demo in Ogre; that is, all of the mouse events have already been programmed to consume input. My function is basically the same as yours, except that it steps through a local function to convert the input to Ogre instead of your _mapMouseButton method (could you clarify where you got this, btw? I can't seem to find it in the API). Evidently I'm not doing something though, as the consumes aren't processing for some reason.
Rellik: Someone already suggested something like this on the Ogre forums; I've just been having problems implementing it. Since my GUI isn't static (it changes shapes and such based on the state), I needed a dynamic way of doing this. To this point, I was attempting to use the CEGUI::Window::getChildAtPosition function, but this was always returning true to me, no matter what. This might have something to do with how I setup my layout though; each of the states is its own "window", so maybe that's why it's catching the input....
Anyhow, thanks for the reply, both.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 4 guests