mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-31 04:25:40 +00:00
Added a simple static scroll indicator and set this as the default.
Also made some minor adjustments to the scroll indicator placement.
This commit is contained in:
parent
ca64fc8308
commit
76ef1629c0
|
@ -500,8 +500,8 @@ void GuiMetaDataEd::onSizeChanged()
|
||||||
mGrid.setRowHeightPerc(3, (titleSubtitleSpacing * 1.2f) / mSize.y);
|
mGrid.setRowHeightPerc(3, (titleSubtitleSpacing * 1.2f) / mSize.y);
|
||||||
mGrid.setRowHeightPerc(4, ((mList->getRowHeight(0) * 10.0f) + 2.0f) / mSize.y);
|
mGrid.setRowHeightPerc(4, ((mList->getRowHeight(0) * 10.0f) + 2.0f) / mSize.y);
|
||||||
|
|
||||||
mGrid.setColWidthPerc(0, 0.08f);
|
mGrid.setColWidthPerc(0, 0.07f);
|
||||||
mGrid.setColWidthPerc(2, 0.08f);
|
mGrid.setColWidthPerc(2, 0.07f);
|
||||||
|
|
||||||
mGrid.setSize(mSize);
|
mGrid.setSize(mSize);
|
||||||
mBackground.fitTo(mSize, glm::vec3{}, glm::vec2{-32.0f, -32.0f});
|
mBackground.fitTo(mSize, glm::vec3{}, glm::vec2{-32.0f, -32.0f});
|
||||||
|
|
|
@ -181,7 +181,7 @@ void Settings::setDefaults()
|
||||||
mBoolMap["SpecialCharsASCII"] = {false, false};
|
mBoolMap["SpecialCharsASCII"] = {false, false};
|
||||||
mBoolMap["ListScrollOverlay"] = {false, false};
|
mBoolMap["ListScrollOverlay"] = {false, false};
|
||||||
mBoolMap["VirtualKeyboard"] = {true, true};
|
mBoolMap["VirtualKeyboard"] = {true, true};
|
||||||
mBoolMap["ScrollIndicators"] = {true, true};
|
mBoolMap["ScrollIndicators"] = {false, false};
|
||||||
mBoolMap["FavoritesAddButton"] = {true, true};
|
mBoolMap["FavoritesAddButton"] = {true, true};
|
||||||
mBoolMap["RandomAddButton"] = {false, false};
|
mBoolMap["RandomAddButton"] = {false, false};
|
||||||
mBoolMap["GamelistFilters"] = {true, true};
|
mBoolMap["GamelistFilters"] = {true, true};
|
||||||
|
|
|
@ -127,8 +127,8 @@ void MenuComponent::onSizeChanged()
|
||||||
mGrid.setRowHeightPerc(1, TITLE_HEIGHT / mSize.y / 2.0f);
|
mGrid.setRowHeightPerc(1, TITLE_HEIGHT / mSize.y / 2.0f);
|
||||||
mGrid.setRowHeightPerc(3, getButtonGridHeight() / mSize.y);
|
mGrid.setRowHeightPerc(3, getButtonGridHeight() / mSize.y);
|
||||||
|
|
||||||
mGrid.setColWidthPerc(0, 0.08f);
|
mGrid.setColWidthPerc(0, 0.07f);
|
||||||
mGrid.setColWidthPerc(2, 0.08f);
|
mGrid.setColWidthPerc(2, 0.07f);
|
||||||
|
|
||||||
mGrid.setSize(mSize);
|
mGrid.setSize(mSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,105 +30,118 @@ public:
|
||||||
scrollUp->setOpacity(0);
|
scrollUp->setOpacity(0);
|
||||||
scrollDown->setOpacity(0);
|
scrollDown->setOpacity(0);
|
||||||
|
|
||||||
if (!Settings::getInstance()->getBool("ScrollIndicators"))
|
if (!Settings::getInstance()->getBool("ScrollIndicators")) {
|
||||||
return;
|
// If the scroll indicators setting is disabled, then show a permanent down arrow
|
||||||
|
// symbol when the component list contains more entries than can fit on screen.
|
||||||
|
componentList.get()->setScrollIndicatorChangedCallback(
|
||||||
|
[scrollUp, scrollDown](ComponentList::ScrollIndicator state) {
|
||||||
|
if (state == ComponentList::SCROLL_UP ||
|
||||||
|
state == ComponentList::SCROLL_UP_DOWN ||
|
||||||
|
state == ComponentList::SCROLL_DOWN) {
|
||||||
|
scrollDown->setOpacity(255);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If the scroll indicator setting is enabled, then also show the up and up/down
|
||||||
|
// combination and switch between these as the list is scrolled.
|
||||||
|
componentList.get()->setScrollIndicatorChangedCallback(
|
||||||
|
[this, scrollUp, scrollDown](ComponentList::ScrollIndicator state) {
|
||||||
|
float fadeInTime{FADE_IN_TIME};
|
||||||
|
|
||||||
componentList.get()->setScrollIndicatorChangedCallback(
|
bool upFadeIn = false;
|
||||||
[this, scrollUp, scrollDown](ComponentList::ScrollIndicator state) {
|
bool upFadeOut = false;
|
||||||
float fadeInTime{FADE_IN_TIME};
|
bool downFadeIn = false;
|
||||||
|
bool downFadeOut = false;
|
||||||
|
|
||||||
bool upFadeIn = false;
|
scrollUp->finishAnimation(0);
|
||||||
bool upFadeOut = false;
|
scrollDown->finishAnimation(0);
|
||||||
bool downFadeIn = false;
|
|
||||||
bool downFadeOut = false;
|
|
||||||
|
|
||||||
scrollUp->finishAnimation(0);
|
if (state == ComponentList::SCROLL_UP &&
|
||||||
scrollDown->finishAnimation(0);
|
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
||||||
|
scrollUp->setOpacity(255);
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_UP &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_UP_DOWN) {
|
||||||
|
downFadeOut = true;
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_UP &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_DOWN) {
|
||||||
|
upFadeIn = true;
|
||||||
|
fadeInTime *= 1.5f;
|
||||||
|
scrollDown->setOpacity(0);
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
||||||
|
scrollUp->setOpacity(255);
|
||||||
|
scrollDown->setOpacity(255);
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_DOWN) {
|
||||||
|
upFadeIn = true;
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_UP) {
|
||||||
|
downFadeIn = true;
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
||||||
|
scrollDown->setOpacity(255);
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_UP_DOWN) {
|
||||||
|
upFadeOut = true;
|
||||||
|
}
|
||||||
|
else if (state == ComponentList::SCROLL_DOWN &&
|
||||||
|
mPreviousScrollState == ComponentList::SCROLL_UP) {
|
||||||
|
downFadeIn = true;
|
||||||
|
fadeInTime *= 1.5f;
|
||||||
|
scrollUp->setOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (state == ComponentList::SCROLL_UP &&
|
if (upFadeIn) {
|
||||||
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
auto upFadeInFunc = [scrollUp](float t) {
|
||||||
scrollUp->setOpacity(255);
|
scrollUp->setOpacity(
|
||||||
}
|
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
||||||
else if (state == ComponentList::SCROLL_UP &&
|
};
|
||||||
mPreviousScrollState == ComponentList::SCROLL_UP_DOWN) {
|
scrollUp->setAnimation(
|
||||||
downFadeOut = true;
|
new LambdaAnimation(upFadeInFunc, static_cast<int>(fadeInTime)), 0,
|
||||||
}
|
nullptr, false);
|
||||||
else if (state == ComponentList::SCROLL_UP &&
|
}
|
||||||
mPreviousScrollState == ComponentList::SCROLL_DOWN) {
|
|
||||||
upFadeIn = true;
|
|
||||||
fadeInTime *= 1.5f;
|
|
||||||
scrollDown->setOpacity(0);
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
|
||||||
scrollUp->setOpacity(255);
|
|
||||||
scrollDown->setOpacity(255);
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_DOWN) {
|
|
||||||
upFadeIn = true;
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_UP_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_UP) {
|
|
||||||
downFadeIn = true;
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_NONE) {
|
|
||||||
scrollDown->setOpacity(255);
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_UP_DOWN) {
|
|
||||||
upFadeOut = true;
|
|
||||||
}
|
|
||||||
else if (state == ComponentList::SCROLL_DOWN &&
|
|
||||||
mPreviousScrollState == ComponentList::SCROLL_UP) {
|
|
||||||
downFadeIn = true;
|
|
||||||
fadeInTime *= 1.5f;
|
|
||||||
scrollUp->setOpacity(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (upFadeIn) {
|
if (upFadeOut) {
|
||||||
auto upFadeInFunc = [scrollUp](float t) {
|
auto upFadeOutFunc = [scrollUp](float t) {
|
||||||
scrollUp->setOpacity(
|
scrollUp->setOpacity(
|
||||||
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
||||||
};
|
};
|
||||||
scrollUp->setAnimation(
|
scrollUp->setAnimation(
|
||||||
new LambdaAnimation(upFadeInFunc, static_cast<int>(fadeInTime)), 0, nullptr,
|
new LambdaAnimation(upFadeOutFunc, static_cast<int>(fadeInTime)), 0,
|
||||||
false);
|
nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upFadeOut) {
|
if (downFadeIn) {
|
||||||
auto upFadeOutFunc = [scrollUp](float t) {
|
auto downFadeInFunc = [scrollDown](float t) {
|
||||||
scrollUp->setOpacity(
|
scrollDown->setOpacity(
|
||||||
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
||||||
};
|
};
|
||||||
scrollUp->setAnimation(
|
scrollDown->setAnimation(
|
||||||
new LambdaAnimation(upFadeOutFunc, static_cast<int>(fadeInTime)), 0,
|
new LambdaAnimation(downFadeInFunc, static_cast<int>(fadeInTime)), 0,
|
||||||
nullptr, true);
|
nullptr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downFadeIn) {
|
if (downFadeOut) {
|
||||||
auto downFadeInFunc = [scrollDown](float t) {
|
auto downFadeOutFunc = [scrollDown](float t) {
|
||||||
scrollDown->setOpacity(
|
scrollDown->setOpacity(
|
||||||
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
||||||
};
|
};
|
||||||
scrollDown->setAnimation(
|
scrollDown->setAnimation(
|
||||||
new LambdaAnimation(downFadeInFunc, static_cast<int>(fadeInTime)), 0,
|
new LambdaAnimation(downFadeOutFunc, static_cast<int>(fadeInTime)), 0,
|
||||||
nullptr, false);
|
nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downFadeOut) {
|
mPreviousScrollState = state;
|
||||||
auto downFadeOutFunc = [scrollDown](float t) {
|
});
|
||||||
scrollDown->setOpacity(
|
}
|
||||||
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
|
||||||
};
|
|
||||||
scrollDown->setAnimation(
|
|
||||||
new LambdaAnimation(downFadeOutFunc, static_cast<int>(fadeInTime)), 0,
|
|
||||||
nullptr, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPreviousScrollState = state;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue