Save the config file when the app is minimized on Android

This commit is contained in:
furo 2024-09-18 12:10:25 +02:00
parent 217103a0ee
commit a266cd2f70
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; }