Mercurial > molko
diff libmlk-example/mlk/example/registry.c @ 516:6af0524913b3
misc: fix
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 04 Mar 2023 11:23:10 +0100 |
parents | d7855791a2b8 |
children | c7664b679a95 |
line wrap: on
line diff
--- a/libmlk-example/mlk/example/registry.c Sat Mar 04 11:02:48 2023 +0100 +++ b/libmlk-example/mlk/example/registry.c Sat Mar 04 11:23:10 2023 +0100 @@ -130,10 +130,16 @@ if ((err = mlk_image_openmem(texture, textures[i].data, textures[i].datasz)) < 0) mlk_panic(err); - if (textures[i].cellw == 0 || textures[i].cellh == 0) - mlk_sprite_init(sprite, texture, texture->w, texture->h); - else - mlk_sprite_init(sprite, texture, textures[i].cellw, textures[i].cellh); + if (textures[i].cellw == 0 || textures[i].cellh == 0) { + sprite->cellw = texture->w; + sprite->cellh = texture->h; + } else { + sprite->cellw = textures[i].cellw; + sprite->cellh = textures[i].cellh; + } + + sprite->texture = texture; + mlk_sprite_init(sprite); } }