fire/main.c

47 lines
626 B
C
Raw Normal View History

2019-12-12 22:08:35 +00:00
#include <stdlib.h>
2019-12-12 23:46:24 +00:00
#include "bool.h"
2019-12-13 03:27:13 +00:00
#include "output.h"
#include "draw.h"
#include "types.h"
#include "termbox.h"
#include "args.h"
2019-12-13 02:18:56 +00:00
2019-12-13 03:27:13 +00:00
// argument parsing (args.h)
char *argv0;
struct Options *opts;
2019-12-12 22:08:35 +00:00
int
main ( void )
{
2019-12-12 23:46:24 +00:00
// initialize termbox
tb_init();
tb_select_output_mode(TB_OUTPUT_NORMAL);
tb_clear();
2019-12-13 03:27:13 +00:00
struct buffer buf;
2019-12-12 23:46:24 +00:00
2019-12-13 02:18:56 +00:00
// initialize drawing
init(&buf);
2019-12-12 22:08:35 +00:00
2019-12-13 02:18:56 +00:00
// animate
while (TRUE)
{
2019-12-13 03:27:13 +00:00
// clear the screen
2019-12-13 02:18:56 +00:00
tb_clear();
2019-12-13 03:27:13 +00:00
// update framebuffer
2019-12-13 02:18:56 +00:00
dofire(&buf);
2019-12-13 03:27:13 +00:00
// draw framebuffer to terminal
2019-12-13 02:18:56 +00:00
tb_present();
}
2019-12-12 23:46:24 +00:00
// cleanup termbox
tb_shutdown();
2019-12-13 03:27:13 +00:00
// cleanup framebuffer
2019-12-13 02:18:56 +00:00
free(buf.tmp_buf);
2019-12-12 23:46:24 +00:00
2019-12-12 22:08:35 +00:00
return 0;
}