diff --git a/engine/graphic/opengl/gf_graphic.c b/engine/graphic/opengl/gf_graphic.c index 58c03cd..2b0643b 100644 --- a/engine/graphic/opengl/gf_graphic.c +++ b/engine/graphic/opengl/gf_graphic.c @@ -65,6 +65,22 @@ void gf_graphic_draw_texture_2d(gf_draw_t* draw, float x, float y, float w, floa gf_graphic_end_2d(draw); } +void gf_graphic_fill_rect(gf_draw_t* draw, float x, float y, float w, float h, float r, float g, float b, float a) { + gf_graphic_begin_2d(draw); + + gf_draw_driver_set_color(draw, r, g, b, a); + glBegin(GL_QUADS); + + glVertex2f(x, y); + glVertex2f(x, y + h); + glVertex2f(x + w, y + h); + glVertex2f(x + w, y); + + glEnd(); + + gf_graphic_end_2d(draw); +} + void gf_graphic_text(gf_draw_t* draw, float x, float y, float size, const char* text, float r, float g, float b, float a) { int i; for(i = 0; text[i] != 0; i++) { diff --git a/engine/include/gf_graphic.h b/engine/include/gf_graphic.h index 8dbf524..30f84ed 100644 --- a/engine/include/gf_graphic.h +++ b/engine/include/gf_graphic.h @@ -13,9 +13,13 @@ #include GF_EXPORT void gf_graphic_clear(gf_draw_t* draw); + GF_EXPORT void gf_graphic_begin_2d(gf_draw_t* draw); GF_EXPORT void gf_graphic_end_2d(gf_draw_t* draw); + GF_EXPORT void gf_graphic_draw_texture_2d(gf_draw_t* draw, float x, float y, float w, float h, gf_texture_t* texture, float r, float g, float b, float a); +GF_EXPORT void gf_graphic_fill_rect(gf_draw_t* draw, float x, float y, float w, float h, float r, float g, float b, float a); + GF_EXPORT void gf_graphic_text(gf_draw_t* draw, float x, float y, float size, const char* text, float r, float g, float b, float a); #endif