MCPcopy Create free account
hub / github.com/OpenMW/openmw / interactiveMessageBox

Method interactiveMessageBox

apps/openmw/mwgui/windowmanagerimp.cpp:781–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779 }
780
781 void WindowManager::interactiveMessageBox(
782 std::string_view message, const std::vector<std::string>& buttons, bool block, int defaultFocus)
783 {
784 mMessageBoxManager->createInteractiveMessageBox(message, buttons, block, defaultFocus);
785 updateVisible();
786
787 if (block)
788 {
789 Misc::FrameRateLimiter frameRateLimiter
790 = Misc::makeFrameRateLimiter(MWBase::Environment::get().getFrameRateLimit());
791 while (mMessageBoxManager->readPressedButton(false) == -1
792 && !MWBase::Environment::get().getStateManager()->hasQuitRequest())
793 {
794 const float dt
795 = std::chrono::duration_cast<std::chrono::duration<float>>(frameRateLimiter.getLastFrameDuration())
796 .count();
797
798 mKeyboardNavigation->onFrame();
799 mMessageBoxManager->onFrame(dt);
800 MWBase::Environment::get().getInputManager()->update(dt, true, false);
801
802 if (!mWindowVisible)
803 std::this_thread::sleep_for(std::chrono::milliseconds(5));
804 else
805 {
806 mViewer->eventTraversal();
807 mViewer->updateTraversal();
808 mViewer->renderingTraversals();
809 }
810 // at the time this function is called we are in the middle of a frame,
811 // so out of order calls are necessary to get a correct frameNumber for the next frame.
812 // refer to the advance() and frame() order in Engine::go()
813 mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
814
815 frameRateLimiter.limit();
816 }
817
818 mMessageBoxManager->resetInteractiveMessageBox();
819 }
820 }
821
822 void WindowManager::messageBox(std::string_view message, enum MWGui::ShowInDialogueMode showInDialogueMode)
823 {

Callers 11

messageBoxMethod · 0.80
askLoadRecentMethod · 0.80
newGameMethod · 0.80
saveGameMethod · 0.80
confirmLoadingMethod · 0.80
registerUiApiFunction · 0.80
onLanguageChangedMethod · 0.80

Calls 15

makeFrameRateLimiterFunction · 0.85
getFrameRateLimitMethod · 0.80
hasQuitRequestMethod · 0.80
getStateManagerMethod · 0.80
getLastFrameDurationMethod · 0.80
getInputManagerMethod · 0.80
getSimulationTimeMethod · 0.80
limitMethod · 0.80
getFunction · 0.50
readPressedButtonMethod · 0.45

Tested by

no test coverage detected