pcadmin/src/main.c

60 lines
1018 B
C

#include "bar.h"
#include "choice.h"
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/usb-ff-bulk.h>
static struct Bar bars[BAR_TOTAL];
static struct Choice choice;
static void main_draw(void);
extern color_t *vcol_bar3;
int
main(void)
{
int i;
key_event_t key_ev;
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
/* init */
usb_open(interfaces, GINT_CALL_NULL);
for (i = 0; i < BAR_TOTAL; i += 1)
bars[i] = bar_init(i);
choice = choice_init();
bar_change(&bars[BAR_CASH], 0.2);
bar_change(&bars[BAR_SMILE], -0.6);
bar_change(&bars[BAR_SUN], 69.42);
main_draw();
key_ev = getkey();
if (key_ev.key == KEY_OPTN && usb_is_open())
usb_fxlink_screenshot(1);
/* deinit */
usb_close();
return 1;
}
static void
main_draw(void)
{
extern bopti_image_t bimg_background;
int i;
/* draw background */
dimage(-2, 0, &bimg_background);
/* draw bars */
for (i = 0; i < BAR_TOTAL; i += 1)
bar_draw(bars[i]);
/* draw choice */
choice_draw(choice);
dupdate();
}