From 275536b36657744d802866c060654e2b5cd5a5f8 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 18 Aug 2022 22:46:40 -0500 Subject: implement working windows --- src/gl/gl.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/gl/gl.c (limited to 'src/gl/gl.c') 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 +#include +#include + + +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; +} -- cgit v1.2.1