Encapsulate GLFW windows

This commit is contained in:
Dane Johnson
2021-03-08 13:50:50 -06:00
parent 19e5e1b959
commit 45d564bccf
9 changed files with 127 additions and 56 deletions

View File

@@ -83,7 +83,7 @@ bool Lua::HasHook(const char *name) {
#ifdef LUA_SCRIPTING
void Lua::LuaKeyHandler(Window *window, int key, int code, int action, int mods) {
void Lua::LuaKeyHandler(int key, int code, int action, int mods) {
lua_getglobal(L, "onkey");
lua_pushinteger(L, key);
lua_pushinteger(L, code);
@@ -92,8 +92,7 @@ void Lua::LuaKeyHandler(Window *window, int key, int code, int action, int mods)
lua_call(L, 4, 0);
}
void Lua::LuaMousePositionHandler(Window *window, double xpos, double ypos, double relx, double rely) {
// lua_State *L = (lua_State*) glfwGetWindowUserPointer(window);
void Lua::LuaMousePositionHandler(double xpos, double ypos, double relx, double rely) {
lua_getglobal(L, "onmousemotion");
lua_pushnumber(L, xpos);
lua_pushnumber(L, ypos);

View File

@@ -25,8 +25,8 @@ public:
private:
#ifdef LUA_SCRIPTING
static lua_State *L;
static void LuaKeyHandler(Window *window, int key, int code, int action, int mods);
static void LuaMousePositionHandler(Window *window, double xpos, double ypos, double xrel, double yrel);
static void LuaKeyHandler(int key, int code, int action, int mods);
static void LuaMousePositionHandler(double xpos, double ypos, double xrel, double yrel);
static int LuaExceptionHandler(lua_State *L1);
#endif // LUA_SCRIPTING
};