From 8f924a1d462f50240ca2143492c72fd3bca2e467 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 23 Jan 2019 18:49:33 -0500 Subject: sprites.c: add comments --- src/sdl/sprites.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/sdl/sprites.c') 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); } -- cgit v1.2.3