MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnEndFrame

Method OnEndFrame

Sources/Jazz2/LevelHandler.cpp:594–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592 }
593
594 void LevelHandler::OnEndFrame()
595 {
596 ZoneScopedC(0x4876AF);
597
598 float timeMult = theApplication().GetTimeMult();
599 auto& resolver = ContentResolver::Get();
600
601 _tileMap->OnEndFrame();
602
603 if (!IsPausable() || _pauseMenu == nullptr) {
604 ResolveCollisions(timeMult);
605
606 if (!resolver.IsHeadless()) {
607#if defined(NCINE_HAS_GAMEPAD_RUMBLE)
608 _rumble.OnEndFrame(timeMult);
609#endif
610
611 for (auto& viewport : _assignedViewports) {
612 viewport->UpdateCamera(timeMult);
613 }
614
615#if defined(WITH_AUDIO)
616 if (!_assignedViewports.empty()) {
617 // Update audio listener position
618 IAudioDevice& audioDevice = theServiceLocator().GetAudioDevice();
619 if (_assignedViewports.size() == 1) {
620 audioDevice.updateListener(Vector3f(_assignedViewports[0]->_cameraPos, 0.0f),
621 Vector3f(_assignedViewports[0]->_targetActor->GetSpeed(), 0.0f));
622 } else {
623 audioDevice.updateListener(Vector3f::Zero, Vector3f::Zero);
624
625 // All audio players must be updated to the nearest listener
626 for (auto& current : _playingSounds) {
627 if (auto* currentForSplitscreen = runtime_cast<AudioBufferPlayerForSplitscreen>(current.get())) {
628 currentForSplitscreen->updatePosition();
629 }
630 }
631 }
632 }
633#endif
634 }
635
636 _elapsedFrames += timeMult;
637 }
638
639 if (!resolver.IsHeadless()) {
640 for (auto& viewport : _assignedViewports) {
641 viewport->OnEndFrame();
642 }
643
644#if defined(DEATH_DEBUG) && defined(WITH_IMGUI)
645 if (PreferencesCache::ShowPerformanceMetrics && !_assignedViewports.empty()) {
646 ImDrawList* drawList = ImGui::GetBackgroundDrawList();
647 const auto& mainViewport = *_assignedViewports[0];
648
649 std::size_t actorsCount = _actors.size();
650 for (std::size_t i = 0; i < actorsCount; i++) {
651 auto* actor = _actors[i].get();

Callers 1

OnPostUpdateMethod · 0.45

Calls 9

IsHeadlessMethod · 0.80
UpdateCameraMethod · 0.80
GetSpeedMethod · 0.80
updatePositionMethod · 0.80
GetTimeMultMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
updateListenerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected