aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/sprite.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-31 20:55:37 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-31 20:55:42 +0200
commit470dac0e891c1ec59dfe52e77861cf068837976d (patch)
treeca26672c104ef2b4bfb9a1884616e52b2ec7c35e /src/graphics/sprite.c
parentf3e5b69d33f47dece7e3bc8c133f65ad7169cc18 (diff)
Add mipmap option
Diffstat (limited to 'src/graphics/sprite.c')
-rw-r--r--src/graphics/sprite.c8
1 files changed, 8 insertions, 0 deletions
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)