commit b970f626691df1b9318c94f968cf9d6941fa138a
parent 28c4142464f9323ba3f24cd24b3ea1ec684b098c
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Tue, 6 Dec 2022 13:48:23 -0600
add lqmath so we can deal with rational times instead of fp
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,5 +1,5 @@
-smallpond: main.c
- gcc -o smallpond main.c $(shell pkg-config --cflags --libs lua) $(shell pkg-config --cflags --libs freetype2) $(shell pkg-config --cflags --libs cairo) $(shell pkg-config --cflags --libs libavcodec) $(shell pkg-config --cflags --libs libavutil) $(shell pkg-config --cflags --libs libavformat)
+smallpond: main.c lqmath-104/lqmath.c
+ gcc -o smallpond main.c lqmath-104/lqmath.o lqmath-104/src/imath.o lqmath-104/src/imrat.o $(shell pkg-config --cflags --libs lua) $(shell pkg-config --cflags --libs freetype2) $(shell pkg-config --cflags --libs cairo) $(shell pkg-config --cflags --libs libavcodec) $(shell pkg-config --cflags --libs libavutil) $(shell pkg-config --cflags --libs libavformat)
clean:
diff --git a/main.c b/main.c
@@ -20,6 +20,8 @@
#define WIDTH 854
#define HEIGHT 480
+int luaopen_qmath(lua_State *L);
+
cairo_t *cr;
FT_Face face;
cairo_font_face_t *cface;
@@ -166,6 +168,13 @@ main(int argc, char *argv[])
{
lua_State *L = luaL_newstate();
luaL_openlibs(L);
+
+ // load lqmath
+ lua_newtable(L);
+ luaopen_qmath(L);
+ lua_setglobal(L, "Q");
+
+ // load drawing primitives
lua_pushcfunction(L, draw_glyph);
lua_setglobal(L, "draw_glyph");
lua_pushcfunction(L, draw_circle);