diff --git a/src/corelib/render.c b/src/corelib/render.c index 1c6dec5..2ffb589 100644 --- a/src/corelib/render.c +++ b/src/corelib/render.c @@ -79,18 +79,8 @@ SDL_FRect get_dest_with_size(SDL_FRect untransformed, int ui) { static void _exec_sprite_cmd(const drawcmd_t* cmd) { const sprite_t* sprite = &cmd->sprite; - float fw, fh, fwm, fhm; - get_scaling_factors(&fw, &fh, &fwm, &fhm, cmd->ui); - SDL_FRect destrect = (SDL_FRect){ - .x=((-g_active_view.x)+(fw*0.5f)+sprite->x)*fwm, - .y=((-g_active_view.y)+(fh*0.5f)+sprite->y)*fwm, - .w=sprite->sx*fwm, - .h=sprite->sy*fwm - }; - if(cmd->ui) { - destrect.x = cmd->sprite.x * fwm; - destrect.y = cmd->sprite.y * fhm; - } + SDL_FRect untransformed = {sprite->x, sprite->y, sprite->sx, sprite->sy}; + SDL_FRect destrect = get_dest_with_size(untransformed, cmd->ui); SDL_RenderCopyExF(g_context.renderer, sprite->texture, &sprite->uv, &destrect, sprite->rot, &sprite->origin,SDL_FLIP_NONE);