From c2329b4c8258baa9429c77566c9def97d00e96d7 Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 10 Mar 2023 02:33:42 -0600 Subject: demonstrate working glfw refactored bindings --- src/glfw/window.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/glfw/window.c') diff --git a/src/glfw/window.c b/src/glfw/window.c index 1aafeb4..0199fb0 100644 --- a/src/glfw/window.c +++ b/src/glfw/window.c @@ -19,11 +19,18 @@ GLFWwindow ** create_window(lua_State *L) luaL_getmetatable(L, glfw_window_tname); lua_setmetatable(L, -2); - /* configure window data struct */ d->data.L = L; lua_pushvalue(L, self); d->data.self_ref = luaL_ref(L, LUA_REGISTRYINDEX); + return window; +} + +static void configure_window(GLFWwindow **window) +{ + struct window_data_t *d = (struct window_data_t *) window; + + /* configure window data struct */ d->data.key_cb_ref = LUA_NOREF; d->data.char_cb_ref = LUA_NOREF; d->data.char_mods_cb_ref = LUA_NOREF; @@ -43,8 +50,6 @@ GLFWwindow ** create_window(lua_State *L) d->data.content_scale_cb_ref = LUA_NOREF; glfwSetWindowUserPointer(*window, &(d->data)); - - return window; } @@ -83,6 +88,7 @@ int glfwCreateWindow_bind(lua_State *L) GLFWwindow ** window = create_window(L); *window = glfwCreateWindow(width, height, title, *monitor, *share); + configure_window(window); return 1; } -- cgit v1.2.1