diff --git a/src/components/TextListComponent.h b/src/components/TextListComponent.h index 31267d42f..b896c1aff 100644 --- a/src/components/TextListComponent.h +++ b/src/components/TextListComponent.h @@ -130,12 +130,9 @@ void TextListComponent::render(const Eigen::Affine3f& parentTrans) std::shared_ptr& font = mFont; if(size() == 0) - { return; - } - const int cutoff = 0; - const int entrySize = (int)font->getHeight() + 5; + const float entrySize = font->getHeight() + 5; int startEntry = 0; @@ -144,32 +141,34 @@ void TextListComponent::render(const Eigen::Affine3f& parentTrans) if(size() >= screenCount) { - startEntry = mCursor - (int)(screenCount * 0.5); + startEntry = mCursor - screenCount/2; if(startEntry < 0) startEntry = 0; if(startEntry >= size() - screenCount) startEntry = size() - screenCount; } - float y = (float)cutoff; + float y = 0; int listCutoff = startEntry + screenCount; if(listCutoff > size()) listCutoff = size(); + // draw selector bar + if(startEntry < listCutoff) + { + Renderer::setMatrix(trans); + Renderer::drawRect(0.f, (mCursor - startEntry)*entrySize, mSize.x(), font->getHeight(), mSelectorColor); + } + + // clip to inside margins Eigen::Vector3f dim(mSize.x(), mSize.y(), 0); dim = trans * dim - trans.translation(); - Renderer::pushClipRect(Eigen::Vector2i((int)trans.translation().x(), (int)trans.translation().y()), Eigen::Vector2i((int)dim.x(), (int)dim.y())); + Renderer::pushClipRect(Eigen::Vector2i((int)(trans.translation().x() + mHorizontalMargin), (int)trans.translation().y()), + Eigen::Vector2i((int)(dim.x() - mHorizontalMargin*2), (int)dim.y())); for(int i = startEntry; i < listCutoff; i++) { - //draw selector bar - if(mCursor == i) - { - Renderer::setMatrix(trans); - Renderer::drawRect(0, (int)y, (int)mSize.x(), (int)font->getHeight(), mSelectorColor); - } - typename IList::Entry& entry = mEntries.at((unsigned int)i); unsigned int color; @@ -276,6 +275,7 @@ void TextListComponent::update(int deltaTime) Eigen::Vector2f textSize = mFont->sizeText(text); //it's long enough to marquee + mMarqueeTime += deltaTime; if(textSize.x() - mMarqueeOffset > mSize.x() - 12 - (mAlignment != ALIGN_CENTER ? mHorizontalMargin : 0)) { mMarqueeTime += deltaTime; diff --git a/src/guis/GuiScraperMulti.cpp b/src/guis/GuiScraperMulti.cpp index 0d4068088..4cc13e9fe 100644 --- a/src/guis/GuiScraperMulti.cpp +++ b/src/guis/GuiScraperMulti.cpp @@ -1,6 +1,7 @@ #include "GuiScraperMulti.h" #include "../Renderer.h" #include "../Log.h" +#include "../views/ViewController.h" #include "../components/TextComponent.h" #include "../components/ButtonComponent.h" @@ -67,6 +68,13 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue detailed) + for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++) + mWindow->getViewController()->reloadGameListView(*it, false); +} + void GuiScraperMulti::onSizeChanged() { mBackground.fitTo(mSize, Vector3f::Zero(), Vector2f(-32, -32)); diff --git a/src/guis/GuiScraperMulti.h b/src/guis/GuiScraperMulti.h index 33b04b2b9..37a0b02f5 100644 --- a/src/guis/GuiScraperMulti.h +++ b/src/guis/GuiScraperMulti.h @@ -14,6 +14,7 @@ class GuiScraperMulti : public GuiComponent { public: GuiScraperMulti(Window* window, const std::queue& searches, bool approveResults); + virtual ~GuiScraperMulti(); void onSizeChanged() override; std::vector getHelpPrompts() override; diff --git a/src/views/ViewController.h b/src/views/ViewController.h index aab5f19e4..ad7882c8e 100644 --- a/src/views/ViewController.h +++ b/src/views/ViewController.h @@ -18,6 +18,7 @@ public: // If a basic view detected a metadata change, it can request to recreate // the current gamelist view (as it may change to be detailed). void reloadGameListView(IGameListView* gamelist, bool reloadTheme = false); + inline void reloadGameListView(SystemData* system, bool reloadTheme = false) { reloadGameListView(getGameListView(system).get(), reloadTheme); } void reloadAll(); // Reload everything with a theme. Used when the "ThemeSet" setting changes. // Navigation.