pcadmin/src/main.c

60 lines
1018 B
C
Raw Permalink Normal View History

2021-04-16 11:08:47 +02:00
#include "bar.h"
2021-05-24 23:04:03 +02:00
#include "choice.h"
2021-04-16 11:08:47 +02:00
#include <gint/display.h>
#include <gint/keyboard.h>
2021-05-27 11:13:18 +02:00
#include <gint/usb-ff-bulk.h>
2021-04-16 11:08:47 +02:00
2021-05-24 12:11:04 +02:00
static struct Bar bars[BAR_TOTAL];
2021-05-24 23:04:03 +02:00
static struct Choice choice;
2021-05-24 11:19:21 +02:00
static void main_draw(void);
extern color_t *vcol_bar3;
2021-04-16 11:08:47 +02:00
int
main(void)
{
2021-05-24 11:07:56 +02:00
int i;
2021-05-27 11:13:18 +02:00
key_event_t key_ev;
2021-05-27 22:35:13 +02:00
usb_interface_t const *interfaces[] = {&usb_ff_bulk, NULL};
2021-05-24 11:07:56 +02:00
2021-05-24 11:19:21 +02:00
/* init */
2021-05-27 11:13:18 +02:00
usb_open(interfaces, GINT_CALL_NULL);
2021-05-24 12:11:04 +02:00
for (i = 0; i < BAR_TOTAL; i += 1)
2021-05-24 11:07:56 +02:00
bars[i] = bar_init(i);
2021-05-24 23:04:03 +02:00
choice = choice_init();
2021-04-16 11:08:47 +02:00
2021-05-24 12:11:04 +02:00
bar_change(&bars[BAR_CASH], 0.2);
bar_change(&bars[BAR_SMILE], -0.6);
bar_change(&bars[BAR_SUN], 69.42);
2021-05-24 12:11:04 +02:00
2021-05-24 11:19:21 +02:00
main_draw();
2021-05-27 11:13:18 +02:00
key_ev = getkey();
if (key_ev.key == KEY_OPTN && usb_is_open())
usb_fxlink_screenshot(1);
2021-05-24 11:19:21 +02:00
/* deinit */
2021-05-27 11:13:18 +02:00
usb_close();
2021-05-24 11:19:21 +02:00
return 1;
}
static void
main_draw(void)
{
extern bopti_image_t bimg_background;
int i;
/* draw background */
2021-05-27 22:35:13 +02:00
dimage(-2, 0, &bimg_background);
2021-05-24 11:19:21 +02:00
/* draw bars */
2021-05-27 22:35:13 +02:00
for (i = 0; i < BAR_TOTAL; i += 1)
2021-05-24 11:07:56 +02:00
bar_draw(bars[i]);
2021-04-16 11:08:47 +02:00
2021-05-24 23:04:03 +02:00
/* draw choice */
choice_draw(choice);
2021-05-24 11:19:21 +02:00
dupdate();
2021-04-16 11:08:47 +02:00
}