nuclear@7: #include "imtk.h" nuclear@7: #include "draw.h" nuclear@7: nuclear@7: #define SLIDER_SIZE 100 nuclear@7: nuclear@7: static void draw_progress(int id, float pos, int x, int y); nuclear@7: nuclear@7: void imtk_progress(int id, float pos, int x, int y) nuclear@7: { nuclear@7: draw_progress(id, pos, x, y); nuclear@7: } nuclear@7: nuclear@7: static void draw_progress(int id, float pos, int x, int y) nuclear@7: { nuclear@7: int bar_size = SLIDER_SIZE * pos; nuclear@7: nuclear@7: if(pos < 0.0) pos = 0.0; nuclear@7: if(pos > 1.0) pos = 1.0; nuclear@7: nuclear@7: /* through */ nuclear@7: glBegin(GL_QUADS); nuclear@7: glColor4fv(imtk_get_color(IMTK_BASE_COLOR)); nuclear@7: glVertex2f(x - 1, y - 1); nuclear@7: glVertex2f(x + SLIDER_SIZE + 1, y - 1); nuclear@7: glVertex2f(x + SLIDER_SIZE + 1, y + 17); nuclear@7: glVertex2f(x - 1, y + 17); nuclear@7: glEnd(); nuclear@7: imtk_draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET); nuclear@7: nuclear@7: if(pos > 0.0) { nuclear@7: /* bar */ nuclear@7: glBegin(GL_QUADS); nuclear@7: glColor4fv(imtk_get_color(IMTK_BASE_COLOR)); nuclear@7: glVertex2f(x, y); nuclear@7: glVertex2f(x + bar_size, y); nuclear@7: glVertex2f(x + bar_size, y + 15); nuclear@7: glVertex2f(x, y + 15); nuclear@7: glEnd(); nuclear@7: imtk_draw_frame(x, y, bar_size, 15, FRAME_OUTSET); nuclear@7: } nuclear@7: }