mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-27 08:35:39 +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);
|
setCursor(system);
|
||||||
|
|
||||||
|
if(!animate)
|
||||||
|
finishAnimation(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemView::input(InputConfig* config, Input input)
|
bool SystemView::input(InputConfig* config, Input input)
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SystemView : public IList<SystemViewData, SystemData*>
|
||||||
public:
|
public:
|
||||||
SystemView(Window* window);
|
SystemView(Window* window);
|
||||||
|
|
||||||
void goToSystem(SystemData* system);
|
void goToSystem(SystemData* system, bool animate);
|
||||||
|
|
||||||
bool input(InputConfig* config, Input input) override;
|
bool input(InputConfig* config, Input input) override;
|
||||||
void update(int deltaTime) override;
|
void update(int deltaTime) override;
|
||||||
|
|
|
@ -27,13 +27,23 @@ void ViewController::goToStart()
|
||||||
goToSystemView(SystemData::sSystemVector.at(0));
|
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)
|
void ViewController::goToSystemView(SystemData* system)
|
||||||
{
|
{
|
||||||
mState.viewing = SYSTEM_SELECT;
|
mState.viewing = SYSTEM_SELECT;
|
||||||
mState.system = system;
|
mState.system = system;
|
||||||
|
|
||||||
getSystemListView()->goToSystem(system);
|
auto systemList = getSystemListView();
|
||||||
mCurrentView = getSystemListView();
|
systemList->setPosition(getSystemId(system) * (float)Renderer::getScreenWidth(), systemList->getPosition().y());
|
||||||
|
|
||||||
|
systemList->goToSystem(system, false);
|
||||||
|
mCurrentView = systemList;
|
||||||
|
|
||||||
updateHelpPrompts();
|
updateHelpPrompts();
|
||||||
playViewTransition();
|
playViewTransition();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +66,17 @@ void ViewController::goToPrevGameList()
|
||||||
|
|
||||||
void ViewController::goToGameList(SystemData* system)
|
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.viewing = GAME_LIST;
|
||||||
mState.system = system;
|
mState.system = system;
|
||||||
|
|
||||||
|
@ -310,7 +331,7 @@ void ViewController::reloadAll()
|
||||||
mCurrentView = getGameListView(mState.getSystem());
|
mCurrentView = getGameListView(mState.getSystem());
|
||||||
}else if(mState.viewing == SYSTEM_SELECT)
|
}else if(mState.viewing == SYSTEM_SELECT)
|
||||||
{
|
{
|
||||||
mSystemListView->goToSystem(mState.getSystem());
|
mSystemListView->goToSystem(mState.getSystem(), false);
|
||||||
mCurrentView = mSystemListView;
|
mCurrentView = mSystemListView;
|
||||||
}else{
|
}else{
|
||||||
goToSystemView(SystemData::sSystemVector.front());
|
goToSystemView(SystemData::sSystemVector.front());
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void playViewTransition();
|
void playViewTransition();
|
||||||
|
int getSystemId(SystemData* system);
|
||||||
|
|
||||||
std::shared_ptr<IGameListView> getGameListView(SystemData* system);
|
std::shared_ptr<IGameListView> getGameListView(SystemData* system);
|
||||||
std::shared_ptr<SystemView> getSystemListView();
|
std::shared_ptr<SystemView> getSystemListView();
|
||||||
|
|
Loading…
Reference in a new issue