Merge pull request #525 from lubosz/loading-screen

Loading screen: Be more verbose about what is happening.
This commit is contained in:
Jools Wills 2019-02-08 00:12:46 +00:00 committed by GitHub
commit 12464024f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 8 deletions

View file

@ -292,6 +292,9 @@ int main(int argc, char* argv[])
MameNames::init(); MameNames::init();
window.pushGui(ViewController::get()); window.pushGui(ViewController::get());
bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress");
if(!scrape_cmdline) if(!scrape_cmdline)
{ {
if(!window.init()) if(!window.init())
@ -303,8 +306,13 @@ int main(int argc, char* argv[])
std::string glExts = (const char*)glGetString(GL_EXTENSIONS); std::string glExts = (const char*)glGetString(GL_EXTENSIONS);
LOG(LogInfo) << "Checking available OpenGL extensions..."; LOG(LogInfo) << "Checking available OpenGL extensions...";
LOG(LogInfo) << " ARB_texture_non_power_of_two: " << (glExts.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING"); LOG(LogInfo) << " ARB_texture_non_power_of_two: " << (glExts.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING");
if(Settings::getInstance()->getBool("SplashScreen")) if(splashScreen)
window.renderLoadingScreen(); {
std::string progressText = "Loading...";
if (splashScreenProgress)
progressText = "Loading system config...";
window.renderLoadingScreen(progressText);
}
} }
const char* errorMsg = NULL; const char* errorMsg = NULL;
@ -342,6 +350,9 @@ int main(int argc, char* argv[])
// this makes for no delays when accessing content, but a longer startup time // this makes for no delays when accessing content, but a longer startup time
ViewController::get()->preload(); ViewController::get()->preload();
if(splashScreen && splashScreenProgress)
window.renderLoadingScreen("Done.");
//choose which GUI to open depending on if an input configuration already exists //choose which GUI to open depending on if an input configuration already exists
if(errorMsg == NULL) if(errorMsg == NULL)
{ {

View file

@ -65,7 +65,7 @@ void ViewController::goToStart()
void ViewController::ReloadAndGoToStart() void ViewController::ReloadAndGoToStart()
{ {
mWindow->renderLoadingScreen(); mWindow->renderLoadingScreen("Loading...");
ViewController::get()->reloadAll(); ViewController::get()->reloadAll();
ViewController::get()->goToStart(); ViewController::get()->goToStart();
} }
@ -429,8 +429,19 @@ void ViewController::render(const Transform4x4f& parentTrans)
void ViewController::preload() void ViewController::preload()
{ {
uint32_t i = 0;
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++) for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
{ {
if(Settings::getInstance()->getBool("SplashScreen") &&
Settings::getInstance()->getBool("SplashScreenProgress"))
{
i++;
char buffer[100];
sprintf (buffer, "Loading '%s' (%d/%d)",
(*it)->getFullName().c_str(), i, SystemData::sSystemVector.size());
mWindow->renderLoadingScreen(std::string(buffer));
}
(*it)->getIndex()->resetFilters(); (*it)->getIndex()->resetFilters();
getGameListView(*it); getGameListView(*it);
} }

View file

@ -22,6 +22,7 @@ std::vector<const char*> settings_dont_save {
{ "HideConsole" }, { "HideConsole" },
{ "ShowExit" }, { "ShowExit" },
{ "SplashScreen" }, { "SplashScreen" },
{ "SplashScreenProgress" },
{ "VSync" }, { "VSync" },
{ "Windowed" }, { "Windowed" },
{ "WindowWidth" }, { "WindowWidth" },
@ -60,6 +61,7 @@ void Settings::setDefaults()
mBoolMap["ShowExit"] = true; mBoolMap["ShowExit"] = true;
mBoolMap["Windowed"] = false; mBoolMap["Windowed"] = false;
mBoolMap["SplashScreen"] = true; mBoolMap["SplashScreen"] = true;
mBoolMap["SplashScreenProgress"] = true;
mStringMap["StartupSystem"] = ""; mStringMap["StartupSystem"] = "";
mBoolMap["VSync"] = true; mBoolMap["VSync"] = true;

View file

@ -298,7 +298,7 @@ void Window::setAllowSleep(bool sleep)
mAllowSleep = sleep; mAllowSleep = sleep;
} }
void Window::renderLoadingScreen() void Window::renderLoadingScreen(std::string text)
{ {
Transform4x4f trans = Transform4x4f::Identity(); Transform4x4f trans = Transform4x4f::Identity();
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
@ -311,9 +311,11 @@ void Window::renderLoadingScreen()
splash.render(trans); splash.render(trans);
auto& font = mDefaultFonts.at(1); auto& font = mDefaultFonts.at(1);
TextCache* cache = font->buildTextCache("LOADING...", 0, 0, 0x656565FF); TextCache* cache = font->buildTextCache(text, 0, 0, 0x656565FF);
trans = trans.translate(Vector3f(Math::round((Renderer::getScreenWidth() - cache->metrics.size.x()) / 2.0f),
Math::round(Renderer::getScreenHeight() * 0.835f), 0.0f)); float x = Math::round((Renderer::getScreenWidth() - cache->metrics.size.x()) / 2.0f);
float y = Math::round(Renderer::getScreenHeight() * 0.835f);
trans = trans.translate(Vector3f(x, y, 0.0f));
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
font->renderTextCache(cache); font->renderTextCache(cache);
delete cache; delete cache;

View file

@ -63,7 +63,7 @@ public:
bool getAllowSleep(); bool getAllowSleep();
void setAllowSleep(bool sleep); void setAllowSleep(bool sleep);
void renderLoadingScreen(); void renderLoadingScreen(std::string text);
void renderHelpPromptsEarly(); // used to render HelpPrompts before a fade void renderHelpPromptsEarly(); // used to render HelpPrompts before a fade
void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style); void setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpStyle& style);