aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/sprite.c
diff options
context:
space:
mode:
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)