From 07a2e5c5cccbd305cd912f58f1e645c7fabf2a4d Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 13 Apr 2011 21:32:02 -0300 Subject: [PATCH] atrf-path/gui.c: indicate status not only with color but also with shape - gui.c (disc, indicate): moved drawing of disc to separate function - gui.c (triangle, up, down): draw an up/down triangle - gui.c (indicate): use up/down triangle for over/under --- tools/atrf-path/gui.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/tools/atrf-path/gui.c b/tools/atrf-path/gui.c index 62fd8da..b64e192 100644 --- a/tools/atrf-path/gui.c +++ b/tools/atrf-path/gui.c @@ -107,6 +107,32 @@ static void draw_limit(SDL_Surface *s, const double *v) } +static void disc(SDL_Surface *s, uint32_t color) +{ + filledCircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color); + aacircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color); +} + + +static void triangle(SDL_Surface *s, int cx, int cy, int r, uint32_t color) +{ + filledTrigonColor(s, cx, cy-r, cx+r*1.2, cy+r, cx-r*1.2, cy+r, color); +// aatrigonColor(s, cx, cy-r, cx+r*1.2, cy+r, cx-r*1.2, cy+r, color); +} + + +static void up(SDL_Surface *s, uint32_t color) +{ + triangle(s, STATUS_X, STATUS_Y, STATUS_R, color); +} + + +static void down(SDL_Surface *s, uint32_t color) +{ + triangle(s, STATUS_X, STATUS_Y, -STATUS_R, color); +} + + static void indicate(SDL_Surface *s, int fail) { static uint32_t last = 0; @@ -128,9 +154,19 @@ static void indicate(SDL_Surface *s, int fail) if (color == last) color = 0; last = color; - - filledCircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color); - aacircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color); + switch (color) { + case OK_RGBA: + disc(s, color); + break; + case OVER_RGBA: + up(s, color); + break; + case UNDER_RGBA: + down(s, color); + break; + default: + break; + } }