imtk
view src/progress.c @ 9:1b27a69603ac
fixed missing -lGLU from makefile
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sat, 16 Apr 2011 22:59:23 +0300 |
parents | 6d35e6c7b2ca |
children | 9c7987064bb0 |
line source
1 #include "imtk.h"
2 #include "draw.h"
4 #define SLIDER_SIZE 100
6 static void draw_progress(int id, float pos, int x, int y);
8 void imtk_progress(int id, float pos, int x, int y)
9 {
10 draw_progress(id, pos, x, y);
11 }
13 static void draw_progress(int id, float pos, int x, int y)
14 {
15 int bar_size = SLIDER_SIZE * pos;
17 if(pos < 0.0) pos = 0.0;
18 if(pos > 1.0) pos = 1.0;
20 /* through */
21 imtk_draw_rect(x - 1, y - 1, SLIDER_SIZE + 1, 18, imtk_get_color(IMTK_BASE_COLOR));
22 imtk_draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET);
24 if(pos > 0.0) {
25 /* bar */
26 imtk_draw_rect(x, y, bar_size, 15, imtk_get_color(IMTK_BASE_COLOR));
27 imtk_draw_frame(x, y, bar_size, 15, FRAME_OUTSET);
28 }
29 }