aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-25 14:56:49 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-25 14:56:49 +0200
commitb4799373f7fb9c8faec813e78a955438301cb9d1 (patch)
tree580b177912b3922b34681122099d742a57fd853b /src/graphics
parent05da9076d3d1b0d770c13572368f974786edcd92 (diff)
Add sprite set size/height functions, option to hide window decorations in create window
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/sprite.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/graphics/sprite.c b/src/graphics/sprite.c
index df3e902..95f733b 100644
--- a/src/graphics/sprite.c
+++ b/src/graphics/sprite.c
@@ -31,6 +31,22 @@ void mgl_sprite_set_origin(mgl_sprite *self, mgl_vec2f origin) {
self->origin = origin;
}
+void mgl_sprite_set_size(mgl_sprite *self, mgl_vec2f size) {
+ if(!self->texture)
+ return;
+
+ self->scale.x = size.x / (float)self->texture->width;
+ self->scale.y = size.y / (float)self->texture->height;
+}
+
+void mgl_sprite_set_height(mgl_sprite *self, float height) {
+ if(!self->texture)
+ return;
+
+ self->scale.x = height / (float)self->texture->width;
+ self->scale.y = self->scale.x;
+}
+
/* 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)