Commit c6833d9a authored by bitplane's avatar bitplane

Fixed bug in button sprites reported by RdR



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4040 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d6fe1e60
......@@ -255,6 +255,31 @@ void CGUIButton::draw()
ImageRect, &AbsoluteClippingRect,
0, UseAlphaChannel);
}
}
else
{
if (DrawBorder)
skin->draw3DButtonPanePressed(this, AbsoluteRect, &AbsoluteClippingRect);
if (PressedImage)
{
core::position2d<s32> pos = spritePos;
pos.X -= PressedImageRect.getWidth() / 2;
pos.Y -= PressedImageRect.getHeight() / 2;
if (Image == PressedImage && PressedImageRect == ImageRect)
{
pos.X += 1;
pos.Y += 1;
}
driver->draw2DImage(PressedImage,
ScaleImage? AbsoluteRect :
core::recti(pos, PressedImageRect.getSize()),
PressedImageRect, &AbsoluteClippingRect,
0, UseAlphaChannel);
}
}
if (SpriteBank)
{
// pressed / unpressed animation
......@@ -276,6 +301,8 @@ void CGUIButton::draw()
}
// mouse over / off animation
if (isEnabled())
{
state = Environment->getHovered() == this ? (u32)EGBS_BUTTON_MOUSE_OVER : (u32)EGBS_BUTTON_MOUSE_OFF;
if (ButtonSprites[state].Index != -1)
{
......@@ -285,37 +312,6 @@ void CGUIButton::draw()
}
}
}
else
{
if (DrawBorder)
skin->draw3DButtonPanePressed(this, AbsoluteRect, &AbsoluteClippingRect);
if (PressedImage)
{
core::position2d<s32> pos = spritePos;
pos.X -= PressedImageRect.getWidth() / 2;
pos.Y -= PressedImageRect.getHeight() / 2;
if (Image == PressedImage && PressedImageRect == ImageRect)
{
pos.X += 1;
pos.Y += 1;
}
driver->draw2DImage(PressedImage,
ScaleImage? AbsoluteRect :
core::recti(pos, PressedImageRect.getSize()),
PressedImageRect, &AbsoluteClippingRect,
0, UseAlphaChannel);
}
if (SpriteBank && ButtonSprites[EGBS_BUTTON_DOWN].Index != -1)
{
// draw sprite
SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_DOWN].Index, spritePos,
&AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_DOWN].Color, ClickTime, os::Timer::getTime(),
ButtonSprites[EGBS_BUTTON_DOWN].Loop, true);
}
}
if (Text.size())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment