Hello,
I'd like to stop handling my own mouseover events when the mouse is over a CEGUI widget. I'm aware of the screenToWindow and windowToScreen functions which could be used to create certain zones which, when the mouse is over them, could stop my own mouseover checks. But that isn't the most desireable solution I think, and might get hairy when dialogboxes appear and stuff..
Also I thought of stopping my mouseover-checks whenever the mouseover bool of a widget becomes true, but this would involve having eventhandlers for every single widget and isn't good performance-wise I think...
Any suggestions/ideas? Does CEGUI have a "mouseOverAnyWidget" bool built-in that I don't know of?
Thanks in advance,
Alex
Stopping my own mouseover events when CEGUI has one
Moderators: CEGUI MVP, CEGUI Team
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: Stopping my own mouseover events when CEGUI has one
take a look at
Code: Select all
CEGUI::System::getWindowContainingMouse
Re: Stopping my own mouseover events when CEGUI has one
Thanks for the good tip!
Having some probs though, my func only returns true for a combobox I have, the rest of my controls don't...
Here's my code:
Blurry suspicions: Other controls recognized as DefaultWindow? Origin at bottomleft to topleft conversion? Quick pointer-hack on mousePos?
Thanks,
Alex
Having some probs though, my func only returns true for a combobox I have, the rest of my controls don't...
Here's my code:
Code: Select all
bool SWCCG_GUI::isMouseOverGui(float const& x, float const& y){
using namespace CEGUI;
Window* mouseOverWin = System::getSingleton().getWindowContainingMouse();
CEGUI::String type = mouseOverWin->getType();
if(type == ((utf8*)"DefaultWindow")) return false;
const char* type_c = type.c_str(); // For testing
Rect mouseOverWinRect = mouseOverWin->getRect();
mouseOverWinRect = mouseOverWin->windowToScreen(mouseOverWinRect);
Point* mousePos = new Point(x, (0-y)+600);
if( mouseOverWin == NULL || !mouseOverWinRect.isPointInRect(*mousePos) ){
return false;
} else {
return true;
}
}
Blurry suspicions: Other controls recognized as DefaultWindow? Origin at bottomleft to topleft conversion? Quick pointer-hack on mousePos?
Thanks,
Alex
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Stopping my own mouseover events when CEGUI has one
DefaultWindow is the only Window that will return "DefaultWindow" as its type.
The origin for all windows is the top-left.
Your mouseOverWin->getRect() call is probably returning relative co-ords which should be converted to absolute values prior to converting to screen values.
The origin for all windows is the top-left.
Your mouseOverWin->getRect() call is probably returning relative co-ords which should be converted to absolute values prior to converting to screen values.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Stopping my own mouseover events when CEGUI has one
The values in the rect correspond with the screenpositions of the widget pretty much exactly.
I added "mouseOverWinRect = mouseOverWin->relativeToAbsolute(mouseOverWinRect);" just for the heck of it and there's no change in the behaviour... Only widgets of type "TaharezLook/Combobox" return true.
Any other ideas? I find it hard to debug this somehow..
TIA
Alex
I added "mouseOverWinRect = mouseOverWin->relativeToAbsolute(mouseOverWinRect);" just for the heck of it and there's no change in the behaviour... Only widgets of type "TaharezLook/Combobox" return true.
Any other ideas? I find it hard to debug this somehow..
TIA
Alex
Re: Stopping my own mouseover events when CEGUI has one
Okay, I ditched the doublecheck and now trust CEGUI solely... :/
Here's my code
And that seems to work good enough..
Tnx!
Ltr,
Alex
Here's my code
Code: Select all
bool SWCCG_GUI::isMouseOverGui(float const& x, float const& y){
using namespace CEGUI;
Window* mouseOverWin = System::getSingleton().getWindowContainingMouse();
if (mouseOverWin == NULL) return false;
CEGUI::String type = mouseOverWin->getType();
if(type == ((utf8*)"DefaultWindow")) {
return false;
} else {
return true;
}
}
And that seems to work good enough..
Tnx!
Ltr,
Alex
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Stopping my own mouseover events when CEGUI has one
You can always trust cegui
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 3 guests