From 6be18a6b6af53c4f43d88011672a1fde44b0c92a Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Sat, 13 Jun 2020 20:58:36 +0800 Subject: [PATCH] LuaEngine v0.4.1 Add drop event support --- Event.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Event.cpp b/Event.cpp index 78ae8c8..9cfe3b2 100644 --- a/Event.cpp +++ b/Event.cpp @@ -432,6 +432,38 @@ int unpack_event(lua_State* L, const SDL_Event& e) lua_pushinteger(L, e.tfinger.timestamp); return 9; } + case SDL_DROPTEXT: + { + lua_pushstring(L, "droptext"); + if (e.drop.file) + { + lua_pushstring(L, e.drop.file); + SDL_free(e.drop.file); + return 2; + } + return 1; + } + case SDL_DROPFILE: + { + lua_pushstring(L, "dropfile"); + if (e.drop.file) + { + lua_pushstring(L, e.drop.file); + SDL_free(e.drop.file); + return 2; + } + return 1; + } + case SDL_DROPBEGIN: + { + lua_pushstring(L, "dropbegin"); + return 1; + } + case SDL_DROPCOMPLETE: + { + lua_pushstring(L, "dropend"); + return 1; + } case SDL_WINDOWEVENT: { switch (e.window.event)