mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-07 05:15:05 +00:00
GUI: commit state on Android when entering bg
This commit is contained in:
parent
be781ef8d4
commit
700b32c3ab
2 changed files with 13 additions and 7 deletions
|
@ -2652,7 +2652,8 @@ int _processEvent(void* instance, SDL_Event* event) {
|
||||||
int FurnaceGUI::processEvent(SDL_Event* ev) {
|
int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
#ifdef IS_MOBILE
|
#ifdef IS_MOBILE
|
||||||
if (ev->type==SDL_APP_WILLENTERBACKGROUND) {
|
if (ev->type==SDL_APP_WILLENTERBACKGROUND) {
|
||||||
// TODO: save "last state" and potentially suspend engine
|
commitState();
|
||||||
|
e->saveConf();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ev->type==SDL_KEYDOWN) {
|
if (ev->type==SDL_KEYDOWN) {
|
||||||
|
@ -5337,15 +5338,10 @@ bool FurnaceGUI::init() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceGUI::finish() {
|
void FurnaceGUI::commitState() {
|
||||||
if (!mobileUI) {
|
if (!mobileUI) {
|
||||||
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
ImGui::SaveIniSettingsToDisk(finalLayoutPath);
|
||||||
}
|
}
|
||||||
ImGui_ImplSDLRenderer_Shutdown();
|
|
||||||
ImGui_ImplSDL2_Shutdown();
|
|
||||||
ImGui::DestroyContext();
|
|
||||||
SDL_DestroyRenderer(sdlRend);
|
|
||||||
SDL_DestroyWindow(sdlWin);
|
|
||||||
|
|
||||||
e->setConf("configVersion",(int)DIV_ENGINE_VERSION);
|
e->setConf("configVersion",(int)DIV_ENGINE_VERSION);
|
||||||
|
|
||||||
|
@ -5459,6 +5455,15 @@ bool FurnaceGUI::finish() {
|
||||||
e->setConf(key,recentFile[i]);
|
e->setConf(key,recentFile[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FurnaceGUI::finish() {
|
||||||
|
commitState();
|
||||||
|
ImGui_ImplSDLRenderer_Shutdown();
|
||||||
|
ImGui_ImplSDL2_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
SDL_DestroyRenderer(sdlRend);
|
||||||
|
SDL_DestroyWindow(sdlWin);
|
||||||
|
|
||||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||||
delete oldPat[i];
|
delete oldPat[i];
|
||||||
|
|
|
@ -1746,6 +1746,7 @@ class FurnaceGUI {
|
||||||
|
|
||||||
void syncSettings();
|
void syncSettings();
|
||||||
void commitSettings();
|
void commitSettings();
|
||||||
|
void commitState();
|
||||||
void processDrags(int dragX, int dragY);
|
void processDrags(int dragX, int dragY);
|
||||||
void processPoint(SDL_Event& ev);
|
void processPoint(SDL_Event& ev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue