]> git.lizzy.rs Git - irrlicht.git/commitdiff
Fix SDL device to work with null driver
authorsfan5 <sfan5@live.de>
Sat, 15 Oct 2022 09:12:54 +0000 (11:12 +0200)
committersfan5 <sfan5@live.de>
Sat, 15 Oct 2022 09:13:20 +0000 (11:13 +0200)
source/Irrlicht/CIrrDeviceSDL.cpp

index 331c8e593d789e21561bf93738ba5fefbd7d4afd..ea309688892328e714311ddb5b483e5d9657b55b 100644 (file)
@@ -119,13 +119,13 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
 \r
        if ( ++SDLDeviceInstances == 1 )\r
        {\r
-               // Initialize SDL... Timer for sleep, video for the obvious, and\r
-               // noparachute prevents SDL from catching fatal errors.\r
-               if (SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO|\r
+               u32 flags = SDL_INIT_TIMER | SDL_INIT_EVENTS;\r
+               if (CreationParams.DriverType != video::EDT_NULL)\r
+                       flags |= SDL_INIT_VIDEO;\r
 #if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)\r
-                                       SDL_INIT_JOYSTICK|\r
+               flags |= SDL_INIT_JOYSTICK;\r
 #endif\r
-                                       SDL_INIT_NOPARACHUTE ) < 0)\r
+               if (SDL_Init(flags) < 0)\r
                {\r
                        os::Printer::log( "Unable to initialize SDL!", SDL_GetError());\r
                        Close = true;\r