src/texture.c

changeset 91
8433c87c0f51
parent 89
e1f682a8a145
equal deleted inserted replaced
90:aa8e7a38905c 91:8433c87c0f51
97 cxmutstr filepath = asc_filesystem_combine_paths(cx_strcast(asc_context.texture_path), cx_str(name)); 97 cxmutstr filepath = asc_filesystem_combine_paths(cx_strcast(asc_context.texture_path), cx_str(name));
98 asc_dprintf("Load texture from %" CX_PRIstr, CX_SFMT(filepath)); 98 asc_dprintf("Load texture from %" CX_PRIstr, CX_SFMT(filepath));
99 SDL_Surface *image = IMG_Load(filepath.ptr); 99 SDL_Surface *image = IMG_Load(filepath.ptr);
100 cx_strfree(&filepath); 100 cx_strfree(&filepath);
101 if (image == NULL) { 101 if (image == NULL) {
102 asc_error("Failed to load texture."); 102 asc_error("Failed to load texture: %s", IMG_GetError());
103 asc_error(IMG_GetError());
104 return; 103 return;
105 } 104 }
106 asc_texture_from_surface(tex, image); 105 asc_texture_from_surface(tex, image);
107 asc_dprintf("Free temporary surface %"PRIxPTR, (uintptr_t) image); 106 asc_dprintf("Free temporary surface %"PRIxPTR, (uintptr_t) image);
108 SDL_FreeSurface(image); 107 SDL_FreeSurface(image);

mercurial