glamtk
changeset 9:4b1989ff2ef7
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 11 Apr 2011 03:59:03 +0300 |
parents | cd00a5775373 |
children | 5b86b98ee988 |
files | src/imtk.c |
diffstat | 1 files changed, 20 insertions(+), 46 deletions(-) [+] |
line diff
1.1 --- a/src/imtk.c Thu Mar 31 04:38:16 2011 +0300 1.2 +++ b/src/imtk.c Mon Apr 11 03:59:03 2011 +0300 1.3 @@ -489,31 +489,27 @@ 1.4 { 1.5 int strsz = string_size(text); 1.6 1.7 + 1.8 if(hit_test(x, y, TEXTBOX_SIZE, 20)) { 1.9 - glColor3fv(colors[IMTK_FOCUS_COLOR]); 1.10 + imtk_draw_backgroundv(colors[IMTK_FOCUS_COLOR]); 1.11 } else { 1.12 - glColor3fv(colors[IMTK_BASE_COLOR]); 1.13 + imtk_draw_backgroundv(colors[IMTK_BASE_COLOR]); 1.14 } 1.15 1.16 - glBegin(GL_QUADS); 1.17 - glVertex2f(x, y); 1.18 - glVertex2f(x + TEXTBOX_SIZE, y); 1.19 - glVertex2f(x + TEXTBOX_SIZE, y + 20); 1.20 - glVertex2f(x, y + 20); 1.21 - glEnd(); 1.22 - 1.23 - glColor3fv(colors[IMTK_TEXT_COLOR]); 1.24 + imtk_draw_rect(x, y, TEXTBOX_SIZE, 20, 3); 1.25 1.26 if(input == id) { 1.27 glBegin(GL_LINES); 1.28 + glColor4f(1, 0, 0, colors[IMTK_TEXT_COLOR][3]); 1.29 glVertex2f(x + strsz + 2, y + 2); 1.30 glVertex2f(x + strsz + 2, y + 18); 1.31 + glVertex2f(x + strsz + 3, y + 2); 1.32 + glVertex2f(x + strsz + 3, y + 18); 1.33 glEnd(); 1.34 } 1.35 1.36 + glColor4fv(colors[IMTK_TEXT_COLOR]); 1.37 draw_string(x + 2, y + 15, text); 1.38 - 1.39 - draw_frame(x, y, TEXTBOX_SIZE, 20, FRAME_INSET); 1.40 } 1.41 1.42 static void draw_slider(int id, float pos, float min, float max, int x, int y) 1.43 @@ -526,33 +522,21 @@ 1.44 thumb_y = y - THUMB_HEIGHT / 2; 1.45 1.46 /* draw trough */ 1.47 - glBegin(GL_QUADS); 1.48 - glColor3fv(colors[IMTK_BASE_COLOR]); 1.49 - glVertex2f(x, y - 2); 1.50 - glVertex2f(x + SLIDER_SIZE, y - 2); 1.51 - glVertex2f(x + SLIDER_SIZE, y + 2); 1.52 - glVertex2f(x, y + 2); 1.53 - glEnd(); 1.54 - draw_frame(x, y - 2, SLIDER_SIZE, 4, FRAME_INSET); 1.55 + imtk_draw_backgroundv(colors[IMTK_BASE_COLOR]); 1.56 + imtk_draw_rect(x, y - 2, SLIDER_SIZE, 4, 3); 1.57 1.58 if(hit_test(thumb_x, thumb_y, THUMB_WIDTH, THUMB_HEIGHT)) { 1.59 - glColor3fv(colors[IMTK_FOCUS_COLOR]); 1.60 + imtk_draw_backgroundv(colors[IMTK_FOCUS_COLOR]); 1.61 } else { 1.62 - glColor3fv(colors[IMTK_BASE_COLOR]); 1.63 + imtk_draw_backgroundv(colors[IMTK_BASE_COLOR]); 1.64 } 1.65 1.66 /* draw handle */ 1.67 - glBegin(GL_QUADS); 1.68 - glVertex2f(thumb_x, thumb_y); 1.69 - glVertex2f(thumb_x + THUMB_WIDTH, thumb_y); 1.70 - glVertex2f(thumb_x + THUMB_WIDTH, thumb_y + THUMB_HEIGHT); 1.71 - glVertex2f(thumb_x, thumb_y + THUMB_HEIGHT); 1.72 - glEnd(); 1.73 - draw_frame(thumb_x, thumb_y, THUMB_WIDTH, THUMB_HEIGHT, FRAME_OUTSET); 1.74 + imtk_draw_rect(thumb_x, thumb_y, THUMB_WIDTH, THUMB_HEIGHT, 5); 1.75 1.76 /* draw display */ 1.77 sprintf(buf, "%.3f", pos * range + min); 1.78 - glColor3fv(colors[IMTK_TEXT_COLOR]); 1.79 + glColor4fv(colors[IMTK_TEXT_COLOR]); 1.80 draw_string(x + SLIDER_SIZE + THUMB_WIDTH / 2 + 2, y + 4, buf); 1.81 } 1.82 1.83 @@ -564,25 +548,15 @@ 1.84 if(pos > 1.0) pos = 1.0; 1.85 1.86 /* through */ 1.87 - glBegin(GL_QUADS); 1.88 - glColor3fv(colors[IMTK_BASE_COLOR]); 1.89 - glVertex2f(x - 1, y - 1); 1.90 - glVertex2f(x + SLIDER_SIZE + 1, y - 1); 1.91 - glVertex2f(x + SLIDER_SIZE + 1, y + 17); 1.92 - glVertex2f(x - 1, y + 17); 1.93 - glEnd(); 1.94 - draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET); 1.95 + imtk_draw_backgroundv(colors[IMTK_BASE_COLOR]); 1.96 + imtk_draw_rect(x, y, SLIDER_SIZE, 15, 8); 1.97 1.98 if(pos > 0.0) { 1.99 /* bar */ 1.100 - glBegin(GL_QUADS); 1.101 - glColor3fv(colors[IMTK_BASE_COLOR]); 1.102 - glVertex2f(x, y); 1.103 - glVertex2f(x + bar_size, y); 1.104 - glVertex2f(x + bar_size, y + 15); 1.105 - glVertex2f(x, y + 15); 1.106 - glEnd(); 1.107 - draw_frame(x, y, bar_size, 15, FRAME_OUTSET); 1.108 + imtk_draw_color(0, 0, 0, 0); 1.109 + imtk_draw_background(0.2, 0.4, 1.0, colors[IMTK_BASE_COLOR][3]); 1.110 + imtk_draw_rect(x, y, bar_size, 15, 8); 1.111 + imtk_draw_colorv(colors[IMTK_FRAME_COLOR]); 1.112 } 1.113 } 1.114