imtk
view src/progress.c @ 7:6d35e6c7b2ca
reorganization finished
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 14 Apr 2011 23:04:07 +0300 |
parents | |
children | 10604ff95527 |
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 glBegin(GL_QUADS);
22 glColor4fv(imtk_get_color(IMTK_BASE_COLOR));
23 glVertex2f(x - 1, y - 1);
24 glVertex2f(x + SLIDER_SIZE + 1, y - 1);
25 glVertex2f(x + SLIDER_SIZE + 1, y + 17);
26 glVertex2f(x - 1, y + 17);
27 glEnd();
28 imtk_draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET);
30 if(pos > 0.0) {
31 /* bar */
32 glBegin(GL_QUADS);
33 glColor4fv(imtk_get_color(IMTK_BASE_COLOR));
34 glVertex2f(x, y);
35 glVertex2f(x + bar_size, y);
36 glVertex2f(x + bar_size, y + 15);
37 glVertex2f(x, y + 15);
38 glEnd();
39 imtk_draw_frame(x, y, bar_size, 15, FRAME_OUTSET);
40 }
41 }