hey all just wondering on what ur preference on gui would be
would u prefer making a button and setting it an image?
or making an image and putting an invisible button on top of it?
second choice i suggested cause then you could just have one big texture instead a texture for each button...but idk, ur thoughts plz
your preference on gui?
-
- Posts: 32
- Joined: Sun Nov 23, 2003 10:23 pm
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:
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
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;
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