summaryrefslogtreecommitdiff
path: root/src/glfw/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glfw/context.c')
-rw-r--r--src/glfw/context.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/glfw/context.c b/src/glfw/context.c
new file mode 100644
index 0000000..e22533e
--- /dev/null
+++ b/src/glfw/context.c
@@ -0,0 +1,49 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include <GLFW/glfw3.h>
+#include "setup.h"
+
+
+int glfwMakeContextCurrent_bind(lua_State *L)
+{
+ GLFWwindow ** window = luaL_checkudata(L, 1, glfw_window_tname);
+ glfwMakeContextCurrent(*window);
+ return 0;
+}
+
+
+int glfwGetCurrentContext_bind(lua_State *L)
+{
+ GLFWwindow * bind_result = glfwGetCurrentContext();
+ struct h_glfw_window_data_t *data = glfwGetWindowUserPointer(bind_result);
+ lua_rawgeti(L, LUA_REGISTRYINDEX, data->self_ref);
+ return 1;
+}
+
+
+int glfwSwapInterval_bind(lua_State *L)
+{
+ int interval = luaL_checkinteger(L, 1);
+ glfwSwapInterval(interval);
+ return 0;
+}
+
+
+int glfwExtensionSupported_bind(lua_State *L)
+{
+ const char * extension = luaL_checkstring(L, 1);
+ int bind_result = glfwExtensionSupported(extension);
+ lua_pushinteger(L, bind_result);
+ return 1;
+}
+
+
+int glfwGetProcAddress_bind(lua_State *L)
+{
+ const char * procname = luaL_checkstring(L, 1);
+ GLFWglproc bind_result = glfwGetProcAddress(procname);
+ lua_pushlightuserdata(L, bind_result);
+ return 1;
+}
+
+