Merge pull request #8975 from furo321/android-save-minimized

Save the config file when the app is minimized on Android
This commit is contained in:
Robert Müller 2024-09-18 10:29:09 +00:00 committed by GitHub
commit 255694c061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -80,6 +80,7 @@ void CInput::Init()
m_pGraphics = Kernel()->RequestInterface<IEngineGraphics>(); m_pGraphics = Kernel()->RequestInterface<IEngineGraphics>();
m_pConsole = Kernel()->RequestInterface<IConsole>(); m_pConsole = Kernel()->RequestInterface<IConsole>();
m_pConfigManager = Kernel()->RequestInterface<IConfigManager>();
MouseModeRelative(); MouseModeRelative();
@ -824,6 +825,9 @@ int CInput::Update()
} }
break; break;
case SDL_WINDOWEVENT_MINIMIZED: case SDL_WINDOWEVENT_MINIMIZED:
#if defined(CONF_PLATFORM_ANDROID) // Save the config when minimized on Android.
m_pConfigManager->Save();
#endif
Graphics()->WindowDestroyNtf(Event.window.windowID); Graphics()->WindowDestroyNtf(Event.window.windowID);
break; break;

View file

@ -14,6 +14,7 @@
#include <vector> #include <vector>
class IEngineGraphics; class IEngineGraphics;
class IConfigManager;
class CInput : public IEngineInput class CInput : public IEngineInput
{ {
@ -59,6 +60,7 @@ public:
private: private:
IEngineGraphics *m_pGraphics; IEngineGraphics *m_pGraphics;
IConsole *m_pConsole; IConsole *m_pConsole;
IConfigManager *m_pConfigManager;
IEngineGraphics *Graphics() const { return m_pGraphics; } IEngineGraphics *Graphics() const { return m_pGraphics; }
IConsole *Console() const { return m_pConsole; } IConsole *Console() const { return m_pConsole; }