--- START ---
| 142 | |
| 143 | // --- START --- |
| 144 | bool Gui::start() { |
| 145 | LOG(LogInfo) << "NymphCast GUI - " << __VERSION; |
| 146 | |
| 147 | bool splashScreen = Settings::getInstance()->getBool("SplashScreen"); |
| 148 | bool splashScreenProgress = Settings::getInstance()->getBool("SplashScreenProgress"); |
| 149 | |
| 150 | if (splashScreen) { |
| 151 | std::string progressText = "Loading..."; |
| 152 | if (splashScreenProgress) { |
| 153 | progressText = "Loading system config..."; |
| 154 | } |
| 155 | |
| 156 | window->renderLoadingScreen(progressText); |
| 157 | } |
| 158 | |
| 159 | // preload what we can right away instead of waiting for the user to select it |
| 160 | // this makes for no delays when accessing content, but a longer startup time |
| 161 | ViewController::get()->preload(); |
| 162 | |
| 163 | // Get the window ID. |
| 164 | windowId = Renderer::getWindowId(); |
| 165 | |
| 166 | if(splashScreen && splashScreenProgress) { |
| 167 | window->renderLoadingScreen("Done."); |
| 168 | } |
| 169 | |
| 170 | //choose which GUI to open depending on if an input configuration already exists |
| 171 | if (Utils::FileSystem::exists(InputManager::getConfigPath()) && |
| 172 | InputManager::getInstance()->getNumConfiguredDevices() > 0) { |
| 173 | ViewController::get()->goToStart(); |
| 174 | } |
| 175 | else { |
| 176 | window->pushGui(new GuiDetectDevice(window, true, [] { ViewController::get()->goToStart(); })); |
| 177 | } |
| 178 | |
| 179 | // flush any queued events before showing the UI and starting the input handling loop |
| 180 | /* const Uint32 event_list[] = { |
| 181 | SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, |
| 182 | SDL_KEYDOWN, SDL_KEYUP |
| 183 | }; */ |
| 184 | //SDL_PumpEvents(); |
| 185 | /* for (Uint32 ev_type: event_list) { |
| 186 | SDL_FlushEvent(ev_type); |
| 187 | } */ |
| 188 | |
| 189 | lastTime = SDL_GetTicks(); |
| 190 | //int ps_time = SDL_GetTicks(); |
| 191 | |
| 192 | //guiThread = new std::thread(run_updates); |
| 193 | |
| 194 | active = true; |
| 195 | |
| 196 | // Enable events for the GUI. |
| 197 | SdlRenderer::guiEvents(true); |
| 198 | |
| 199 | // -------------- |
| 200 | |
| 201 | /* running = true; |