Take target icon size into account when computing positions in sprite bank

This commit is contained in:
Deve
2018-12-18 22:15:31 +01:00
parent 13f0276aac
commit 028c999a3e

View File

@@ -63,8 +63,19 @@ core::array< core::rect<s32> >& STKModifiedSpriteBank::getPositions()
for (int n=0; n<(int)Rectangles.size(); n++)
{
const int h = getScaledHeight(Rectangles[n].getHeight());
const int w = getScaledWidth(Rectangles[n].getWidth());
float icon_scale_x = 1.0f;
float icon_scale_y = 1.0f;
if (m_target_icon_size.Width > 0 && m_target_icon_size.Height > 0)
{
icon_scale_x = (float)m_target_icon_size.Width /
(float)Rectangles[n].getWidth();
icon_scale_y = (float)m_target_icon_size.Height /
(float)Rectangles[n].getHeight();
}
const int h = getScaledHeight(Rectangles[n].getHeight()) * icon_scale_y;
const int w = getScaledWidth(Rectangles[n].getWidth()) * icon_scale_x;
copy.push_back( core::rect<s32>(Rectangles[n].UpperLeftCorner,
core::dimension2d<s32>(w,h) )
);