From 8f5ff64420dda659583c156b9c5e42e60384e247 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 19 Mar 2017 12:52:58 +0100 Subject: Working on file header comments... --- src/utils.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 9a2a723a..54923e34 100644 --- a/src/utils.c +++ b/src/utils.c @@ -4,14 +4,20 @@ * * CONFIGURATION: * -* #define SUPPORT_SAVE_PNG -* Enable saving PNG fileformat +* #define SUPPORT_SAVE_PNG (defined by default) +* Support saving image data as PNG fileformat * NOTE: Requires stb_image_write library * * #define SUPPORT_SAVE_BMP +* Support saving image data as BMP fileformat +* NOTE: Requires stb_image_write library +* +* #define SUPPORT_TRACELOG +* Show TraceLog() output messages +* NOTE: By default DEBUG traces not shown * -* #define DO_NOT_TRACE_DEBUG_MSGS -* Avoid showing DEBUG TraceLog() messages +* #define SUPPORT_TRACELOG_DEBUG +* Show TraceLog() DEBUG messages * * DEPENDENCIES: * stb_image_write - PNG writting functions @@ -129,18 +135,23 @@ void TraceLog(int msgType, const char *text, ...) } #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) + +#if defined(SUPPORT_SAVE_BMP) // Creates a BMP image file from an array of pixel data void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize) { stbi_write_bmp(fileName, width, height, compSize, imgData); } +#endif +#if defined(SUPPORT_SAVE_PNG) // Creates a PNG image file from an array of pixel data void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize) { stbi_write_png(fileName, width, height, compSize, imgData, width*compSize); } #endif +#endif #if defined(PLATFORM_ANDROID) // Initialize asset manager from android app -- cgit v1.2.3 From 59652c75b43d0437217c0000b03428545905801e Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 20 Mar 2017 20:34:44 +0100 Subject: Review some comments --- src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 54923e34..4d30cbc7 100644 --- a/src/utils.c +++ b/src/utils.c @@ -25,7 +25,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2017 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 5387b4543175bee9d195b24e250a0ef863a63555 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 25 Mar 2017 12:01:01 +0100 Subject: Working on configuration flags --- src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 4d30cbc7..b6b309cc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -20,7 +20,7 @@ * Show TraceLog() DEBUG messages * * DEPENDENCIES: -* stb_image_write - PNG writting functions +* stb_image_write - BMP/PNG writting functions * * * LICENSE: zlib/libpng -- cgit v1.2.3 From b7a8a40e71f6c4467afd260c1f66e2c46891397f Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 26 Mar 2017 22:49:01 +0200 Subject: Work on configuration flags --- src/utils.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index b6b309cc..6a07f301 100644 --- a/src/utils.c +++ b/src/utils.c @@ -153,6 +153,29 @@ void SavePNG(const char *fileName, unsigned char *imgData, int width, int height #endif #endif +// Keep track of memory allocated +// NOTE: mallocType defines the type of data allocated +/* +void RecordMalloc(int mallocType, int mallocSize, const char *msg) +{ + // TODO: Investigate how to record memory allocation data... + // Maybe creating my own malloc function... +} +*/ + +bool IsFileExtension(const char *fileName, const char *ext) +{ + return (strcmp(GetExtension(fileName), ext) == 0); +} + +// Get the extension for a filename +const char *GetExtension(const char *fileName) +{ + const char *dot = strrchr(fileName, '.'); + if (!dot || dot == fileName) return ""; + return (dot + 1); +} + #if defined(PLATFORM_ANDROID) // Initialize asset manager from android app void InitAssetManager(AAssetManager *manager) @@ -173,24 +196,6 @@ FILE *android_fopen(const char *fileName, const char *mode) } #endif -// Keep track of memory allocated -// NOTE: mallocType defines the type of data allocated -/* -void RecordMalloc(int mallocType, int mallocSize, const char *msg) -{ - // TODO: Investigate how to record memory allocation data... - // Maybe creating my own malloc function... -} -*/ - -// Get the extension for a filename -const char *GetExtension(const char *fileName) -{ - const char *dot = strrchr(fileName, '.'); - if (!dot || dot == fileName) return ""; - return (dot + 1); -} - //---------------------------------------------------------------------------------- // Module specific Functions Definition //---------------------------------------------------------------------------------- -- cgit v1.2.3