mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Some improvements to the cursor logic in SystemView.
This commit is contained in:
parent
0f8cb1d2a1
commit
24a10a7807
|
@ -25,6 +25,7 @@ SystemView::SystemView()
|
|||
: mRenderer {Renderer::getInstance()}
|
||||
, mPrimary {nullptr}
|
||||
, mPrimaryType {PrimaryType::CAROUSEL}
|
||||
, mLastCursor {-1}
|
||||
, mCamOffset {0.0f}
|
||||
, mFadeOpacity {0.0f}
|
||||
, mPreviousScrollVelocity {0}
|
||||
|
@ -137,8 +138,10 @@ void SystemView::update(int deltaTime)
|
|||
|
||||
mPrimary->update(deltaTime);
|
||||
|
||||
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents)
|
||||
video->update(deltaTime);
|
||||
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents) {
|
||||
if (!isScrolling())
|
||||
video->update(deltaTime);
|
||||
}
|
||||
|
||||
for (auto& anim : mSystemElements[mPrimary->getCursor()].lottieAnimComponents)
|
||||
anim->update(deltaTime);
|
||||
|
@ -213,6 +216,12 @@ void SystemView::onCursorChanged(const CursorState& state)
|
|||
{
|
||||
int cursor {mPrimary->getCursor()};
|
||||
|
||||
// Avoid double updates.
|
||||
if (cursor == mLastCursor)
|
||||
return;
|
||||
|
||||
mLastCursor = cursor;
|
||||
|
||||
for (auto& selector : mSystemElements[cursor].gameSelectors) {
|
||||
if (selector->getGameSelection() == GameSelectorComponent::GameSelection::RANDOM)
|
||||
selector->setNeedsRefresh();
|
||||
|
|
|
@ -122,6 +122,7 @@ private:
|
|||
std::vector<SystemViewElements> mSystemElements;
|
||||
PrimaryComponent<SystemData*>* mPrimary;
|
||||
PrimaryType mPrimaryType;
|
||||
int mLastCursor;
|
||||
|
||||
// Dummy entry to keep the default SVG rating images in the texture cache so they don't
|
||||
// need to be re-rasterized for each gamelist that is loaded.
|
||||
|
|
|
@ -491,8 +491,11 @@ template <typename T> bool CarouselComponent<T>::input(InputConfig* config, Inpu
|
|||
}
|
||||
else {
|
||||
if (config->isMappedLike("up", input) || config->isMappedLike("down", input) ||
|
||||
config->isMappedLike("left", input) || config->isMappedLike("right", input))
|
||||
config->isMappedLike("left", input) || config->isMappedLike("right", input)) {
|
||||
if (isScrolling())
|
||||
onCursorChanged(CursorState::CURSOR_STOPPED);
|
||||
List::listInput(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -268,10 +268,14 @@ template <typename T> bool TextListComponent<T>::input(InputConfig* config, Inpu
|
|||
config->isMappedLike("rightshoulder", input) ||
|
||||
config->isMappedLike("lefttrigger", input) ||
|
||||
config->isMappedLike("righttrigger", input)) {
|
||||
if constexpr (std::is_same_v<T, SystemData*>)
|
||||
if constexpr (std::is_same_v<T, SystemData*>) {
|
||||
if (isScrolling())
|
||||
onCursorChanged(CursorState::CURSOR_STOPPED);
|
||||
List::listInput(0);
|
||||
else
|
||||
}
|
||||
else {
|
||||
List::stopScrolling();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue