diff --git a/src/include/util.h b/src/include/util.h index d1d1e33..5df1dc6 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -21,6 +21,7 @@ char* get_name(int ent_idx); vec3_t vec3(float x, float y, float z); bool vec_is_zero(vec3_t v); bool world_to_screen(vec3_t vec, vec2_t screen); +void gl_drawbox(int x, int y, int w, int h, rgb_t c); void gl_drawline(int x0, int y0, int x1, int y1, float w, rgb_t col); #endif /* UTIL_H_ */ diff --git a/src/util.c b/src/util.c index 1bd5522..f5c062b 100644 --- a/src/util.c +++ b/src/util.c @@ -57,6 +57,24 @@ bool world_to_screen(vec3_t vec, vec2_t screen) { return false; } +void gl_drawbox(int x, int y, int w, int h, rgb_t c) { + /* Line width */ + const int lw = 1; + + /* + * 1 + * +----+ + * 2 | | 3 + * | | + * +----+ + * 4 + */ + gl_drawline(x, y, x + w, y, lw, c); /* 1 */ + gl_drawline(x, y, x, y + h, lw, c); /* 2 */ + gl_drawline(x + w, y, x + w, y + h, lw, c); /* 3 */ + gl_drawline(x, y + h, x + w, y + h, lw, c); /* 4 */ +} + void gl_drawline(int x0, int y0, int x1, int y1, float w, rgb_t col) { const int alpha = 255;