Selaa lähdekoodia

+ added error reporting for SDL initialization

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 6 vuotta sitten
vanhempi
commit
98e245b4cb
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      main.cpp

+ 3 - 1
main.cpp

@@ -150,7 +150,9 @@ int main (int argc, char* argv[])
 
         if (SDL_Init (SDL_INIT_AUDIO) < 0 || mixer_flags != Mix_Init (mixer_flags))
         {
-            IrrlichtContext->getDevice ()->getLogger ()->log ("Cannot initialize SDL audio system", irr::ELL_ERROR);
+            // Mix_GetError is an alias for SDL_GetError, so calling it directly will yield the correct result
+            // it doesn't matter if SDL_Init or Mix_Init failed, both report the errors through the same functions
+            IrrlichtContext->getDevice ()->getLogger ()->log ("Cannot initialize SDL audio system", SDL_GetError(),irr::ELL_ERROR);
             return 2;
         }