You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
// Set the mouse bounds to the whole window so ForceMouseWithinBox is not stuck being relative to some player screen, because it can still bind the mouse even if this doesn't.
Copy file name to clipboardExpand all lines: Managers/UInputMan.h
+18-11Lines changed: 18 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@
10
10
11
11
#defineg_UInputManUInputMan::Instance()
12
12
13
+
extern "C" {
14
+
structSDL_Rect;
15
+
}
16
+
13
17
namespaceRTE {
14
18
15
19
classIcon;
@@ -411,20 +415,12 @@ namespace RTE {
411
415
/// <summary>
412
416
/// Forces the mouse within a box on the screen.
413
417
/// </summary>
414
-
/// <param name="x">X value of the top left corner of the screen box to keep the mouse within, in screen coordinates.</param>
415
-
/// <param name="y">Y value of the top left corner of the screen box to keep the mouse within, in screen coordinates.</param>
418
+
/// <param name="x">X value of the top left corner of the screen box to keep the mouse within, relative to the top left corner of the player's screen.</param>
419
+
/// <param name="y">Y value of the top left corner of the screen box to keep the mouse within, relative to the top left corner of the player's screen.</param>
416
420
/// <param name="width">The width of the box.</param>
417
421
/// <param name="height">The height of the box.</param>
418
422
/// <param name="whichPlayer">Which player is trying to control the mouse. Only the player with actual control over the mouse will be affected. -1 means do it regardless of player.</param>
419
-
voidForceMouseWithinBox(int x, int y, int width, int height, int whichPlayer = -1) const;
420
-
421
-
/// <summary>
422
-
/// Forces the mouse within a specific player's screen area.
423
-
/// Player 1 will always be in the upper-left corner, Player 3 will always be in the lower-left corner, Player 4 will always be in the lower-right quadrant.
424
-
/// Player 2 will either be in the lower-left corner or the upper-right corner depending on vertical/horizontal splitting.
425
-
/// </summary>
426
-
/// <param name="whichPlayer">Which player's screen to constrain the mouse to. Only the player with actual control over the mouse will be affected.</param>
voidForceMouseWithinBox(int x, int y, int width, int height, int whichPlayer = Players::NoPlayer) const;
428
424
#pragma endregion
429
425
430
426
#pragma region Joystick Handling
@@ -689,6 +685,7 @@ namespace RTE {
689
685
690
686
bool m_TrapMousePos; //!< Whether the mouse is trapped in the middle of the screen each update or not.
691
687
float m_MouseTrapRadius; //!< The radius (in pixels) of the circle trapping the mouse for analog mouse data.
688
+
SDL_Rect m_PlayerScreenMouseBounds; //!< Rect with the position and dimensions of the player screen that the mouse is bound to, when bounding is enabled.
692
689
693
690
InputDevice m_LastDeviceWhichControlledGUICursor; //!< Indicates which device controlled the cursor last time.
694
691
@@ -715,6 +712,16 @@ namespace RTE {
715
712
staticconstexprint c_AxisDigitalPressedThreshold = 8192; //!< Digital Axis threshold value as defined by allegro.
716
713
staticconstexprint c_AxisDigitalReleasedThreshold = c_AxisDigitalPressedThreshold - 100; //!< Digital Axis release threshold, to debounce values.
717
714
715
+
#pragma region Mouse Handling
716
+
/// <summary>
717
+
/// Forces the mouse within a specific player's screen area.
718
+
/// Player 1 will always be in the upper-left corner, Player 3 will always be in the lower-left corner, Player 4 will always be in the lower-right quadrant.
719
+
/// Player 2 will either be in the lower-left corner or the upper-right corner depending on vertical/horizontal splitting.
720
+
/// </summary>
721
+
/// <param name="whichPlayer">Which player's screen to constrain the mouse to. Only the player with actual control over the mouse will be affected.</param>
722
+
voidForceMouseWithinPlayerScreen(bool force, int whichPlayer);
723
+
#pragma endregion
724
+
718
725
#pragma region Input State Handling
719
726
/// <summary>
720
727
/// Gets whether an input element is in the specified state.
0 commit comments