mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Merge pull request #145 from pjft/Fix-Filtered-GameCount
Fix for Game Count display in System View when filtered
This commit is contained in:
commit
6a20acd6b0
|
@ -56,21 +56,21 @@ void SystemView::populate()
|
||||||
logoSelected->setPosition((mCarousel.logoSize.x() - logoSelected->getSize().x()) / 2,
|
logoSelected->setPosition((mCarousel.logoSize.x() - logoSelected->getSize().x()) / 2,
|
||||||
(mCarousel.logoSize.y() - logoSelected->getSize().y()) / 2); // center
|
(mCarousel.logoSize.y() - logoSelected->getSize().y()) / 2); // center
|
||||||
e.data.logoSelected = std::shared_ptr<GuiComponent>(logoSelected);
|
e.data.logoSelected = std::shared_ptr<GuiComponent>(logoSelected);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
// no logo in theme; use text
|
// no logo in theme; use text
|
||||||
TextComponent* text = new TextComponent(mWindow,
|
TextComponent* text = new TextComponent(mWindow,
|
||||||
(*it)->getName(),
|
(*it)->getName(),
|
||||||
Font::get(FONT_SIZE_LARGE),
|
Font::get(FONT_SIZE_LARGE),
|
||||||
0x000000FF,
|
0x000000FF,
|
||||||
ALIGN_CENTER);
|
ALIGN_CENTER);
|
||||||
text->setSize(mCarousel.logoSize);
|
text->setSize(mCarousel.logoSize);
|
||||||
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
||||||
|
|
||||||
TextComponent* textSelected = new TextComponent(mWindow,
|
TextComponent* textSelected = new TextComponent(mWindow,
|
||||||
(*it)->getName(),
|
(*it)->getName(),
|
||||||
Font::get((int)(FONT_SIZE_LARGE * 1.5)),
|
Font::get((int)(FONT_SIZE_LARGE * 1.5)),
|
||||||
0x000000FF,
|
0x000000FF,
|
||||||
ALIGN_CENTER);
|
ALIGN_CENTER);
|
||||||
textSelected->setSize(mCarousel.logoSize);
|
textSelected->setSize(mCarousel.logoSize);
|
||||||
e.data.logoSelected = std::shared_ptr<GuiComponent>(textSelected);
|
e.data.logoSelected = std::shared_ptr<GuiComponent>(textSelected);
|
||||||
|
@ -153,9 +153,9 @@ bool SystemView::input(InputConfig* config, Input input)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(config->isMappedTo("left", input) ||
|
if(config->isMappedTo("left", input) ||
|
||||||
config->isMappedTo("right", input) ||
|
config->isMappedTo("right", input) ||
|
||||||
config->isMappedTo("up", input) ||
|
config->isMappedTo("up", input) ||
|
||||||
config->isMappedTo("down", input))
|
config->isMappedTo("down", input))
|
||||||
listInput(0);
|
listInput(0);
|
||||||
}
|
}
|
||||||
|
@ -184,13 +184,13 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
|
|
||||||
float endPos = target; // directly
|
float endPos = target; // directly
|
||||||
float dist = abs(endPos - startPos);
|
float dist = abs(endPos - startPos);
|
||||||
|
|
||||||
if(abs(target + posMax - startPos) < dist)
|
if(abs(target + posMax - startPos) < dist)
|
||||||
endPos = target + posMax; // loop around the end (0 -> max)
|
endPos = target + posMax; // loop around the end (0 -> max)
|
||||||
if(abs(target - posMax - startPos) < dist)
|
if(abs(target - posMax - startPos) < dist)
|
||||||
endPos = target - posMax; // loop around the start (max - 1 -> -1)
|
endPos = target - posMax; // loop around the start (max - 1 -> -1)
|
||||||
|
|
||||||
|
|
||||||
// animate mSystemInfo's opacity (fade out, wait, fade back in)
|
// animate mSystemInfo's opacity (fade out, wait, fade back in)
|
||||||
|
|
||||||
cancelAnimation(1);
|
cancelAnimation(1);
|
||||||
|
@ -204,19 +204,19 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
mSystemInfo.setOpacity((unsigned char)(lerp<float>(infoStartOpacity, 0.f, t) * 255));
|
mSystemInfo.setOpacity((unsigned char)(lerp<float>(infoStartOpacity, 0.f, t) * 255));
|
||||||
}, (int)(infoStartOpacity * 150));
|
}, (int)(infoStartOpacity * 150));
|
||||||
|
|
||||||
unsigned int gameCount = getSelected()->getGameCount();
|
unsigned int gameCount = getSelected()->getDisplayedGameCount();
|
||||||
|
|
||||||
// also change the text after we've fully faded out
|
// also change the text after we've fully faded out
|
||||||
setAnimation(infoFadeOut, 0, [this, gameCount] {
|
setAnimation(infoFadeOut, 0, [this, gameCount] {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
if (getSelected()->getName() == "retropie")
|
if (getSelected()->getName() == "retropie")
|
||||||
ss << "CONFIGURATION";
|
ss << "CONFIGURATION";
|
||||||
// only display a game count if there are at least 2 games
|
// only display a game count if there are at least 2 games
|
||||||
else if(gameCount > 1)
|
else if(gameCount > 1)
|
||||||
ss << gameCount << " GAMES AVAILABLE";
|
ss << gameCount << " GAMES AVAILABLE";
|
||||||
|
|
||||||
mSystemInfo.setText(ss.str());
|
mSystemInfo.setText(ss.str());
|
||||||
}, false, 1);
|
}, false, 1);
|
||||||
|
|
||||||
// only display a game count if there are at least 2 games
|
// only display a game count if there are at least 2 games
|
||||||
|
@ -288,7 +288,7 @@ void SystemView::render(const Eigen::Affine3f& parentTrans)
|
||||||
{
|
{
|
||||||
if(size() == 0)
|
if(size() == 0)
|
||||||
return; // nothing to render
|
return; // nothing to render
|
||||||
|
|
||||||
Eigen::Affine3f trans = getTransform() * parentTrans;
|
Eigen::Affine3f trans = getTransform() * parentTrans;
|
||||||
|
|
||||||
auto systemInfoZIndex = mSystemInfo.getZIndex();
|
auto systemInfoZIndex = mSystemInfo.getZIndex();
|
||||||
|
@ -397,9 +397,9 @@ void SystemView::renderCarousel(const Eigen::Affine3f& trans)
|
||||||
int center = (int)(mCamOffset);
|
int center = (int)(mCamOffset);
|
||||||
int logoCount = std::min(mCarousel.maxLogoCount, (int)mEntries.size());
|
int logoCount = std::min(mCarousel.maxLogoCount, (int)mEntries.size());
|
||||||
|
|
||||||
// Adding texture loading buffers depending on scrolling speed and status
|
// Adding texture loading buffers depending on scrolling speed and status
|
||||||
int bufferIndex = getScrollingVelocity() + 1;
|
int bufferIndex = getScrollingVelocity() + 1;
|
||||||
|
|
||||||
for (int i = center - logoCount / 2 + logoBuffersLeft[bufferIndex]; i <= center + logoCount / 2 + logoBuffersRight[bufferIndex]; i++)
|
for (int i = center - logoCount / 2 + logoBuffersLeft[bufferIndex]; i <= center + logoCount / 2 + logoBuffersRight[bufferIndex]; i++)
|
||||||
{
|
{
|
||||||
int index = i;
|
int index = i;
|
||||||
|
@ -435,7 +435,7 @@ void SystemView::renderInfoBar(const Eigen::Affine3f& trans)
|
||||||
void SystemView::renderExtras(const Eigen::Affine3f& trans, float lower, float upper)
|
void SystemView::renderExtras(const Eigen::Affine3f& trans, float lower, float upper)
|
||||||
{
|
{
|
||||||
int extrasCenter = (int)mExtrasCamOffset;
|
int extrasCenter = (int)mExtrasCamOffset;
|
||||||
|
|
||||||
// Adding texture loading buffers depending on scrolling speed and status
|
// Adding texture loading buffers depending on scrolling speed and status
|
||||||
int bufferIndex = getScrollingVelocity() + 1;
|
int bufferIndex = getScrollingVelocity() + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue