1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 19:20:41 +02:00

tools/atrf-path/gui.c (gui): added pulsating disc as progress/status indicator

This commit is contained in:
Werner Almesberger 2011-04-13 09:13:46 -03:00
parent 4244af265c
commit cee0296579

View File

@ -33,6 +33,7 @@
#define FG_RGBA 0xffffffff /* measurement color */ #define FG_RGBA 0xffffffff /* measurement color */
#define OK_RGBA 0x00ff00ff
#define CHAN_STEP 20 /* 4 pixels/MHz */ #define CHAN_STEP 20 /* 4 pixels/MHz */
#define SIDE_STEP 2 #define SIDE_STEP 2
@ -40,6 +41,10 @@
#define Y_MIN -94 #define Y_MIN -94
#define Y_MAX -10 #define Y_MAX -10
#define STATUS_X (XRES-15)
#define STATUS_Y 15
#define STATUS_R 8
static void segment(SDL_Surface *s, int *last_x, int *last_y, int x, static void segment(SDL_Surface *s, int *last_x, int *last_y, int x,
const struct sample *res, int have_last) const struct sample *res, int have_last)
@ -108,6 +113,7 @@ void gui(const struct sweep *sweep)
{ {
SDL_Surface *surf; SDL_Surface *surf;
SDL_Event event; SDL_Event event;
int cycle = 0;
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "SDL_init: %s\n", SDL_GetError()); fprintf(stderr, "SDL_init: %s\n", SDL_GetError());
@ -135,6 +141,13 @@ void gui(const struct sweep *sweep)
SDL_LockSurface(surf); SDL_LockSurface(surf);
clear(surf); clear(surf);
if (cycle++ & 1) {
filledCircleColor(surf, STATUS_X, STATUS_Y, STATUS_R,
OK_RGBA);
aacircleColor(surf, STATUS_X, STATUS_Y, STATUS_R,
OK_RGBA);
}
draw(surf, res); draw(surf, res);
SDL_UnlockSurface(surf); SDL_UnlockSurface(surf);