瀏覽代碼

Add MINI_URHO guards to Context for SDL init / uninit. No-op when MINI_URHO defined. Minor code style edits.

Lasse Öörni 9 年之前
父節點
當前提交
be9257a3fd
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      Source/Urho3D/Core/Context.cpp

+ 9 - 5
Source/Urho3D/Core/Context.cpp

@@ -28,7 +28,9 @@
 
 
 #include "../DebugNew.h"
 #include "../DebugNew.h"
 
 
+#ifndef MINI_URHO
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
+#endif
 
 
 namespace Urho3D
 namespace Urho3D
 {
 {
@@ -217,9 +219,10 @@ VariantMap& Context::GetEventDataMap()
 
 
 bool Context::RequireSDL(unsigned int sdlFlags)
 bool Context::RequireSDL(unsigned int sdlFlags)
 {
 {
+#ifndef MINI_URHO
     // Always increment, the caller must match with ReleaseSDL(), regardless of
     // Always increment, the caller must match with ReleaseSDL(), regardless of
     // what happens.
     // what happens.
-    sdlInitCounter++;
+    ++sdlInitCounter;
 
 
     // Need to call SDL_Init() at least once before SDL_InitSubsystem()
     // Need to call SDL_Init() at least once before SDL_InitSubsystem()
     if (sdlInitCounter == 0)
     if (sdlInitCounter == 0)
@@ -241,13 +244,15 @@ bool Context::RequireSDL(unsigned int sdlFlags)
             return false;
             return false;
         }
         }
     }
     }
+#endif
 
 
     return true;
     return true;
 }
 }
 
 
 void Context::ReleaseSDL()
 void Context::ReleaseSDL()
 {
 {
-    sdlInitCounter--;
+#ifndef MINI_URHO
+    --sdlInitCounter;
 
 
     if (sdlInitCounter == 0)
     if (sdlInitCounter == 0)
     {
     {
@@ -257,9 +262,8 @@ void Context::ReleaseSDL()
     }
     }
 
 
     if (sdlInitCounter < 0)
     if (sdlInitCounter < 0)
-    {
-        URHO3D_LOGERRORF("Too many calls to Context::ReleaseSDL()!");
-    }
+        URHO3D_LOGERROR("Too many calls to Context::ReleaseSDL()!");
+#endif
 }
 }
 
 
 void Context::CopyBaseAttributes(StringHash baseType, StringHash derivedType)
 void Context::CopyBaseAttributes(StringHash baseType, StringHash derivedType)