MCPcopy Create free account
hub / github.com/EasyRPG/Player / Update

Method Update

src/player.cpp:337–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void Player::Update(bool update_scene) {
338 std::shared_ptr<Scene> old_instance = Scene::instance;
339
340 if (exit_flag) {
341 Scene::PopUntil(Scene::Null);
342 } else if (reset_flag && !Scene::IsAsyncPending()) {
343 reset_flag = false;
344 if (Scene::ReturnToTitleScene()) {
345 // Fade out music and stop sound effects before returning
346 Main_Data::game_system->BgmFade(800);
347 Audio().SE_Stop();
348 // Do not update this scene until it's properly set up in the next main loop
349 update_scene = false;
350 }
351 }
352
353 if (update_scene) {
354 IncFrame();
355 }
356
357 Audio().Update();
358 Input::Update();
359
360 // Game events can query full screen status and change their behavior, so this needs to
361 // be a game key and not a system key.
362 if (Input::IsTriggered(Input::TOGGLE_FULLSCREEN)) {
363 DisplayUi->ToggleFullscreen();
364 }
365
366 if (Main_Data::game_quit) {
367 Main_Data::game_quit->Update();
368 }
369
370 auto& transition = Transition::instance();
371
372 if (transition.IsActive()) {
373 transition.Update();
374 } else {
375 // If we aren't waiting on a transition, but we are waiting for scene delay.
376 Scene::instance->UpdateDelayFrames();
377 }
378
379 if (update_scene) {
380 if (Main_Data::game_ineluki) {
381 Main_Data::game_ineluki->Update();
382 }
383
384 Scene::instance->Update();
385 }
386
387#if defined(__ANDROID__) && !defined(USE_LIBRETRO)
388 EpAndroid::invoke();
389#endif
390}
391
392void Player::Draw() {
393 Graphics::Update();

Callers 1

MainLoopMethod · 0.45

Calls 7

invokeFunction · 0.85
BgmFadeMethod · 0.80
UpdateDelayFramesMethod · 0.80
UpdateFunction · 0.70
SE_StopMethod · 0.45
ToggleFullscreenMethod · 0.45
IsActiveMethod · 0.45

Tested by

no test coverage detected