34 lines
775 B
C
34 lines
775 B
C
#include "choice.h"
|
|
#include <gint/display.h>
|
|
|
|
static char *yes = CHOICE_YES;
|
|
static char *no = CHOICE_NO;
|
|
/* static char *ok = CHOICE_OK; */
|
|
|
|
static void button_draw(int id, int highlight);
|
|
|
|
void
|
|
choice_draw(struct Choice choice)
|
|
{
|
|
int i;
|
|
|
|
i = 2;
|
|
while (i-- > 0)
|
|
button_draw(i, choice.cursor == i);
|
|
}
|
|
|
|
static void
|
|
button_draw(int id, int highlight)
|
|
{
|
|
const int x = id ? (DWIDTH / 2 - BUTTON_WIDTH * 1.5)
|
|
: (DWIDTH / 2 + BUTTON_WIDTH * 0.5);
|
|
const int y = BUTTON_Y;
|
|
const int text_x = x + BUTTON_WIDTH / 2;
|
|
const int text_y = y + BUTTON_HEIGHT / 2;
|
|
const color_t color = highlight ? C_LIGHT : C_DARK;
|
|
|
|
drect(x, y, x + BUTTON_WIDTH, y + BUTTON_HEIGHT, color);
|
|
dtext_opt(text_x, text_y, C_WHITE, C_NONE, DTEXT_CENTER, DTEXT_MIDDLE,
|
|
id ? no : yes);
|
|
}
|