diff options
Diffstat (limited to 'src/gl/gl.c')
-rw-r--r-- | src/gl/gl.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gl/gl.c b/src/gl/gl.c new file mode 100644 index 0000000..8613e70 --- /dev/null +++ b/src/gl/gl.c @@ -0,0 +1,34 @@ +#include "gl/glad/glad.h" +#include <GLFW/glfw3.h> +#include <lua.h> +#include <honeysuckle.h> + + +int gl_init(lua_State *L); +int gl_terminate(lua_State *L); + + +void setup_gl(lua_State *L, int honey_index) +{ + hs_create_table(L, + hs_str_cfunc("init", gl_init), + hs_str_cfunc("terminate", gl_terminate) + ); + lua_setfield(L, honey_index, "gl"); +} + + +int gl_init(lua_State *L) +{ + if (!glfwInit()) { + hs_throw_error(L, "failed to initialize GLFW"); + } + return 0; +} + + +int gl_terminate(lua_State *L) +{ + glfwTerminate(); + return 0; +} |