aboutsummaryrefslogtreecommitdiff
path: root/termkit.c
diff options
context:
space:
mode:
Diffstat (limited to 'termkit.c')
-rw-r--r--termkit.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/termkit.c b/termkit.c
new file mode 100644
index 0000000..9775f7d
--- /dev/null
+++ b/termkit.c
@@ -0,0 +1,72 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <termbox.h>
+#include "termkit.h"
+
+#define OK 0
+#define ER 1
+#define USR_ERR 2
+
+int tk_sty_init(tk_style_t **sty, uint16_t fg, uint16_t bg)
+{
+ (*sty) = calloc(sizeof(tk_style_t), 1);
+ CHECK(*sty, ERR)
+
+ err_t e;
+ e = bowl_malloc(&(*sty)->styles, HASH);
+ if(e) goto fail;
+
+ e = bowl_malloc(&(*sty)->decorators, HASH);
+ if(e) goto fail;
+
+ return OK;
+
+fail:
+ free((*sty)->styles);
+ free((*sty)->decorators);
+ free(*sty);
+ return ERR;
+}
+
+int tk_sty_add_col(tk_style_t *sty, char *name, uint16_t fg, uint16_t bg)
+{
+ CHECK(sty, USR_ERR)
+
+
+
+ return OK;
+}
+
+// int init()
+// {
+// return tb_init();
+// }
+
+// void draw(char *str, int rootX, int rootY, uint16_t fg, uint16_t bg)
+// {
+// size_t len = strlen(str);
+// int x = rootX;
+
+// for(int i = 0; i < len; i++) {
+// tb_change_cell(x, rootY, str[i], fg, bg);
+// x += 1;
+// }
+// }
+
+// void draw_xy(char *str, int rootX, int rootY,
+// int8_t h, int8_t v,
+// uint16_t fg, uint16_t bg)
+// {
+// size_t len = strlen(str);
+// int x = rootX;
+// int y = rootY;
+
+// for(int i = 0; i < len; i++) {
+// tb_change_cell(x, y, str[i], fg, bg);
+// x += h; y += v;
+// }
+// }
+