nuclear@14: #include nuclear@7: #include "imtk.h" nuclear@7: #include "draw.h" nuclear@7: nuclear@13: #define PROGR_SIZE 100 nuclear@13: #define PROGR_HEIGHT 15 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@13: int bar_size = PROGR_SIZE * pos; nuclear@13: float b = imtk_get_bevel_width(); nuclear@14: float tcol[4], bcol[4]; nuclear@7: nuclear@7: if(pos < 0.0) pos = 0.0; nuclear@7: if(pos > 1.0) pos = 1.0; nuclear@7: nuclear@14: memcpy(tcol, imtk_get_color(IMTK_BOTTOM_COLOR), sizeof tcol); nuclear@14: memcpy(bcol, imtk_get_color(IMTK_TOP_COLOR), sizeof bcol); nuclear@14: nuclear@7: /* through */ nuclear@14: imtk_draw_rect(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, tcol, bcol); nuclear@13: imtk_draw_frame(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, FRAME_INSET); nuclear@7: nuclear@14: /* bar */ nuclear@7: if(pos > 0.0) { nuclear@14: memcpy(tcol, imtk_get_color(IMTK_TOP_COLOR), sizeof tcol); nuclear@14: memcpy(bcol, imtk_get_color(IMTK_BOTTOM_COLOR), sizeof bcol); nuclear@14: nuclear@14: imtk_draw_rect(x, y, bar_size, PROGR_HEIGHT, tcol, bcol); nuclear@13: imtk_draw_frame(x, y, bar_size, PROGR_HEIGHT, FRAME_OUTSET); nuclear@7: } nuclear@7: }