your preference on gui?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

your preference on gui?

Post by Guest »

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 :)
Guest

Post by Guest »

i would go for the second :)
Guest

Post by Guest »

gotcha, sounds good,thanks!
Masdus
Posts: 186
Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia

Post by Masdus »

The choice i think would depend completely on the style and look you are going for with your GUI. For me it is best to make a button with and individual image, as i can then easily and quickly change the image for things like mouse hover and button pressed.
Guest

Post by Guest »

oh that reminds me, how would u change it for mouseover?
Harry_Mystic
Posts: 32
Joined: Sun Nov 23, 2003 10:23 pm

Post by Harry_Mystic »

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
Post Reply