Button images

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Button images

Post by Bate »

I found a bug using images for buttons.

Code: Select all

// image size is 75x25
IGUIButton *button = guienv->addButton(recti(0,0,75,25), 0, TESTID, L"TEST");
button->setDrawBorder(false);
button->setImage(driver->getTexture("data/my.png"));
button->setPressedImage(driver->getTexture("data/my.png"));
button->setUseAlphaChannel(true);
That way the PressedImage moves 1px down and right relative to the normal Image (on click). If I create a copy of the image file and name it for example my2.png so that 2 different files are loaded, then it works.

Code: Select all

// this works
button->setImage(driver->getTexture("data/my.png"));
button->setPressedImage(driver->getTexture("data/my2.png"));
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, I think this was once added as a feature to make a click visible even if image-up and image-pressed are identical.

I remember I had a problem with this once - but I think in the past it was always enabled. The current solution of only using this when images are the size of the button and when those two are identical sounds rather reasonable to me. Does this cause a problem?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

Not really a problem (now), but figuring out that you have to use 2 different files took quite some time. :) Besides, the click is always visible even if you use 2 identical files since the button text still makes a click move (if you have a text).
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Maybe you find this patch useful, if it isnt totally outdated. If AutoScale is enabled this offset wont be applied :) .
Post Reply