1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include "Runtime/Events/InputEvent.h"
#include "Runtime/Lua/LuaHelper.h"
#include "Runtime/Debug/Log.h"
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;
}
|