summaryrefslogtreecommitdiff
path: root/Runtime/Math
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Math')
-rw-r--r--Runtime/Math/ITransData.h7
-rw-r--r--Runtime/Math/Vector2.h12
2 files changed, 16 insertions, 3 deletions
diff --git a/Runtime/Math/ITransData.h b/Runtime/Math/ITransData.h
new file mode 100644
index 0000000..bda81e5
--- /dev/null
+++ b/Runtime/Math/ITransData.h
@@ -0,0 +1,7 @@
+//#pragma once
+//
+//class ITransData
+//{
+//public:
+// virtual int GetDataSize() = 0;
+//};
diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h
index f83a521..5dd8fe6 100644
--- a/Runtime/Math/Vector2.h
+++ b/Runtime/Math/Vector2.h
@@ -2,11 +2,12 @@
#include "MathHelper.h"
#include "Runtime/Utilities/Assert.h"
#include "Runtime/Lua/LuaHelper.h"
+#include "ITransData.h"
namespace Internal
{
template<typename T>
- struct Vector2T : public LuaBind::ILuaClass
+ struct Vector2T
{
Vector2T(T x = 0, T y = 0)
{
@@ -50,7 +51,7 @@ namespace Internal
return res;
}
- void CastToLuaObject(LuaBind::State& state) const override
+ void CastToLuaObject(LuaBind::State& state) const
{
int top = state.GetTop();
if (LuaHelper::GetLuaClass(state, "GameLab.Engine.Math.Vector2"))
@@ -68,7 +69,7 @@ namespace Internal
}
}
- void RestoreFromLuaObject(LuaBind::State& state, int index) override
+ void RestoreFromLuaObject(LuaBind::State& state, int index)
{
if (lua_isnil(state, index))
return;
@@ -84,6 +85,11 @@ namespace Internal
y = state.GetField<float>(index, 1, 0);
}
}
+
+ static int GetDataSize()
+ {
+ return 2 * sizeof(T);
+ }
T x, y;