adwadwa
[vg.git] / vg.h
diff --git a/vg.h b/vg.h
index eb858a38b33017d7fc20b5e457c91802d8c41b00..64b6f6fc16dcf3c797d93c357cef6d5d4dd6f526 100644 (file)
--- a/vg.h
+++ b/vg.h
@@ -635,8 +635,7 @@ VG_STATIC void _vg_init_window( const char *window_name )
 {
    vg_info( "SDL_INIT\n" );
 
-   if( SDL_Init( SDL_INIT_VIDEO ) != 0  )
-   {
+   if( SDL_Init( SDL_INIT_VIDEO ) != 0  ){
       vg_error( "SDL_Init failed: %s\n", SDL_GetError() );
       exit(0);
    }
@@ -664,8 +663,7 @@ VG_STATIC void _vg_init_window( const char *window_name )
     */
    vg_info( "Getting display count\n" );
    int display_count = 0, display_index = 0, mode_index = 0;
-   if( (display_count = SDL_GetNumVideoDisplays()) < 1 )
-   {
+   if( (display_count = SDL_GetNumVideoDisplays()) < 1 ){
       vg_error( "SDL_GetNumVideoDisplays returned: %i\n", display_count );
       exit(0);
    }
@@ -820,22 +818,8 @@ VG_STATIC void vg_enter( int argc, char *argv[], const char *window_name )
    SDL_Quit();
 }
 
-/*
- * Immediately transfer away from calling thread into a safe loop, signal for 
- * others to shutdown, then free everything once the user closes the window.
- *
- * FIXME(bug): glfwWindowShouldClose() never returns 1 in windows via wine, ONLY
- *             when calling the program from outside its normal directory.
- */
-VG_STATIC void vg_fatal_exit_loop( const char *error )
+void vg_print_backtrace(void)
 {
-   /* 
-    *    https://www.gnu.org/software/libc/manual/html_node/Backtraces.html
-    *    thanks gnu <3
-    *
-    *    TODO: this on windows?
-    */
-
 #ifndef _WIN32
 
    void *array[20];
@@ -858,7 +842,25 @@ VG_STATIC void vg_fatal_exit_loop( const char *error )
    free( strings );
 
 #endif
+}
+
+/*
+ * Immediately transfer away from calling thread into a safe loop, signal for 
+ * others to shutdown, then free everything once the user closes the window.
+ *
+ * FIXME(bug): glfwWindowShouldClose() never returns 1 in windows via wine, ONLY
+ *             when calling the program from outside its normal directory.
+ */
+VG_STATIC void vg_fatal_exit_loop( const char *error )
+{
+   /* 
+    *    https://www.gnu.org/software/libc/manual/html_node/Backtraces.html
+    *    thanks gnu <3
+    *
+    *    TODO: this on windows?
+    */
 
+   vg_print_backtrace();
    vg_error( "Fatal error: %s\n", error );
 
    SDL_AtomicLock( &vg.sl_context );