From 470dac0e891c1ec59dfe52e77861cf068837976d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 31 Jul 2024 20:55:37 +0200 Subject: Add mipmap option --- src/graphics/sprite.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/graphics/sprite.c') diff --git a/src/graphics/sprite.c b/src/graphics/sprite.c index 95f733b..3110cf9 100644 --- a/src/graphics/sprite.c +++ b/src/graphics/sprite.c @@ -47,6 +47,14 @@ void mgl_sprite_set_height(mgl_sprite *self, float height) { self->scale.y = self->scale.x; } +mgl_vec2f mgl_sprite_get_size(const mgl_sprite *self) { + if(self->texture) { + return (mgl_vec2f){ (float)self->texture->width * self->scale.x, (float)self->texture->height * self->scale.y }; + } else { + return (mgl_vec2f){ 0.0f, 0.0f }; + } +} + /* 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) { if(!sprite->texture) -- cgit v1.2.3