Page 1 of 1

Generic Hitbox

Posted: Sun Apr 17, 2005 04:58
by JNighthawk
Is there a generic hitbox widget? I want to have an area that will execute a function when clicked on using CEGUI. Any suggestions? I was thinking about just having an invisible button, but it would be nice if there was a generic hitbox widget that will display nothing, but still take input.

Re: Generic Hitbox

Posted: Mon Apr 18, 2005 16:47
by spannerman
Well I think all the widgets inherit the basic events, so you could listen to the onMouseClicked event from just a blank GUISheet (if you want it blank, doesnt have to be). Create a GUISheet something like this:

Code: Select all

(GUISheet*)WindowManager::getSingleton().createWindow("DefaultGUISheet", "myHitBox");


Hope that helps

Re: Generic Hitbox

Posted: Wed Apr 20, 2005 09:52
by JNighthawk
Wouldn't the GUI sheet cover the entire screen? And can't you only show one GUI sheet at a time? If I wanted to use this with an already existing GUI sheet, I could just subscribe the click event to the sheet? I would definitly prefer a much cleaner widget (such as a polygon widget? I can provide code to test for a point in a convex polygon if it's a problem).

Re: Generic Hitbox

Posted: Wed Apr 20, 2005 16:49
by lindquist
the gui sheet is just a window like everything else.

you can add a gui sheet as a child of any window and you can resize it to fit your needs.

it just gives just a default window that does'nt draw anything (edit: except its children...)