summaryrefslogtreecommitdiff
path: root/src/glfw/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glfw/init.c')
-rw-r--r--src/glfw/init.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/glfw/init.c b/src/glfw/init.c
new file mode 100644
index 0000000..6d91d28
--- /dev/null
+++ b/src/glfw/init.c
@@ -0,0 +1,58 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include <glad/glad.h>
+#include <GLFW/glfw3.h>
+#include "setup.h"
+
+
+int glfwInit_bind(lua_State *L)
+{
+ int bind_result = glfwInit();
+ lua_pushinteger(L, bind_result);
+ return 1;
+}
+
+
+int glfwTerminate_bind(lua_State *L)
+{
+ glfwTerminate();
+ return 0;
+}
+
+
+int glfwInitHint_bind(lua_State *L)
+{
+ int hint = luaL_checkinteger(L, 1);
+ int value = luaL_checkinteger(L, 2);
+ glfwInitHint(hint, value);
+ return 0;
+}
+
+
+int glfwGetVersion_bind(lua_State *L)
+{
+ int major, minor, rev;
+ glfwGetVersion(&major, &minor, &rev);
+ lua_pushinteger(L, major);
+ lua_pushinteger(L, minor);
+ lua_pushinteger(L, rev);
+ return 3;
+}
+
+
+int glfwGetVersionString_bind(lua_State *L)
+{
+ const char * bind_result = glfwGetVersionString();
+ lua_pushstring(L, bind_result);
+ return 1;
+}
+
+
+int glfwGetError_bind(lua_State *L)
+{
+ const char * description;
+ int bind_result = glfwGetError(&description);
+ lua_pushinteger(L, bind_result);
+ lua_pushstring(L, description);
+ return 2;
+}