From a6f9cc5629841b7adf3d9ff21eaa2aaabb3e4bc1 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 11 Dec 2017 11:55:02 +0100 Subject: Remove rres support Let the user choose if using rres external library --- src/utils.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 967ed916..aaa5bdb4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -66,9 +66,6 @@ #include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png() #endif -#define RRES_IMPLEMENTATION -#include "rres.h" - //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -- cgit v1.2.3 From 00c34a035c6cf32fb688dd06da39db32fa66bc70 Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 20 Dec 2017 12:37:08 +0100 Subject: Updated copyright year --- src/gestures.h | 2 +- src/models.c | 2 +- src/shapes.c | 2 +- src/text.c | 2 +- src/utils.c | 2 +- src/utils.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/utils.c') diff --git a/src/gestures.h b/src/gestures.h index 58670ef5..58f046cb 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -24,7 +24,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. diff --git a/src/models.c b/src/models.c index 4b8a6731..002ffac3 100644 --- a/src/models.c +++ b/src/models.c @@ -17,7 +17,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. diff --git a/src/shapes.c b/src/shapes.c index 0b34f921..9f405419 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -13,7 +13,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. diff --git a/src/text.c b/src/text.c index f577be19..eaf450b0 100644 --- a/src/text.c +++ b/src/text.c @@ -17,7 +17,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. diff --git a/src/utils.c b/src/utils.c index aaa5bdb4..72d4f2da 100644 --- a/src/utils.c +++ b/src/utils.c @@ -25,7 +25,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. diff --git a/src/utils.h b/src/utils.h index a1801245..f4a1a01a 100644 --- a/src/utils.h +++ b/src/utils.h @@ -5,7 +5,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. -- cgit v1.2.3 From e517d8fd168b361719c214d57463ef3ee461d425 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 24 Dec 2017 16:47:33 +0100 Subject: Added function SetTraceLogTypes() Trace log messages could be configured with this function to select wich ones are shown --- src/core.c | 4 ++-- src/raylib.h | 13 +++++++------ src/utils.c | 38 +++++++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 23 deletions(-) (limited to 'src/utils.c') diff --git a/src/core.c b/src/core.c index 05c794ad..7d7e188c 100644 --- a/src/core.c +++ b/src/core.c @@ -329,7 +329,7 @@ static double updateTime, drawTime; // Time measures for update and draw static double frameTime = 0.0; // Time measure for one frame static double targetTime = 0.0; // Desired time for one frame, if 0 not applied -static char configFlags = 0; // Configuration flags (bit based) +static unsigned char configFlags = 0; // Configuration flags (bit based) static bool showLogo = false; // Track if showing logo at init is enabled #if defined(SUPPORT_GIF_RECORDING) @@ -1138,7 +1138,7 @@ void ShowLogo(void) } // Setup window configuration flags (view FLAGS) -void SetConfigFlags(char flags) +void SetConfigFlags(unsigned char flags) { configFlags = flags; diff --git a/src/raylib.h b/src/raylib.h index b0ff1fc1..d3d58afa 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -514,11 +514,11 @@ typedef struct VrDeviceInfo { //---------------------------------------------------------------------------------- // Trace log type typedef enum { - LOG_INFO = 0, - LOG_WARNING, - LOG_ERROR, - LOG_DEBUG, - LOG_OTHER + LOG_INFO = 1, + LOG_WARNING = 2, + LOG_ERROR = 4, + LOG_DEBUG = 8, + LOG_OTHER = 16 } LogType; // Shader location point type @@ -727,7 +727,8 @@ RLAPI Matrix MatrixIdentity(void); // Returns ide // Misc. functions RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags) -RLAPI void SetConfigFlags(char flags); // Setup window configuration flags (view FLAGS) +RLAPI void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS) +RLAPI void SetTraceLogTypes(unsigned char types); // Enable trace log message types (bit flags based) RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png) RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included) diff --git a/src/utils.c b/src/utils.c index 72d4f2da..b262118c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -16,9 +16,6 @@ * Show TraceLog() output messages * NOTE: By default LOG_DEBUG traces not shown * -* #define SUPPORT_TRACELOG_DEBUG -* Show TraceLog() LOG_DEBUG messages -* * DEPENDENCIES: * stb_image_write - BMP/PNG writting functions * @@ -45,7 +42,6 @@ **********************************************************************************************/ #define SUPPORT_TRACELOG // Output tracelog messages -//#define SUPPORT_TRACELOG_DEBUG // Avoid LOG_DEBUG messages tracing #include "raylib.h" // WARNING: Required for: LogType enum #include "utils.h" @@ -63,12 +59,16 @@ #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) #define STB_IMAGE_WRITE_IMPLEMENTATION - #include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png() + #include "external/stb_image_write.h" // Required for: stbi_write_bmp(), stbi_write_png() #endif //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- + +// Log types messages supported flags (bit based) +static unsigned char logTypeFlags = LOG_INFO | LOG_WARNING | LOG_ERROR; + #if defined(PLATFORM_ANDROID) AAssetManager *assetManager; #endif @@ -87,16 +87,17 @@ static int android_close(void *cookie); // Module Functions Definition - Utilities //---------------------------------------------------------------------------------- +// Enable trace log message types (bit flags based) +void SetTraceLogTypes(unsigned char types) +{ + logTypeFlags = types; +} + // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) void TraceLog(int msgType, const char *text, ...) { #if defined(SUPPORT_TRACELOG) static char buffer[128]; - int traceDebugMsgs = 0; - -#if defined(SUPPORT_TRACELOG_DEBUG) - traceDebugMsgs = 1; -#endif switch(msgType) { @@ -116,14 +117,21 @@ void TraceLog(int msgType, const char *text, ...) #if defined(PLATFORM_ANDROID) switch(msgType) { - case LOG_INFO: __android_log_vprint(ANDROID_LOG_INFO, "raylib", buffer, args); break; - case LOG_ERROR: __android_log_vprint(ANDROID_LOG_ERROR, "raylib", buffer, args); break; - case LOG_WARNING: __android_log_vprint(ANDROID_LOG_WARN, "raylib", buffer, args); break; - case LOG_DEBUG: if (traceDebugMsgs) __android_log_vprint(ANDROID_LOG_DEBUG, "raylib", buffer, args); break; + case LOG_INFO: if (logTypeFlags & LOG_INFO) __android_log_vprint(ANDROID_LOG_INFO, "raylib", buffer, args); break; + case LOG_WARNING: if (logTypeFlags & LOG_WARNING) __android_log_vprint(ANDROID_LOG_WARN, "raylib", buffer, args); break; + case LOG_ERROR: if (logTypeFlags & LOG_ERROR) __android_log_vprint(ANDROID_LOG_ERROR, "raylib", buffer, args); break; + case LOG_DEBUG: if (logTypeFlags & LOG_DEBUG) __android_log_vprint(ANDROID_LOG_DEBUG, "raylib", buffer, args); break; default: break; } #else - if ((msgType != LOG_DEBUG) || ((msgType == LOG_DEBUG) && (traceDebugMsgs))) vprintf(buffer, args); + switch(msgType) + { + case LOG_INFO: if (logTypeFlags & LOG_INFO) vprintf(buffer, args); break; + case LOG_WARNING: if (logTypeFlags & LOG_WARNING) vprintf(buffer, args); break; + case LOG_ERROR: if (logTypeFlags & LOG_ERROR) vprintf(buffer, args); break; + case LOG_DEBUG: if (logTypeFlags & LOG_DEBUG) vprintf(buffer, args); break; + default: break; + } #endif va_end(args); -- cgit v1.2.3 From 0bd06eec5100da648e1d3dc9bd0fd796b240e079 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 24 Dec 2017 16:49:54 +0100 Subject: Renamed function to SetTraceLog() I think is clearer this way... --- src/raylib.h | 2 +- src/utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/utils.c') diff --git a/src/raylib.h b/src/raylib.h index d3d58afa..75dafa42 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -728,7 +728,7 @@ RLAPI Matrix MatrixIdentity(void); // Returns ide // Misc. functions RLAPI void ShowLogo(void); // Activate raylib logo at startup (can be done with flags) RLAPI void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS) -RLAPI void SetTraceLogTypes(unsigned char types); // Enable trace log message types (bit flags based) +RLAPI void SetTraceLog(unsigned char types); // Enable trace log message types (bit flags based) RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG) RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png) RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included) diff --git a/src/utils.c b/src/utils.c index b262118c..743ef98c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -88,7 +88,7 @@ static int android_close(void *cookie); //---------------------------------------------------------------------------------- // Enable trace log message types (bit flags based) -void SetTraceLogTypes(unsigned char types) +void SetTraceLog(unsigned char types) { logTypeFlags = types; } -- cgit v1.2.3