Add better glfw debug error reporting

This commit is contained in:
rexy712 2020-09-29 10:35:02 -07:00
parent 8758be4379
commit cf33a851e4

View File

@ -23,6 +23,12 @@
namespace gfx{ namespace gfx{
#ifdef OUR_DICK_ENABLE_DEBUG_OUTPUT
static void our_dick_glfw_error_callback(int code, const char* description){
debug_print_error("%d: %s\n", code, description);
}
#endif
glfw_system::glfw_system(){ glfw_system::glfw_system(){
try_init(); try_init();
} }
@ -34,9 +40,10 @@ namespace gfx{
} }
void glfw_system::try_init()const{ void glfw_system::try_init()const{
#ifdef OUR_DICK_ENABLE_DEBUG_OUTPUT
glfwSetErrorCallback(our_dick_glfw_error_callback);
#endif
s_status = glfwInit(); s_status = glfwInit();
if(s_status == GLFW_FALSE)
debug_print_error("Failed to initialize glfw\n");
} }
glfw_system& glfw_system::instance(){ glfw_system& glfw_system::instance(){
static glfw_system inst; static glfw_system inst;