From 41db31e1214ba1a227f023ce5b604681902cbd9d Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Thu, 9 Jul 2020 01:26:08 +0100 Subject: [PATCH] Started in ui. --- ui.c | 29 +++++++++++++++++++++++++++++ ui.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/ui.c b/ui.c index 3fab951..d39a0aa 100644 --- a/ui.c +++ b/ui.c @@ -1 +1,30 @@ +#include +#include #include "ui.h" + +typedef struct { + char* msg; + int* var; +}Linei; + +static unsigned int ln_count = 0; + +static Linei* lines = NULL; + +void initUI() +{ + lines = (Linei*)malloc(sizeof(Linei) * ++ln_count); +} + +void addLinei(char* msg, int* var) +{ + if (!lines) return; + if (ln_count >1) lines = realloc(lines, sizeof(Linei) * ++ln_count); + Linei line = { msg, var }; + lines[ln_count-1] = line; +} + +void drawUI() +{ +} + diff --git a/ui.h b/ui.h index 934cbf7..c6e75de 100644 --- a/ui.h +++ b/ui.h @@ -1,6 +1,10 @@ #ifndef UI_H #define UI_H +void initUI(); +void addLinei(char* msg, int* var); + +void drawUI(); #endif