54 lines
993 B
C
54 lines
993 B
C
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.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);
|
|
}
|
|
|
|
static struct ax_theme* make_example_theme()
|
|
{
|
|
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);
|
|
return thm;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
signal(SIGINT, sigint_handler);
|
|
|
|
ax = ax_new();
|
|
ax_set_logger(ax, 0, false);
|
|
|
|
(void) make_example_theme();
|
|
|
|
for (;;) {
|
|
ax_wait_evt_avail(ax);
|
|
while (ax_poll_evt(ax, NULL)) {
|
|
printf("Got an event, assuredly.\n");
|
|
}
|
|
}
|
|
|
|
cleanup();
|
|
return 0;
|
|
}
|