GUI question -> Clickable Images

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
fnolis

GUI question -> Clickable Images

Post by fnolis »

I wonder if there are a way to get the EventHandler to "react" when I click in IGUIImage images... alt. to set a button without borders... and add an image so that the visual result would be the same...
Namek Kural
Posts: 81
Joined: Sun Sep 09, 2007 7:01 pm
Location: BW, Germany

Post by Namek Kural »

Anyone knows how to do this? I'd like to know the answer, too.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

AFAIK there is no way for this...
You could code it on your own (check if the mouse is inside the image rect and if the button was clicked)... ;)

Or you can set the button transparent (look at tutorial 05.UserInterface how to do this), this maybe works too...
But this acts on all buttons...

In my IrrExtensions I made a function for the button especially for this purpose to set a single button completely transparent, only the image is shown then and it still reacts like a button... 8)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
TomiZ
Posts: 40
Joined: Wed Aug 29, 2007 6:02 am
Location: Poland
Contact:

Post by TomiZ »

It's works fine.

Just add button with image. Borders wouldn't be draw, becouse Irrlicht draw it before image. You can also turn borders off.

Code: Select all

gui::IGUIButton *MyButton = Gl.Irr.gui->addButton(Position, parent, ID, L"", L"");
MyButton->setImage(       TextureForButton, FirstRect);
MyButton->setPressedImage(TextureForButton, SecondRect);
MyButton->setDrawBorder(false);
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hahaha, and another new feature in 1.3 probably inspired by my Extensions !!! :lol:

Maybe I should now get a credit in the sdk for my inspirations !?!?! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply