mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 06:35:38 +00:00
Improved "slide" transition.
Still not happy with the implementation, it's not a true carousel like the SystemList.
This commit is contained in:
parent
fd5508a749
commit
cf8801701a
|
@ -79,9 +79,12 @@ void SystemView::populate()
|
|||
}
|
||||
}
|
||||
|
||||
void SystemView::goToSystem(SystemData* system)
|
||||
void SystemView::goToSystem(SystemData* system, bool animate)
|
||||
{
|
||||
setCursor(system);
|
||||
|
||||
if(!animate)
|
||||
finishAnimation(0);
|
||||
}
|
||||
|
||||
bool SystemView::input(InputConfig* config, Input input)
|
||||
|
|
|
@ -22,7 +22,7 @@ class SystemView : public IList<SystemViewData, SystemData*>
|
|||
public:
|
||||
SystemView(Window* window);
|
||||
|
||||
void goToSystem(SystemData* system);
|
||||
void goToSystem(SystemData* system, bool animate);
|
||||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
void update(int deltaTime) override;
|
||||
|
|
|
@ -27,13 +27,23 @@ void ViewController::goToStart()
|
|||
goToSystemView(SystemData::sSystemVector.at(0));
|
||||
}
|
||||
|
||||
int ViewController::getSystemId(SystemData* system)
|
||||
{
|
||||
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
||||
return std::find(sysVec.begin(), sysVec.end(), system) - sysVec.begin();
|
||||
}
|
||||
|
||||
void ViewController::goToSystemView(SystemData* system)
|
||||
{
|
||||
mState.viewing = SYSTEM_SELECT;
|
||||
mState.system = system;
|
||||
|
||||
getSystemListView()->goToSystem(system);
|
||||
mCurrentView = getSystemListView();
|
||||
auto systemList = getSystemListView();
|
||||
systemList->setPosition(getSystemId(system) * (float)Renderer::getScreenWidth(), systemList->getPosition().y());
|
||||
|
||||
systemList->goToSystem(system, false);
|
||||
mCurrentView = systemList;
|
||||
|
||||
updateHelpPrompts();
|
||||
playViewTransition();
|
||||
}
|
||||
|
@ -56,6 +66,17 @@ void ViewController::goToPrevGameList()
|
|||
|
||||
void ViewController::goToGameList(SystemData* system)
|
||||
{
|
||||
if(mState.viewing == SYSTEM_SELECT)
|
||||
{
|
||||
// move system list
|
||||
auto sysList = getSystemListView();
|
||||
float offX = sysList->getPosition().x();
|
||||
int sysId = getSystemId(system);
|
||||
sysList->setPosition(sysId * (float)Renderer::getScreenWidth(), sysList->getPosition().y());
|
||||
offX = sysList->getPosition().x() - offX;
|
||||
mCamera.translation().x() -= offX;
|
||||
}
|
||||
|
||||
mState.viewing = GAME_LIST;
|
||||
mState.system = system;
|
||||
|
||||
|
@ -310,7 +331,7 @@ void ViewController::reloadAll()
|
|||
mCurrentView = getGameListView(mState.getSystem());
|
||||
}else if(mState.viewing == SYSTEM_SELECT)
|
||||
{
|
||||
mSystemListView->goToSystem(mState.getSystem());
|
||||
mSystemListView->goToSystem(mState.getSystem(), false);
|
||||
mCurrentView = mSystemListView;
|
||||
}else{
|
||||
goToSystemView(SystemData::sSystemVector.front());
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
|
||||
private:
|
||||
void playViewTransition();
|
||||
int getSystemId(SystemData* system);
|
||||
|
||||
std::shared_ptr<IGameListView> getGameListView(SystemData* system);
|
||||
std::shared_ptr<SystemView> getSystemListView();
|
||||
|
|
Loading…
Reference in a new issue