aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Sprite.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/graphics/Sprite.cpp b/src/graphics/Sprite.cpp
index b94212e..461b14c 100644
--- a/src/graphics/Sprite.cpp
+++ b/src/graphics/Sprite.cpp
@@ -34,6 +34,13 @@ namespace mgl {
return { sprite.position.x, sprite.position.y };
}
+ vec2f Sprite::get_size() const {
+ if(texture)
+ return get_scale() * mgl::vec2f(texture->get_size().x, texture->get_size().y);
+ else
+ return { 0.0f, 0.0f };
+ }
+
void Sprite::set_scale(vec2f scale) {
sprite.scale = { scale.x, scale.y };
}