aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/rectangle.c
blob: 4f2e40b8f4b1d5e2ec509a852dcc4eb2a7bf3551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include "../../include/mgl/graphics/rectangle.h"
#include "../../include/mgl/mgl.h"

void mgl_rectangle_draw(mgl_context *context, mgl_rectangle *rect) {
    context->gl.glColor4f(rect->color.r, rect->color.g, rect->color.b, rect->color.a);
    context->gl.glBegin(GL_QUADS);
        context->gl.glVertex3f(rect->position.x,                rect->position.y, 0.0f);
        context->gl.glVertex3f(rect->position.x + rect->size.x, rect->position.y, 0.0f);
        context->gl.glVertex3f(rect->position.x + rect->size.x, rect->position.y + rect->size.y, 0.0f);
        context->gl.glVertex3f(rect->position.x,                rect->position.y + rect->size.y, 0.0f);
    context->gl.glEnd();
}