sprite x,y now defines location of origin on sprite
parent
89db4253ae
commit
e03037acbe
|
@ -82,6 +82,8 @@ void _exec_sprite_cmd(const drawcmd_t* cmd) {
|
||||||
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 = {destrect.w * sprite->origin.x, destrect.h * sprite->origin.y};
|
SDL_FPoint origin = {destrect.w * sprite->origin.x, destrect.h * sprite->origin.y};
|
||||||
|
destrect.x -= origin.x;
|
||||||
|
destrect.y -= 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,
|
||||||
&origin, sprite->flip);
|
&origin, sprite->flip);
|
||||||
|
|
Loading…
Reference in New Issue