ncurses-gameoflife/ui.c

31 lines
448 B
C
Raw Normal View History

2020-07-09 08:26:08 +08:00
#include <stddef.h>
#include <stdlib.h>
2020-07-08 07:30:37 +08:00
#include "ui.h"
2020-07-09 08:26:08 +08:00
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()
{
}