From 62b45155855a83c2c7d07047238b62a452487a95 Mon Sep 17 00:00:00 2001 From: Sara Date: Sun, 14 May 2023 14:56:06 +0200 Subject: [PATCH] sprite origin now percentage of source rect --- src/corelib/render.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/render.c b/src/corelib/render.c index 2ffb589..9ef3bcd 100644 --- a/src/corelib/render.c +++ b/src/corelib/render.c @@ -81,9 +81,10 @@ void _exec_sprite_cmd(const drawcmd_t* cmd) { const sprite_t* sprite = &cmd->sprite; SDL_FRect untransformed = {sprite->x, sprite->y, sprite->sx, sprite->sy}; SDL_FRect destrect = get_dest_with_size(untransformed, cmd->ui); + SDL_FPoint origin = {sprite->uv.w * sprite->origin.x, sprite->uv.h * sprite->origin.y}; SDL_RenderCopyExF(g_context.renderer, sprite->texture, &sprite->uv, &destrect, sprite->rot, - &sprite->origin,SDL_FLIP_NONE); + &origin, SDL_FLIP_NONE); } static