The easiest way I found was to create a new class derivered from IGUIButton, copy the code from CGUIButton.h and .cpp and then start changing/adding functions depending what I need. So it is a button with an image.
About mouseover, in the button OnEvent I've putted something like this:
Code: Select all
case EET_GUI_EVENT:
if (event.GUIEvent.EventType == gui::EGET_ELEMENT_HOVERED)
{
MouseOver = true;
}
else if (event.GUIEvent.EventType == gui::EGET_ELEMENT_LEFT)
{
MouseOver = false;
}
break;
And in the draw function check if mouseover and draw the right image/texture.
Don't know another way to do this but is works. Oh, and you need a function setImageForMouseOver.
About "one image for all states" vs. "one image for each state":
you can have the 3 functions for each state and another one for 1 image for all states. Can't find any code at the moment , sorry.
Hope this helps