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