mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Greatly improved application startup time by removing a lot of unnecessary splash screen re-rasterizations.
This commit is contained in:
parent
5dae37f558
commit
e553f68e90
|
@ -648,8 +648,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
window->pushGui(ViewController::getInstance());
|
||||
|
||||
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
|
||||
bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress");
|
||||
bool splashScreen {Settings::getInstance()->getBool("SplashScreen")};
|
||||
|
||||
InputManager::getInstance().parseEvent(event);
|
||||
if (event.type == SDL_QUIT)
|
||||
|
@ -674,9 +673,7 @@ int main(int argc, char* argv[])
|
|||
#endif
|
||||
|
||||
if (splashScreen) {
|
||||
std::string progressText = "Loading...";
|
||||
if (splashScreenProgress)
|
||||
progressText = "Loading system config...";
|
||||
std::string progressText {"Loading system config..."};
|
||||
window->renderLoadingScreen(progressText);
|
||||
}
|
||||
|
||||
|
@ -720,7 +717,7 @@ int main(int argc, char* argv[])
|
|||
<< "\"";
|
||||
}
|
||||
|
||||
if (splashScreen && splashScreenProgress)
|
||||
if (splashScreen)
|
||||
window->renderLoadingScreen("Done");
|
||||
|
||||
// Open the input configuration GUI if the flag to force this was passed from the command line.
|
||||
|
|
|
@ -945,8 +945,7 @@ void ViewController::preload()
|
|||
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend();
|
||||
++it) {
|
||||
if (Settings::getInstance()->getBool("SplashScreen") &&
|
||||
Settings::getInstance()->getBool("SplashScreenProgress")) {
|
||||
if (Settings::getInstance()->getBool("SplashScreen")) {
|
||||
mWindow->renderLoadingScreen(
|
||||
"Loading '" + (*it)->getFullName() + "' (" +
|
||||
std::to_string(std::distance(SystemData::sSystemVector.cbegin(), it) + 1) + "/" +
|
||||
|
|
|
@ -49,7 +49,6 @@ namespace
|
|||
"DebugGrid",
|
||||
"DebugText",
|
||||
"DebugImage",
|
||||
"SplashScreenProgress",
|
||||
"ScraperFilter"
|
||||
// clang-format on
|
||||
};
|
||||
|
@ -296,7 +295,6 @@ void Settings::setDefaults()
|
|||
mBoolMap["DebugGrid"] = {false, false};
|
||||
mBoolMap["DebugText"] = {false, false};
|
||||
mBoolMap["DebugImage"] = {false, false};
|
||||
mBoolMap["SplashScreenProgress"] = {true, true};
|
||||
mIntMap["ScraperFilter"] = {0, 0};
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ Window::Window() noexcept
|
|||
Window::~Window()
|
||||
{
|
||||
delete mBackgroundOverlay;
|
||||
delete mSplash;
|
||||
|
||||
// Delete all our GUIs.
|
||||
while (peekGui())
|
||||
|
@ -112,6 +113,8 @@ bool Window::init()
|
|||
ResourceManager::getInstance().reloadAll();
|
||||
|
||||
mHelp = new HelpComponent;
|
||||
mSplash = new ImageComponent;
|
||||
|
||||
mBackgroundOverlay = new ImageComponent;
|
||||
mBackgroundOverlayOpacity = 0.0f;
|
||||
|
||||
|
@ -122,6 +125,11 @@ bool Window::init()
|
|||
mDefaultFonts.push_back(Font::get(FONT_SIZE_LARGE));
|
||||
}
|
||||
|
||||
mSplash->setResize(Renderer::getScreenWidth() * 0.6f, 0.0f);
|
||||
mSplash->setImage(":/graphics/splash.svg");
|
||||
mSplash->setPosition((Renderer::getScreenWidth() - mSplash->getSize().x) / 2.0f,
|
||||
(Renderer::getScreenHeight() - mSplash->getSize().y) / 2.0f * 0.6f);
|
||||
|
||||
mBackgroundOverlay->setImage(":/graphics/frame.png");
|
||||
mBackgroundOverlay->setResize(Renderer::getScreenWidth(), Renderer::getScreenHeight());
|
||||
|
||||
|
@ -598,13 +606,7 @@ void Window::renderLoadingScreen(std::string text)
|
|||
mRenderer->setMatrix(trans);
|
||||
mRenderer->drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::getScreenHeight(),
|
||||
0x000000FF, 0x000000FF);
|
||||
|
||||
ImageComponent splash(true);
|
||||
splash.setImage(":/graphics/splash.svg");
|
||||
splash.setResize(Renderer::getScreenWidth() * 0.6f, 0.0f);
|
||||
splash.setPosition((Renderer::getScreenWidth() - splash.getSize().x) / 2.0f,
|
||||
(Renderer::getScreenHeight() - splash.getSize().y) / 2.0f * 0.6f);
|
||||
splash.render(trans);
|
||||
mSplash->render(trans);
|
||||
|
||||
auto& font = mDefaultFonts.at(1);
|
||||
TextCache* cache = font->buildTextCache(text, 0.0f, 0.0f, 0x656565FF);
|
||||
|
|
|
@ -153,6 +153,7 @@ private:
|
|||
Renderer* mRenderer;
|
||||
HelpComponent* mHelp;
|
||||
ImageComponent* mBackgroundOverlay;
|
||||
ImageComponent* mSplash;
|
||||
float mBackgroundOverlayOpacity;
|
||||
std::vector<GuiComponent*> mGuiStack;
|
||||
std::vector<std::shared_ptr<Font>> mDefaultFonts;
|
||||
|
|
Loading…
Reference in a new issue