mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 10:31:16 +00:00
Add isle:Active in Background config option (#756)
This keeps isle running in the background, useful for multitaskers.
This commit is contained in:
parent
7525bf0fcd
commit
527c308e28
@ -205,6 +205,7 @@ IsleApp::IsleApp()
|
|||||||
m_exclusiveFullScreen = FALSE;
|
m_exclusiveFullScreen = FALSE;
|
||||||
m_msaaSamples = 0;
|
m_msaaSamples = 0;
|
||||||
m_anisotropic = 16.0f;
|
m_anisotropic = 16.0f;
|
||||||
|
m_activeInBackground = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: ISLE 0x4011a0
|
// FUNCTION: ISLE 0x4011a0
|
||||||
@ -504,11 +505,13 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
case SDL_EVENT_WINDOW_FOCUS_GAINED:
|
||||||
g_isle->SetWindowActive(TRUE);
|
if (!g_isle->GetActiveInBackground()) {
|
||||||
Lego()->Resume();
|
g_isle->SetWindowActive(TRUE);
|
||||||
|
Lego()->Resume();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
case SDL_EVENT_WINDOW_FOCUS_LOST:
|
||||||
if (g_isle->GetGameStarted()) {
|
if (!g_isle->GetActiveInBackground() && g_isle->GetGameStarted()) {
|
||||||
g_isle->SetWindowActive(FALSE);
|
g_isle->SetWindowActive(FALSE);
|
||||||
Lego()->Pause();
|
Lego()->Pause();
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
@ -1143,6 +1146,7 @@ bool IsleApp::LoadConfig()
|
|||||||
iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
|
iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
|
||||||
iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10));
|
iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10));
|
||||||
iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10));
|
iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10));
|
||||||
|
iniparser_set(dict, "isle:Active in background", m_activeInBackground ? "true" : "false");
|
||||||
|
|
||||||
#ifdef EXTENSIONS
|
#ifdef EXTENSIONS
|
||||||
iniparser_set(dict, "extensions", NULL);
|
iniparser_set(dict, "extensions", NULL);
|
||||||
@ -1227,6 +1231,7 @@ bool IsleApp::LoadConfig()
|
|||||||
m_frameDelta = static_cast<int>(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)));
|
m_frameDelta = static_cast<int>(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)));
|
||||||
m_videoParam.SetMSAASamples((m_msaaSamples = iniparser_getint(dict, "isle:MSAA", m_msaaSamples)));
|
m_videoParam.SetMSAASamples((m_msaaSamples = iniparser_getint(dict, "isle:MSAA", m_msaaSamples)));
|
||||||
m_videoParam.SetAnisotropic((m_anisotropic = iniparser_getdouble(dict, "isle:Anisotropic", m_anisotropic)));
|
m_videoParam.SetAnisotropic((m_anisotropic = iniparser_getdouble(dict, "isle:Anisotropic", m_anisotropic)));
|
||||||
|
m_activeInBackground = iniparser_getboolean(dict, "isle:Active in Background", m_activeInBackground);
|
||||||
|
|
||||||
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
|
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
|
||||||
if (deviceId != NULL) {
|
if (deviceId != NULL) {
|
||||||
|
|||||||
@ -56,6 +56,7 @@ class IsleApp {
|
|||||||
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
||||||
LegoInputManager::TouchScheme GetTouchScheme() { return m_touchScheme; }
|
LegoInputManager::TouchScheme GetTouchScheme() { return m_touchScheme; }
|
||||||
MxBool GetHaptic() { return m_haptic; }
|
MxBool GetHaptic() { return m_haptic; }
|
||||||
|
MxBool GetActiveInBackground() { return m_activeInBackground; }
|
||||||
|
|
||||||
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; }
|
||||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||||
@ -117,6 +118,7 @@ class IsleApp {
|
|||||||
MxBool m_exclusiveFullScreen;
|
MxBool m_exclusiveFullScreen;
|
||||||
MxU32 m_msaaSamples;
|
MxU32 m_msaaSamples;
|
||||||
MxFloat m_anisotropic;
|
MxFloat m_anisotropic;
|
||||||
|
MxBool m_activeInBackground;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern IsleApp* g_isle;
|
extern IsleApp* g_isle;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user