diff options
Diffstat (limited to 'Runtime/Lua/LuaHelper.cpp')
-rw-r--r-- | Runtime/Lua/LuaHelper.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Runtime/Lua/LuaHelper.cpp b/Runtime/Lua/LuaHelper.cpp index 084d4f6..b7bf543 100644 --- a/Runtime/Lua/LuaHelper.cpp +++ b/Runtime/Lua/LuaHelper.cpp @@ -114,6 +114,34 @@ Color32 State::GetValue < Color32 >(int idx, const Color32 value) }
template <>
+Color State::GetValue < Color >(int idx, const Color value)
+{
+ Color col = value;
+ if (LuaHelper::IsType(*this, "GameLab.Engine.Rendering.Color", idx))
+ {
+ col.r = GetField<float>(idx, "r", 0);
+ col.g = GetField<float>(idx, "g", 0);
+ col.b = GetField<float>(idx, "b", 0);
+ col.a = GetField<float>(idx, "a", 0);
+ }
+ else if (LuaHelper::IsType(*this, "GameLab.Engine.Rendering.Color32", idx))
+ {
+ col.r = GetField<int>(idx, "r", 0) / 255.f;
+ col.g = GetField<int>(idx, "g", 0) / 255.f;
+ col.b = GetField<int>(idx, "b", 0) / 255.f;
+ col.a = GetField<int>(idx, "a", 0) / 255.f;
+ }
+ else if (LuaHelper::IsType(*this, "table", idx))
+ {
+ col.r = GetField<float>(idx, 1, 0);
+ col.g = GetField<float>(idx, 2, 0);
+ col.b = GetField<float>(idx, 3, 0);
+ col.a = GetField<float>(idx, 4, 0);
+ }
+ return col;
+}
+
+template <>
Matrix44 State::GetValue < Matrix44 >(int idx, const Matrix44 value)
{
Matrix44 m4 = value;
|