summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-23 13:38:27 -0500
committersanine <sanine.not@pm.me>2022-08-23 13:38:27 -0500
commit3afbf2a13b2dada445fb667bf25600407fea480a (patch)
tree551329e6f74fc9f177616de0d6739e8b5331ae96 /src/main.c
parent261e3f991221fbad6bbf262f5e65b773e4b6c73e (diff)
parent25ed7eb9f84e9a822f698ad803901fbb2a5354cf (diff)
:wMerge branch 'gl-window' into main
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index e69de29..5f5d399 100644
--- a/src/main.c
+++ b/src/main.c
@@ -0,0 +1,36 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
+#include <honeysuckle.h>
+#include "gl/gl.h"
+#include "image/image.h"
+#include "glm/glm.h"
+
+
+int main(int argc, char **argv)
+{
+ lua_State *L = luaL_newstate();
+ luaL_openlibs(L);
+
+ lua_createtable(L, 0, 2);
+ int honey_index = lua_gettop(L);
+ setup_gl(L, honey_index);
+ setup_window(L, honey_index);
+ setup_image(L, honey_index);
+ setup_glm(L, honey_index);
+ lua_setglobal(L, "honey");
+
+ int err = luaL_loadfile(L, "honey.lua");
+ if (err != 0) {
+ printf("cannot open file!\n");
+ lua_close(L);
+ return 0;
+ }
+ err = hs_call(L, 0, 0);
+ if (err != 0) {
+ const char *err_str = lua_tostring(L, -1);
+ printf("failed to run: \n%s\n", err_str);
+ }
+ lua_close(L);
+ return 0;
+}