# HG changeset patch # User John Tsiombikas # Date 1299658351 -7200 # Node ID 9b623dc0f2962dc0d92d9af67d6b718f67088edb # Parent 86ba127ac2f2dfe6ab75b0520720f530a5bedf32 foo diff -r 86ba127ac2f2 -r 9b623dc0f296 src/draw.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/draw.c Wed Mar 09 10:12:31 2011 +0200 @@ -0,0 +1,65 @@ +#ifndef __APPLE__ +#include +#else +#include +#endif + +#include "draw.h" + +struct color { + float r, g, b, a; +}; + +static struct color fgcolor = {0, 0, 0, 1}; +static struct color bgcolor = {0.4, 0.4, 0.4, 1}; + +void imtk_draw_color(float r, float g, float b, float a) +{ + fgcolor.r = r; + fgcolor.g = g; + fgcolor.b = b; + fgcolor.a = a; +} + +void imtk_draw_background(float r, float g, float b, float a) +{ + bgcolor.r = r; + bgcolor.g = g; + bgcolor.b = b; + bgcolor.a = a; +} + +void imtk_draw_rect(int x, int y, int w, int h, int rad) +{ + glBegin(GL_LINE_LOOP); + linestart(x + rad, y); + lineto(x + w - rad, y); + arcto(x + w, y + rad); + lineto(x + w, y + h - rad); + arcto(x + w - rad, y + h); + lineto(x + rad, y + h); + arcto(x, y + h - rad); + lineto(x, y + rad); + arcto(x + rad, y); + glEnd(); +} + +static int px, py; + +static void linestart(int x, int y) +{ + px = x; + py = y; + glVertex2i(x, y); +} + +static void lineto(int x, int y) +{ + px = x; + py = y; + glVertex2i(x, y); +} + +static void arcto(int x, int y, int rad) +{ +}