diff options
Diffstat (limited to 'src/nvg/context.c')
| -rw-r--r-- | src/nvg/context.c | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/src/nvg/context.c b/src/nvg/context.c new file mode 100644 index 0000000..48a7282 --- /dev/null +++ b/src/nvg/context.c @@ -0,0 +1,23 @@ +#include <lua.h> +#include <lauxlib.h> +#include <nanovg.h> +#include <nanovg_gl.h> +#include "nvg.h" + + +int nvgCreateContext_bind(lua_State *L) +{ +	struct NVGcontext **vg = lua_newuserdata(L, sizeof(struct NVGcontext *)); +	*vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); +	luaL_getmetatable(L, nvg_ctx_tname); +	lua_setmetatable(L, -2); +	return 1; +} + + +int nvgDeleteContext_bind(lua_State *L) +{ +	struct NVGcontext **vg = luaL_checkudata(L, 1, nvg_ctx_tname); +	nvgDeleteGL3(*vg); +	return 0; +} | 
