summaryrefslogtreecommitdiff
path: root/src/glfw/window.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-10 02:33:42 -0600
committersanine <sanine.not@pm.me>2023-03-10 02:33:42 -0600
commitc2329b4c8258baa9429c77566c9def97d00e96d7 (patch)
tree029da1a4a2c5ac7bd7714ee70f195378f5c68c8e /src/glfw/window.c
parent51c7235d4e0a2df109dd5050328a0ad4a1878ae4 (diff)
demonstrate working glfw refactored bindings
Diffstat (limited to 'src/glfw/window.c')
-rw-r--r--src/glfw/window.c12
1 files changed, 9 insertions, 3 deletions
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;
}