Hello,
How can i determine if the sheet is clicked, i want to enable "game input" when i click the sheet root window and disable the "game input" when i click and other window.
How is that accomplished or is that possible at all ?
all myy attempts of doing this seems to have failed becourse the mouse click event for the root window is seems to be called even if i dont click the root window.
- Kristian
sheet / root window events
Moderators: CEGUI MVP, CEGUI Team
Re: sheet / root window events
Have you tried EventActivated and EventDeactivated on either all of your widgets or the (doubt it would work as your widgets are children) root sheet?
I never tried MouseClicked but MouseButtonDown and MouseButtonUp work properly on the root for me as of 0.3.0.
Another thing that might be effective is doing something similar to XMouse using MouseEnters/MouseLeaves on your widgets. IE: when you move the mouse over a FrameWindow, your input switches to the form, when it goes over the GUISheet, your input goes to the game.
Hope this helps.
I never tried MouseClicked but MouseButtonDown and MouseButtonUp work properly on the root for me as of 0.3.0.
Another thing that might be effective is doing something similar to XMouse using MouseEnters/MouseLeaves on your widgets. IE: when you move the mouse over a FrameWindow, your input switches to the form, when it goes over the GUISheet, your input goes to the game.
Hope this helps.
[font=Verdana][size=xx-small]"It's not hard to stand out when the general level of competence is so low" -EMH[/size][/font]
namik@flashmail.com
namik@flashmail.com
Re: sheet / root window events
this is the solution i came up with:
bool GuiEventHandler::_onSheet_MouseClick( const CEGUI::EventArgs& e ) {
CEGUI::Window* c = mGuiSystem->getGUISheet()->getChildAtPosition(((const CEGUI::MouseEventArgs&)e).position);
if( c != 0 ) {
mInputMode = 0;
false;
} else {
mInputMode = 1;
if( mGuiSystem->getGUISheet()->getActiveChild() )
mGuiSystem->getGUISheet()->getActiveChild()->deactivate();
((CEGUI::EventArgs&)e).handled = true;
}
return e.handled;
}
bool GuiEventHandler::_onSheet_MouseClick( const CEGUI::EventArgs& e ) {
CEGUI::Window* c = mGuiSystem->getGUISheet()->getChildAtPosition(((const CEGUI::MouseEventArgs&)e).position);
if( c != 0 ) {
mInputMode = 0;
false;
} else {
mInputMode = 1;
if( mGuiSystem->getGUISheet()->getActiveChild() )
mGuiSystem->getGUISheet()->getActiveChild()->deactivate();
((CEGUI::EventArgs&)e).handled = true;
}
return e.handled;
}
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 11 guests