2020-08-04 12:31:33 +08:00
|
|
|
#include "TweenValue.h"
|
2021-07-17 23:32:31 +08:00
|
|
|
#include "base/format.h"
|
2020-08-04 12:31:33 +08:00
|
|
|
|
|
|
|
NS_FGUI_BEGIN
|
2022-07-11 17:50:21 +08:00
|
|
|
USING_NS_AX;
|
2020-08-04 12:31:33 +08:00
|
|
|
|
|
|
|
TweenValue::TweenValue():x(0),y(0),z(0),w(0),d(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Vec2 TweenValue::getVec2() const
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
return axis::Vec2(x, y);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
void TweenValue::setVec2(const axis::Vec2 & value)
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
|
|
|
x = value.x;
|
|
|
|
y = value.y;
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Vec3 TweenValue::getVec3() const
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
return axis::Vec3(x, y, z);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
void TweenValue::setVec3(const axis::Vec3 & value)
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
|
|
|
x = value.x;
|
|
|
|
y = value.y;
|
|
|
|
z = value.z;
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Vec4 TweenValue::getVec4() const
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
return axis::Vec4(x, y, z, w);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
void TweenValue::setVec4(const axis::Vec4 & value)
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
|
|
|
x = value.x;
|
|
|
|
y = value.y;
|
|
|
|
z = value.z;
|
|
|
|
w = value.w;
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Color4B TweenValue::getColor() const
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
2022-07-11 17:50:21 +08:00
|
|
|
return axis::Color4B(x, y, z, w);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
void TweenValue::setColor(const axis::Color4B & value)
|
2020-08-04 12:31:33 +08:00
|
|
|
{
|
|
|
|
x = value.r;
|
|
|
|
y = value.g;
|
|
|
|
z = value.b;
|
|
|
|
w = value.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
float TweenValue::operator[](int index) const
|
|
|
|
{
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return x;
|
|
|
|
case 1:
|
|
|
|
return y;
|
|
|
|
case 2:
|
|
|
|
return z;
|
|
|
|
case 3:
|
|
|
|
return w;
|
|
|
|
default:
|
2021-07-17 23:32:31 +08:00
|
|
|
throw fmt::format("Index out of bounds: {}", index);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float & TweenValue::operator[](int index)
|
|
|
|
{
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return x;
|
|
|
|
case 1:
|
|
|
|
return y;
|
|
|
|
case 2:
|
|
|
|
return z;
|
|
|
|
case 3:
|
|
|
|
return w;
|
|
|
|
default:
|
2021-07-17 23:32:31 +08:00
|
|
|
throw fmt::format("Index out of bounds: {}", index);
|
2020-08-04 12:31:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TweenValue::setZero()
|
|
|
|
{
|
|
|
|
x = y = z = w = d = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_FGUI_END
|