From 1366bebe2de32fee34523eec2d521d59b77b1c70 Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Fri, 4 Aug 2023 10:53:57 -0700 Subject: [PATCH 1/3] pong: fix typo in error log --- samples/pong/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/pong/src/main.c b/samples/pong/src/main.c index 6f3baee..1c01b82 100644 --- a/samples/pong/src/main.c +++ b/samples/pong/src/main.c @@ -74,15 +74,15 @@ ORCA_EXPORT void OnInit(void) if(mg_image_is_nil(waterImage)) { - log_error("coulnd't load ball image\n"); + log_error("couldn't load water image\n"); } if(mg_image_is_nil(ballImage)) { - log_error("coulnd't load ball image\n"); + log_error("couldn't load ball image\n"); } if(mg_image_is_nil(paddleImage)) { - log_error("coulnd't load paddle image\n"); + log_error("couldn't load paddle image\n"); } str8 fontStr = loadFile(mem_scratch(), STR8("/Literata-SemiBoldItalic.ttf")); -- 2.25.1 From ac166e50775fb4ff85af98d4014eb0000107776d Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Thu, 10 Aug 2023 11:08:32 -0700 Subject: [PATCH 2/3] fixing log parameter order --- src/platform/orca_log.c | 4 ++-- src/platform/platform_log.c | 4 ++-- src/platform/std_log.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/orca_log.c b/src/platform/orca_log.c index 5bf1068..417d926 100644 --- a/src/platform/orca_log.c +++ b/src/platform/orca_log.c @@ -51,8 +51,8 @@ char* log_stbsp_callback(char const* buf, void* user, int len) void platform_log_push(log_output* output, log_level level, - str8 function, str8 file, + str8 function, int line, const char* fmt, va_list ap) @@ -68,7 +68,7 @@ void platform_log_push(log_output* output, str8 string = str8_list_join(scratch, ctx.list); - orca_log(level, str8_ip(function), str8_ip(file), line, str8_ip(string)); + orca_log(level, str8_ip(file), str8_ip(function), line, str8_ip(string)); mem_arena_scope_end(tmp); } diff --git a/src/platform/platform_log.c b/src/platform/platform_log.c index e595cc2..a2e1f04 100644 --- a/src/platform/platform_log.c +++ b/src/platform/platform_log.c @@ -28,8 +28,8 @@ void log_set_level(log_level level) void platform_log_push(log_output* output, log_level level, - str8 function, str8 file, + str8 function, int line, const char* fmt, va_list ap); @@ -50,7 +50,7 @@ void log_push(log_level level, { va_list ap; va_start(ap, fmt); - platform_log_push(__logConfig.output, level, function, file, line, fmt, ap); + platform_log_push(__logConfig.output, level, file, function, line, fmt, ap); va_end(ap); } } diff --git a/src/platform/std_log.c b/src/platform/std_log.c index 38d32a9..0920711 100644 --- a/src/platform/std_log.c +++ b/src/platform/std_log.c @@ -38,8 +38,8 @@ log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput; void platform_log_push(log_output* output, log_level level, - str8 function, str8 file, + str8 function, int line, const char* fmt, va_list ap) -- 2.25.1 From c6e197527e2953d5f6cd42839139a124ae9258f9 Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Thu, 10 Aug 2023 11:34:44 -0700 Subject: [PATCH 3/3] add error logs to mg_image_create_* --- src/graphics/graphics_common.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/graphics/graphics_common.c b/src/graphics/graphics_common.c index b8b1c93..99f146a 100644 --- a/src/graphics/graphics_common.c +++ b/src/graphics/graphics_common.c @@ -1607,6 +1607,10 @@ mg_image mg_image_create_from_data(mg_surface surface, str8 data, bool flip) image = mg_image_create_from_rgba8(surface, width, height, pixels); free(pixels); } + else + { + log_error("stbi_load_from_memory() failed: %s\n", stbi_failure_reason()); + } return(image); } @@ -1626,6 +1630,10 @@ mg_image mg_image_create_from_file(mg_surface surface, str8 path, bool flip) image = mg_image_create_from_rgba8(surface, width, height, pixels); free(pixels); } + else + { + log_error("stbi_load() failed: %s\n", stbi_failure_reason()); + } return(image); } -- 2.25.1