summaryrefslogtreecommitdiff
path: root/Runtime/Lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-20 17:32:55 +0800
committerchai <chaifix@163.com>2021-11-20 17:32:55 +0800
commitbb452bba78dc1870d6316b383180472fe3a8a06a (patch)
tree6084d6c608e00f28fe4b1437e0df228d68c268de /Runtime/Lua
parent74ca8143a7c2352425d549b681b2838bda5ee218 (diff)
*gui
Diffstat (limited to 'Runtime/Lua')
-rw-r--r--Runtime/Lua/LuaHelper.cpp28
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;