sprite origin now percentage of source rect
parent
04101f6427
commit
62b4515585
|
@ -81,9 +81,10 @@ void _exec_sprite_cmd(const drawcmd_t* cmd) {
|
||||||
const sprite_t* sprite = &cmd->sprite;
|
const sprite_t* sprite = &cmd->sprite;
|
||||||
SDL_FRect untransformed = {sprite->x, sprite->y, sprite->sx, sprite->sy};
|
SDL_FRect untransformed = {sprite->x, sprite->y, sprite->sx, sprite->sy};
|
||||||
SDL_FRect destrect = get_dest_with_size(untransformed, cmd->ui);
|
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,
|
SDL_RenderCopyExF(g_context.renderer, sprite->texture,
|
||||||
&sprite->uv, &destrect, sprite->rot,
|
&sprite->uv, &destrect, sprite->rot,
|
||||||
&sprite->origin,SDL_FLIP_NONE);
|
&origin, SDL_FLIP_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
Loading…
Reference in New Issue