axui-growth-chamber/test/main.c

55 lines
1.0 KiB
C

#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include "../src/ax.h"
#include "../src/ctxt.h"
#include "../src/backend.h"
struct ax_ctxt* ax = NULL;
static void cleanup()
{
ax_free(ax);
ax = NULL;
}
static void sigint_handler(int signum)
{
printf("\nCaught interrupt.\n");
cleanup();
exit(0);
}
int main(void)
{
signal(SIGINT, sigint_handler);
ax = ax_new();
ax_set_logger(ax, 0, false);
int rv = 0;
#define GUARD(f, ...) if ((rv = f(__VA_ARGS__)) != 0) goto cleanup
ax_begin_theme(ax);
ax_set_theme_color(ax, "primary", 0x00ff00);
ax_set_theme_font(ax, "default", "/usr/share/fonts/TTF/DejaVuSans.ttf", 0);
ax_set_theme_font(ax, "h1", NULL, 95);
struct ax_theme* thm;
ax_end_theme(ax, &thm);
ax_log(ax, "Got here\n");
while (!ax__backend_is_shutdown(ax->bac)) {
ax__backend_wait_for_event(ax->bac);
ax__backend_step(ax->bac);
}
//cleanup:
if (rv != 0) {
printf("error: %s\n", ax_get_error(ax));
}
cleanup();
return rv;
}