fixed clearing touch buttons in off-screen areas on Android
authorHolger Schemel <info@artsoft.org>
Sun, 19 Jan 2025 18:34:50 +0000 (19:34 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 19 Jan 2025 18:34:52 +0000 (19:34 +0100)
src/libgame/sdl.c

index e9a44036ba416db3fb2f4e8e09725f88d4dd70ca..654616714436b20571e914305fb78f699d39ba8e 100644 (file)
@@ -205,13 +205,20 @@ static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
   }
 #endif
 
+#if defined(PLATFORM_ANDROID)
+  // clear render target (complete window on Android to clear off-screen areas with touch buttons)
+  SDL_RenderClear(sdl_renderer);
+#endif
+
   // set renderer to use target texture for rendering
   if (video.screen_rendering_mode == SPECIAL_RENDERING_TARGET ||
       video.screen_rendering_mode == SPECIAL_RENDERING_DOUBLE)
     SDL_SetRenderTarget(sdl_renderer, sdl_texture_target);
 
-  // clear render target buffer
+#if !defined(PLATFORM_ANDROID)
+  // clear render target (target texture only to prevent black flickering when using Metal on Mac)
   SDL_RenderClear(sdl_renderer);
+#endif
 
   // copy backbuffer texture to render target buffer
   if (video.screen_rendering_mode != SPECIAL_RENDERING_TARGET)