MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / start

Method start

src/server/gui.cpp:144–265  ·  view source on GitHub ↗

--- START ---

Source from the content-addressed store, hash-verified

142
143// --- START ---
144bool 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;

Callers 4

mainFunction · 0.45
mainFunction · 0.45
runMethod · 0.45
updatePlayerUIMethod · 0.45

Calls 7

getWindowIdFunction · 0.85
existsFunction · 0.85
renderLoadingScreenMethod · 0.80
preloadMethod · 0.80
goToStartMethod · 0.80
pushGuiMethod · 0.80

Tested by 1

mainFunction · 0.36