diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-18 01:39:47 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-18 01:39:47 +0200 |
commit | fc98ecc0fb9461688a5f82515248f56f507080f2 (patch) | |
tree | 9b4f43cc75a4a3c2577f7fd23054d38f819bec9f /src/graphics/sprite.c | |
parent | 6083534cd846eda51cc8664447ba1490837fd5e3 (diff) |
Add set_position and set_color to rectangle,sprite and text
Diffstat (limited to 'src/graphics/sprite.c')
-rw-r--r-- | src/graphics/sprite.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/graphics/sprite.c b/src/graphics/sprite.c index 274278c..2b290bb 100644 --- a/src/graphics/sprite.c +++ b/src/graphics/sprite.c @@ -9,6 +9,14 @@ void mgl_sprite_init(mgl_sprite *self, mgl_texture *texture, float x, float y) { self->scale = (mgl_vec2f){ 1.0f, 1.0f }; } +void mgl_sprite_set_position(mgl_sprite *self, mgl_vec2f position) { + self->position = position; +} + +void mgl_sprite_set_color(mgl_sprite *self, mgl_color color) { + self->color = color; +} + /* TODO: Cache texture bind to not bind texture if its already bound and do not bind texture 0 */ void mgl_sprite_draw(mgl_context *context, mgl_sprite *sprite) { context->gl.glColor4f(sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a); @@ -28,10 +36,3 @@ void mgl_sprite_draw(mgl_context *context, mgl_sprite *sprite) { context->gl.glEnd(); context->gl.glBindTexture(GL_TEXTURE_2D, 0); } - -void mgl_sprite_set_color(mgl_sprite *self, float r, float g, float b, float a) { - self->color.r = r; - self->color.g = g; - self->color.b = b; - self->color.a = a; -} |