File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ void PollSDLEvents() {
245245// / Game menus loop.
246246// / </summary>
247247void RunMenuLoop () {
248+ g_MenuMan.SetIsInMenuScreen (true );
248249 g_UInputMan.DisableKeys (false );
249250 g_UInputMan.TrapMousePos (false );
250251
@@ -282,6 +283,8 @@ void RunMenuLoop() {
282283 g_WindowMan.GetScreenBuffer ()->End ();
283284 g_WindowMan.UploadFrame ();
284285 }
286+
287+ g_MenuMan.SetIsInMenuScreen (false );
285288}
286289
287290// / <summary>
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ void MenuMan::Initialize(bool firstTimeInit) {
2929 m_GUIInput = std::make_unique<GUIInputWrapper>(-1 , g_UInputMan.GetJoystickCount () > 0 );
3030
3131 if (firstTimeInit) {
32+ m_IsInMenuScreen = false ;
3233 g_LoadingScreen.Create (m_GUIScreen.get (), m_GUIInput.get (), g_SettingsMan.GetLoadingScreenProgressReportDisabled ());
3334 }
3435
@@ -129,12 +130,6 @@ void MenuMan::HandleTransitionIntoMenuLoop() {
129130}
130131
131132bool MenuMan::Update () {
132- // If we're in the menu but the activity isn't set as paused, then exit
133- // This can mismatch sometimes like when loading a saved game
134- if (m_ActiveMenu != ActiveMenu::MenusDisabled && !g_ActivityMan.ActivityPaused ()) {
135- return true ;
136- }
137-
138133 m_TitleScreen->Update ();
139134 SetActiveMenu ();
140135
Original file line number Diff line number Diff line change @@ -44,6 +44,16 @@ namespace RTE {
4444 void Draw () const ;
4545#pragma endregion
4646
47+ #pragma region Getters/Setters
48+ // / Checks if we're currently in a menu screen.
49+ // / @return True if in a menu screen; false otherwise.
50+ bool GetIsInMenuScreen () const { return m_IsInMenuScreen; }
51+
52+ // / Sets if we're currently in a menu screen.
53+ // / @param isInMenuScreen Whether we're in any menu screen.
54+ void SetIsInMenuScreen (bool isInMenuScreen) { m_IsInMenuScreen = isInMenuScreen; }
55+ #pragma endregion
56+
4757 private:
4858 // / Enumeration for the different menu screens that are active based on transition states.
4959 enum ActiveMenu {
@@ -54,6 +64,7 @@ namespace RTE {
5464 PauseMenuActive,
5565 };
5666
67+ bool m_IsInMenuScreen; // !< Whether we're currently in a menu screen.
5768 ActiveMenu m_ActiveMenu; // !< The currently active menu screen that is being updated and drawn. See ActiveMenu enumeration.
5869
5970 std::unique_ptr<GUIInputWrapper> m_GUIInput; // !< The GUIInput interface of this MenuMan.
Original file line number Diff line number Diff line change 88#include " ConsoleMan.h"
99#include " PresetMan.h"
1010#include " PerformanceMan.h"
11+ #include " MenuMan.h"
1112#include " Icon.h"
1213#include " GameActivity.h"
1314#include " System.h"
@@ -1177,7 +1178,7 @@ void UInputMan::UpdateMouseInput() {
11771178 // The mouse cursor is visible and can move about the screen/window, but it should still be contained within the mouse player's part of the window
11781179 for (int player = PlayerOne; player < MaxPlayerCount; player++) {
11791180 if (m_ControlScheme[player].GetDevice () == InputDevice::DEVICE_MOUSE_KEYB ) {
1180- ForceMouseWithinPlayerScreen (g_ActivityMan.IsInActivity (), player);
1181+ ForceMouseWithinPlayerScreen (g_ActivityMan.IsInActivity () && !g_MenuMan. GetIsInMenuScreen () , player);
11811182 }
11821183 }
11831184 }
You can’t perform that action at this time.
0 commit comments