Date:2011-04-14 02:32:02 (8 years 4 months ago)
Author:Werner Almesberger
Commit:07a2e5c5cccbd305cd912f58f1e645c7fabf2a4d
Message: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
Files: tools/atrf-path/gui.c (2 diffs)

Change Details

tools/atrf-path/gui.c
107107}
108108
109109
110static void disc(SDL_Surface *s, uint32_t color)
111{
112    filledCircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color);
113    aacircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color);
114}
115
116
117static void triangle(SDL_Surface *s, int cx, int cy, int r, uint32_t color)
118{
119    filledTrigonColor(s, cx, cy-r, cx+r*1.2, cy+r, cx-r*1.2, cy+r, color);
120// aatrigonColor(s, cx, cy-r, cx+r*1.2, cy+r, cx-r*1.2, cy+r, color);
121}
122
123
124static void up(SDL_Surface *s, uint32_t color)
125{
126    triangle(s, STATUS_X, STATUS_Y, STATUS_R, color);
127}
128
129
130static void down(SDL_Surface *s, uint32_t color)
131{
132    triangle(s, STATUS_X, STATUS_Y, -STATUS_R, color);
133}
134
135
110136static void indicate(SDL_Surface *s, int fail)
111137{
112138    static uint32_t last = 0;
...... 
128154    if (color == last)
129155        color = 0;
130156    last = color;
131
132    filledCircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color);
133    aacircleColor(s, STATUS_X, STATUS_Y, STATUS_R, color);
157    switch (color) {
158    case OK_RGBA:
159        disc(s, color);
160        break;
161    case OVER_RGBA:
162        up(s, color);
163        break;
164    case UNDER_RGBA:
165        down(s, color);
166        break;
167    default:
168        break;
169    }
134170}
135171
136172

Archive Download the corresponding diff file



interactive