summaryrefslogtreecommitdiff
path: root/src/nvg/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvg/setup.c')
-rw-r--r--src/nvg/setup.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nvg/setup.c b/src/nvg/setup.c
new file mode 100644
index 0000000..16766c0
--- /dev/null
+++ b/src/nvg/setup.c
@@ -0,0 +1,30 @@
+#include <lua.h>
+#include <lauxlib.h>
+#include "gl/glad/glad.h"
+#include <GLFW/glfw3.h>
+#define NANOVG_GL3_IMPLEMENTATION
+#include <nanovg.h>
+#include <nanovg_gl.h>
+#include "util/util.h"
+#include "nvg.h"
+
+
+const char *nvg_ctx_tname = "nvg.Context";
+const char *nvg_color_tname = "nvg.Color";
+
+
+void setup_nvg(lua_State *L, int honey_tbl)
+{
+ luaL_newmetatable(L, nvg_ctx_tname); lua_pop(L, 1);
+ luaL_newmetatable(L, nvg_color_tname); lua_pop(L, 1);
+
+ struct honey_tbl_t nvg[] = {
+ #define X(name, func) H_FUNC(name, func),
+ NVG_FUNCTIONS
+ #undef X
+ H_END,
+ };
+ create_table(L, nvg);
+
+ lua_setfield(L, honey_tbl, "nvg");
+}