mirror of
https://github.com/Team-Resurgent/UIXLiteFTP.git
synced 2026-08-15 11:18:21 -07:00
36 lines
481 B
C++
36 lines
481 B
C++
#include "math.h"
|
|
|
|
float math::calcNinePatchPosition(int index, float length)
|
|
{
|
|
if (index == 0)
|
|
{
|
|
return 0.0f;
|
|
}
|
|
if (index == 1)
|
|
{
|
|
return 8.0f;
|
|
}
|
|
if (index == 2)
|
|
{
|
|
return length - 8.0f;
|
|
}
|
|
return length;
|
|
}
|
|
|
|
float math::calcNinePatchUV(int index, float length)
|
|
{
|
|
float uvPerPixel = length / 24.0f;
|
|
if (index == 0)
|
|
{
|
|
return 0.0f;
|
|
}
|
|
if (index == 1)
|
|
{
|
|
return 8.0f * uvPerPixel;
|
|
}
|
|
if (index == 2)
|
|
{
|
|
return length - (8.0f * uvPerPixel);
|
|
}
|
|
return length;
|
|
} |