diff options
author | sanine <sanine.not@pm.me> | 2023-03-10 02:05:18 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-03-10 02:05:18 -0600 |
commit | 51c7235d4e0a2df109dd5050328a0ad4a1878ae4 (patch) | |
tree | 201b065e93bf6a35d2bab0e49bcd32f7a971da94 /src/glfw/init.c | |
parent | 5bb783912ac384156b8abbe6e83a5a61da73881d (diff) |
refactor: move glfw functions into separate table
Diffstat (limited to 'src/glfw/init.c')
-rw-r--r-- | src/glfw/init.c | 58 |
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; +} |