Fixed an issue where the gamelist view would sometimes not render after changing collection settings.

Also fixed some other glitches with the cached background not getting invalidated on collection changes.
This commit is contained in:
Leon Styhre 2023-01-12 20:54:12 +01:00
parent 0329bd77c2
commit 918ffd9b9e
3 changed files with 16 additions and 0 deletions

View file

@ -89,6 +89,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
setNeedsSaving();
setNeedsReloading();
setNeedsCollectionsUpdate();
setInvalidateCachedBackground();
}
});
@ -144,6 +145,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
setNeedsReloading();
setNeedsCollectionsUpdate();
setNeedsGoToGroupedCollections();
setInvalidateCachedBackground();
}
}
});

View file

@ -137,6 +137,9 @@ void GuiSettings::save()
if (state.getSystem()->isCollection() &&
state.getSystem()->getThemeFolder() != "custom-collections") {
ViewController::getInstance()->goToStart(false);
ViewController::getInstance()->resetCamera();
SDL_Delay(100);
mWindow->invalidateCachedBackground();
ViewController::getInstance()->goToSystem(SystemData::sSystemVector.front(), false);
// We don't want to invalidate the cached background when there has been a collection
// systen change as that may show a black screen in some circumstances.
@ -147,8 +150,12 @@ void GuiSettings::save()
if (std::find(SystemData::sSystemVector.begin(), SystemData::sSystemVector.end(),
state.getSystem()) == SystemData::sSystemVector.end()) {
ViewController::getInstance()->goToStart(false);
ViewController::getInstance()->resetCamera();
SDL_Delay(100);
mWindow->invalidateCachedBackground();
return;
}
ViewController::getInstance()->resetCamera();
}
if (mInvalidateCachedBackground) {

View file

@ -65,6 +65,13 @@ public:
bool isCameraMoving();
void cancelViewTransitions();
void stopScrolling();
void resetCamera()
{
if (mCurrentView != nullptr) {
mCamera[3].x = -mCurrentView->getPosition().x;
mCamera[3].y = -mCurrentView->getPosition().y;
}
}
// Basic video controls.
void startViewVideos() override { mCurrentView->startViewVideos(); }