diff options
| author | Ray <raysan5@gmail.com> | 2014-11-24 16:05:41 +0100 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2014-11-24 16:05:41 +0100 |
| commit | d16519f5de1d20dd2c2a3dc187666819479a5a11 (patch) | |
| tree | cd5368e64893d3a557df9ddd7c32c0720984069b /src/textures.c | |
| parent | 45b214d83e7469a64793ac4dcebaa0ab963668ef (diff) | |
| parent | fcff83e65cebb0c9767f076e8ccfaf6b6bfb8d95 (diff) | |
| download | raylib-d16519f5de1d20dd2c2a3dc187666819479a5a11.tar.gz raylib-d16519f5de1d20dd2c2a3dc187666819479a5a11.zip | |
Merge pull request #9 from raysan5/master
Populate master changes to develop branch
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/textures.c b/src/textures.c index e342e21b..929cba78 100644 --- a/src/textures.c +++ b/src/textures.c @@ -36,6 +36,7 @@ #include "utils.h" // rRES data decompression utility function // NOTE: Includes Android fopen function map +#define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" // Used to read image data (multiple formats support) //---------------------------------------------------------------------------------- @@ -46,8 +47,6 @@ //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- -typedef unsigned char byte; - typedef struct { unsigned char *data; // Image raw data int width; // Image base width @@ -104,6 +103,8 @@ Image LoadImage(const char *fileName) // Force loading to 4 components (RGBA) byte *imgData = stbi_load(fileName, &imgWidth, &imgHeight, &imgBpp, 4); + // TODO: Check if file could be loaded! (imgData == NULL)? + if (imgData != NULL) { // Convert array to pixel array for working convenience @@ -127,7 +128,7 @@ Image LoadImage(const char *fileName) TraceLog(INFO, "[%s] Image loaded successfully", fileName); } - else TraceLog(WARNING, "[%s] Image could not be loaded", fileName); + else TraceLog(WARNING, "[%s] Image could not be loaded, file format not recognized", fileName); } else if (strcmp(GetExtension(fileName),"dds") == 0) { |
