Grid View Fixes

Fix for metadata disappearing when selecting system for the first time.
Fix for video not resuming after launching game.
This commit is contained in:
John Rassa 2020-02-28 21:19:52 -05:00
parent c9b3f5b646
commit c114ef05ac
3 changed files with 30 additions and 0 deletions

View file

@ -235,6 +235,8 @@ void ViewController::launch(FileData* game, Vector3f center)
game->launchGame(mWindow);
setAnimation(new LambdaAnimation(fadeFunc, 800), 0, [this] { mLockInput = false; }, true);
this->onFileChanged(game, FILE_METADATA_CHANGED);
if (mCurrentView)
mCurrentView->onShow();
});
} else if (transition_style == "slide"){
// move camera to zoom in on center + fade out, launch game, come back in
@ -244,6 +246,8 @@ void ViewController::launch(FileData* game, Vector3f center)
mCamera = origCamera;
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), 0, [this] { mLockInput = false; }, true);
this->onFileChanged(game, FILE_METADATA_CHANGED);
if (mCurrentView)
mCurrentView->onShow();
});
} else { // instant
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, [this, origCamera, center, game]
@ -252,6 +256,8 @@ void ViewController::launch(FileData* game, Vector3f center)
mCamera = origCamera;
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, [this] { mLockInput = false; }, true);
this->onFileChanged(game, FILE_METADATA_CHANGED);
if (mCurrentView)
mCurrentView->onShow();
});
}
}

View file

@ -115,6 +115,11 @@ GridGameListView::GridGameListView(Window* window, FileData* root) :
updateInfoPanel();
}
GridGameListView::~GridGameListView()
{
delete mVideo;
}
FileData* GridGameListView::getCursor()
{
return mGrid.getSelected();
@ -219,7 +224,10 @@ void GridGameListView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
mDescription.setSize(mDescContainer.getSize().x(), 0);
mDescription.applyTheme(theme, getName(), "md_description", ALL ^ (POSITION | ThemeFlags::SIZE | ThemeFlags::ORIGIN | TEXT | ROTATION));
// Repopulate list in case new theme is displaying a different image. Preserve selection.
FileData* file = mGrid.getSelected();
populateList(mRoot->getChildrenListToDisplay());
mGrid.setCursor(file);
sortChildren();
}
@ -474,3 +482,15 @@ std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
}
return prompts;
}
void GridGameListView::update(int deltaTime)
{
ISimpleGameListView::update(deltaTime);
mVideo->update(deltaTime);
}
void GridGameListView::onShow()
{
GuiComponent::onShow();
updateInfoPanel();
}

View file

@ -13,6 +13,9 @@ class GridGameListView : public ISimpleGameListView
{
public:
GridGameListView(Window* window, FileData* root);
virtual ~GridGameListView();
virtual void onShow() override;
virtual void onThemeChanged(const std::shared_ptr<ThemeData>& theme) override;
@ -27,6 +30,7 @@ public:
virtual void launch(FileData* game) override;
protected:
virtual void update(int deltaTime) override;
virtual std::string getQuickSystemSelectRightButton() override;
virtual std::string getQuickSystemSelectLeftButton() override;
virtual void populateList(const std::vector<FileData*>& files) override;