Browse Source

Refactor to handle graphics restore similarly between iOS and Android.

Yao Wei Tjong 姚伟忠 9 years ago
parent
commit
fba647f7f8
1 changed files with 5 additions and 12 deletions
  1. 5 12
      Source/Urho3D/Input/Input.cpp

+ 5 - 12
Source/Urho3D/Input/Input.cpp

@@ -1938,22 +1938,15 @@ void Input::HandleSDLEvent(void* sdlEvent)
 
             case SDL_WINDOWEVENT_MAXIMIZED:
             case SDL_WINDOWEVENT_RESTORED:
-                minimized_ = false;
-                SendInputFocusEvent();
-#ifdef IOS
-                // On iOS we never lose the GL context, but may have done GPU object changes that could not be applied yet.
-                // Apply them now
+#if defined(IOS) || defined (ANDROID)
+                // On iOS we never lose the GL context, but may have done GPU object changes that could not be applied yet. Apply them now
+                // On Android the old GL context may be lost already, restore GPU objects to the new GL context
                 graphics_->Restore();
 #endif
+                minimized_ = false;
+                SendInputFocusEvent();
                 break;
 
-#ifdef ANDROID
-            case SDL_WINDOWEVENT_FOCUS_GAINED:
-                // Restore GPU objects to the new GL context
-                graphics_->Restore();
-                break;
-#endif
-
             case SDL_WINDOWEVENT_RESIZED:
                 inResize_ = true;
                 graphics_->WindowResized();