Compare commits
5 Commits
17eef0eb20
...
1748db8412
Author | SHA1 | Date |
---|---|---|
|
1748db8412 | |
|
d067ea6df8 | |
|
0a6242ef3c | |
|
a0cc95873e | |
|
eb39cb1432 |
|
@ -1,3 +1,6 @@
|
|||
# ide files
|
||||
.nvimrc
|
||||
|
||||
# build dirs
|
||||
bin/
|
||||
release/
|
||||
|
@ -8,3 +11,4 @@ compile_commands.json
|
|||
|
||||
# clangd cache
|
||||
.cache/
|
||||
.helix
|
||||
|
|
|
@ -80,10 +80,10 @@ static
|
|||
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};
|
||||
untransformed.x -= sprite->origin.x;
|
||||
untransformed.y -= sprite->origin.y;
|
||||
SDL_FRect destrect = get_dest_with_size(untransformed, cmd->ui);
|
||||
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,
|
||||
&sprite->uv, &destrect, sprite->rot,
|
||||
&origin, sprite->flip);
|
||||
|
@ -443,7 +443,7 @@ sprite_t make_sprite(const char* file, float x, float y) {
|
|||
sprite_t sprite=(sprite_t){
|
||||
.texture=get_texture(file),
|
||||
.x=x,.y=y,
|
||||
.origin=(SDL_FPoint){.x=0,.y=0},
|
||||
.origin=(SDL_FPoint){.x=0.0,.y=0.0},
|
||||
.sx=1.0,.sy=1.0,
|
||||
.rot=0,
|
||||
.depth=RLAYER_SPRITES,
|
||||
|
@ -451,7 +451,6 @@ sprite_t make_sprite(const char* file, float x, float y) {
|
|||
.flip=SDL_FLIP_NONE,
|
||||
};
|
||||
SDL_QueryTexture(sprite.texture, NULL, NULL, &sprite.uv.w, &sprite.uv.h);
|
||||
sprite.origin.x = -(float)sprite.uv.h/2.f; sprite.origin.y = -(float)sprite.uv.h/2.f;
|
||||
return sprite;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue