diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-01-23 18:49:33 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-01-23 18:49:33 -0500 |
commit | 8f924a1d462f50240ca2143492c72fd3bca2e467 (patch) | |
tree | ce1dcc1f9ba9adbaab43ca639faf5e5770c690a5 | |
parent | 8506409d8a7d07a3e3fc13eac74b2c0dc21e4743 (diff) | |
download | sok-master.tar.bz2 sok-master.zip |
-rw-r--r-- | src/sdl/sprites.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sdl/sprites.c b/src/sdl/sprites.c index 4f3360d..6fe8df0 100644 --- a/src/sdl/sprites.c +++ b/src/sdl/sprites.c @@ -18,17 +18,18 @@ sprite_set_init( const asset_id_t asset_id ) { sprite_set_t set; + // get asset const asset_t * const asset = asset_get(asset_id); - // load image + // load backing image data int im_w, im_h; set.im_data = stbi_load_from_memory(asset->buf, asset->len, &im_w, &im_h, NULL, 4); if (!set.im_data) { die("stbi_load(): %s", stbi_failure_reason()); } - // create surface + // create surface from backing image data set.surface = SDL_CreateRGBSurfaceWithFormatFrom(set.im_data, im_w, im_h, 32, 4 * im_w, SDL_PIXELFORMAT_RGBA32); if (!set.surface) { die("SDLCreateRGBSurfaceFrom(): %s", SDL_GetError()); @@ -45,7 +46,7 @@ sprite_set_fini( // free main surface SDL_FreeSurface(set->surface); - // free image data + // free backing image data stbi_image_free(set->im_data); } |