summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/Events/Events.bind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Scripting/Events/Events.bind.cpp')
-rw-r--r--Runtime/Scripting/Events/Events.bind.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/Runtime/Scripting/Events/Events.bind.cpp b/Runtime/Scripting/Events/Events.bind.cpp
new file mode 100644
index 0000000..40ea544
--- /dev/null
+++ b/Runtime/Scripting/Events/Events.bind.cpp
@@ -0,0 +1,65 @@
+#include "Runtime/Events/InputEvent.h"
+#include "Runtime/Lua/LuaHelper.h"
+#include "Runtime/Debug/Log.h"
+
+// Events.CopyEvent(e)
+int CopyEvent(lua_State* L)
+{
+ LUA_BIND_STATE(L);
+
+ InputEvent e;
+ e.RestoreFromTable(state, -1);
+ state.PushTable(e);
+
+ return 1;
+}
+
+static luaL_Reg funcs[] = {
+ {"CopyEvent", CopyEvent},
+ {0, 0}
+};
+
+int luaopen_GameLab_Events(lua_State* L)
+{
+ log_info_tag("Scripting", "luaopen_GameLab_Events()");
+
+ LUA_BIND_STATE(L);
+ state.PushGlobalNamespace();
+ state.PushNamespace("GameLab");
+ state.PushNamespace("Events");
+
+ state.RegisterMethods(funcs);
+
+ LUA_BIND_REGISTER_ENUM(state, "EEventType",
+ { "MouseDown", InputEvent_MouseDown },
+ { "MouseUp", InputEvent_MouseUp },
+ { "MouseMove", InputEvent_MouseMove },
+ { "MouseDrag", InputEvent_MouseDrag },
+ { "KeyDown", InputEvent_KeyDown },
+ { "KeyUp", InputEvent_KeyUp },
+ { "ScrollWheel", InputEvent_ScrollWheel },
+ { "Repaint", InputEvent_Repaint },
+ { "Layout", InputEvent_Layout },
+ { "DragUpdated", InputEvent_DragUpdated },
+ { "DragPerform", InputEvent_DragPerform },
+ { "DragExited", InputEvent_DragExited },
+ { "Ignore", InputEvent_Ignore },
+ { "Used", InputEvent_Used },
+ { "ValidateCommand", InputEvent_ValidateCommand },
+ { "ExecuteCommand", InputEvent_ExecuteCommand },
+ { "ContextClick", InputEvent_ContextClick },
+ { "MouseEnterWindow", InputEvent_MouseEnterWindow },
+ { "MouseLeaveWindow", InputEvent_MouseLeaveWindow },
+ { "MagnifyGesture", InputEvent_MagnifyGesture },
+ { "SwipeGesture", InputEvent_SwipeGesture },
+ { "RotateGesture", InputEvent_RotateGesture }
+ );
+
+ LUA_BIND_REGISTER_ENUM(state, "EMouseButton",
+ { "LeftButton", Mouse_LeftButton },
+ { "RightButton", Mouse_RightButton },
+ { "MiddleButton", Mouse_MiddleButton }
+ );
+
+ return 1;
+} \ No newline at end of file