minor bugfixes #38

Merged
MartinFouilleul merged 3 commits from minor_bugfixes into codebase_restructuring 2023-08-11 08:55:23 +00:00
5 changed files with 16 additions and 8 deletions

View File

@ -74,15 +74,15 @@ ORCA_EXPORT void OnInit(void)
if(mg_image_is_nil(waterImage)) 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)) 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)) 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")); str8 fontStr = loadFile(mem_scratch(), STR8("/Literata-SemiBoldItalic.ttf"));

View File

@ -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); image = mg_image_create_from_rgba8(surface, width, height, pixels);
free(pixels); free(pixels);
} }
else
{
log_error("stbi_load_from_memory() failed: %s\n", stbi_failure_reason());
}
return(image); 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); image = mg_image_create_from_rgba8(surface, width, height, pixels);
free(pixels); free(pixels);
} }
else
{
log_error("stbi_load() failed: %s\n", stbi_failure_reason());
}
return(image); return(image);
} }

View File

@ -51,8 +51,8 @@ char* log_stbsp_callback(char const* buf, void* user, int len)
void platform_log_push(log_output* output, void platform_log_push(log_output* output,
log_level level, log_level level,
str8 function,
str8 file, str8 file,
str8 function,
int line, int line,
const char* fmt, const char* fmt,
va_list ap) va_list ap)
@ -68,7 +68,7 @@ void platform_log_push(log_output* output,
str8 string = str8_list_join(scratch, ctx.list); 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); mem_arena_scope_end(tmp);
} }

View File

@ -28,8 +28,8 @@ void log_set_level(log_level level)
void platform_log_push(log_output* output, void platform_log_push(log_output* output,
log_level level, log_level level,
str8 function,
str8 file, str8 file,
str8 function,
int line, int line,
const char* fmt, const char* fmt,
va_list ap); va_list ap);
@ -50,7 +50,7 @@ void log_push(log_level level,
{ {
va_list ap; va_list ap;
va_start(ap, fmt); 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); va_end(ap);
} }
} }

View File

@ -38,8 +38,8 @@ log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput;
void platform_log_push(log_output* output, void platform_log_push(log_output* output,
log_level level, log_level level,
str8 function,
str8 file, str8 file,
str8 function,
int line, int line,
const char* fmt, const char* fmt,
va_list ap) va_list ap)