MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / update

Method update

source/client/StarClientApplication.cpp:341–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void ClientApplication::update() {
342 float dt = GlobalTimestep * GlobalTimescale;
343 auto& app = appController();
344 if (m_state >= MainAppState::Title) {
345 if (auto p2pNetworkingService = app->p2pNetworkingService()) {
346 if (auto join = p2pNetworkingService->pullPendingJoin()) {
347 m_pendingMultiPlayerConnection = PendingMultiPlayerConnection{join.takeValue(), {}, {}, false};
348 changeState(MainAppState::Title);
349 }
350
351 if (auto req = p2pNetworkingService->pullJoinRequest())
352 m_mainInterface->queueJoinRequest(*req);
353
354 p2pNetworkingService->update();
355 }
356 }
357
358 if (!m_errorScreen->accepted())
359 m_errorScreen->update(dt);
360
361 if (m_state == MainAppState::Mods)
362 updateMods(dt);
363 else if (m_state == MainAppState::ModsWarning)
364 updateModsWarning(dt);
365
366 if (m_state == MainAppState::Splash)
367 updateSplash(dt);
368 else if (m_state == MainAppState::Error)
369 updateError(dt);
370 else if (m_state == MainAppState::Title)
371 updateTitle(dt);
372 else if (m_state > MainAppState::Title)
373 updateRunning(dt);
374
375 // Swallow leftover encoded voice data if we aren't in-game to allow mic read to continue for settings.
376 if (m_state <= MainAppState::Title) {
377 DataStreamBuffer ext;
378 m_voice->send(ext);
379 } // TODO: directly disable encoding at menu so we don't have to do this
380
381 m_guiContext->cleanup();
382 m_edgeKeyEvents.clear();
383 m_input->update();
384 ++m_framesSkipped;
385}
386
387void ClientApplication::render() {
388 m_framesSkipped = 0;

Callers 5

updateModsMethod · 0.45
updateSplashMethod · 0.45
updateTitleMethod · 0.45
updateRunningMethod · 0.45
updateCameraMethod · 0.45

Calls 9

pullPendingJoinMethod · 0.80
takeValueMethod · 0.80
pullJoinRequestMethod · 0.80
queueJoinRequestMethod · 0.80
acceptedMethod · 0.80
p2pNetworkingServiceMethod · 0.45
sendMethod · 0.45
cleanupMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected