diff options
| author | Ray <[email protected]> | 2019-03-12 16:00:26 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-03-12 16:00:26 +0100 |
| commit | 477ea4d6606aa4659549f786935096942f187b37 (patch) | |
| tree | bb0a7d172ea25eeec0fd492b4bd5b3804e6ea4ac | |
| parent | 76e968f6b7b211ed056f5ffe97d13086f58a661a (diff) | |
| download | raylib-477ea4d6606aa4659549f786935096942f187b37.tar.gz raylib-477ea4d6606aa4659549f786935096942f187b37.zip | |
Support external config flags
| -rw-r--r-- | src/core.c | 2 | ||||
| -rw-r--r-- | src/rlgl.h | 5 | ||||
| -rw-r--r-- | src/textures.c | 13 | ||||
| -rw-r--r-- | src/utils.c | 8 |
4 files changed, 25 insertions, 3 deletions
@@ -92,6 +92,8 @@ // Check if config flags have been externally provided on compilation line #if !defined(EXTERNAL_CONFIG_FLAGS) #include "config.h" // Defines module configuration flags +#else + #define RAYLIB_VERSION "2.5" #endif #if (defined(__linux__) || defined(PLATFORM_WEB)) && _POSIX_C_SOURCE < 199309L @@ -563,7 +563,10 @@ int GetPixelDataSize(int width, int height, int format);// Get pixel data size i #define SUPPORT_VR_SIMULATOR #define SUPPORT_DISTORTION_SHADER #else - #include "config.h" // rlgl module configuration + // Check if config flags have been externally provided on compilation line + #if !defined(EXTERNAL_CONFIG_FLAGS) + #include "config.h" // Defines module configuration flags + #endif #endif #include <stdio.h> // Required for: fopen(), fclose(), fread()... [Used only on LoadText()] diff --git a/src/textures.c b/src/textures.c index 01c9b2f5..95cb4eb5 100644 --- a/src/textures.c +++ b/src/textures.c @@ -181,6 +181,15 @@ static Image LoadASTC(const char *fileName); // Load ASTC file Image LoadImage(const char *fileName) { Image image = { 0 }; + +#if defined(SUPPORT_FILEFORMAT_PNG) || \ + defined(SUPPORT_FILEFORMAT_BMP) || \ + defined(SUPPORT_FILEFORMAT_TGA) || \ + defined(SUPPORT_FILEFORMAT_GIF) || \ + defined(SUPPORT_FILEFORMAT_PIC) || \ + defined(SUPPORT_FILEFORMAT_PSD) +#define STBI_REQUIRED +#endif #if defined(SUPPORT_FILEFORMAT_PNG) if ((IsFileExtension(fileName, ".png")) @@ -207,6 +216,7 @@ Image LoadImage(const char *fileName) #endif ) { +#if defined(STBI_REQUIRED) int imgWidth = 0; int imgHeight = 0; int imgBpp = 0; @@ -229,6 +239,7 @@ Image LoadImage(const char *fileName) else if (imgBpp == 3) image.format = UNCOMPRESSED_R8G8B8; else if (imgBpp == 4) image.format = UNCOMPRESSED_R8G8B8A8; } +#endif } #if defined(SUPPORT_FILEFORMAT_HDR) else if (IsFileExtension(fileName, ".hdr")) @@ -1403,6 +1414,8 @@ void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, in else { // TODO: ImageCrop(), define proper cropping rectangle + + UnloadImage(imTemp); } } diff --git a/src/utils.c b/src/utils.c index b31ce6ae..6b174354 100644 --- a/src/utils.c +++ b/src/utils.c @@ -30,9 +30,13 @@ * **********************************************************************************************/ -#include "config.h" - #include "raylib.h" // WARNING: Required for: LogType enum + +// Check if config flags have been externally provided on compilation line +#if !defined(EXTERNAL_CONFIG_FLAGS) + #include "config.h" // Defines module configuration flags +#endif + #include "utils.h" #if defined(PLATFORM_ANDROID) |
