diff --git a/Intersect.Client.Framework/Input/MouseButtons.cs b/Intersect.Client.Framework/Input/MouseButtons.cs index ae7e0c67fd..cc2db41ffd 100644 --- a/Intersect.Client.Framework/Input/MouseButtons.cs +++ b/Intersect.Client.Framework/Input/MouseButtons.cs @@ -9,7 +9,11 @@ public enum MouseButtons Right, - Middle + Middle, + + X1, + + X2 } } diff --git a/Intersect.Client/Core/Controls/ControlValue.cs b/Intersect.Client/Core/Controls/ControlValue.cs index 901e3f6338..8a1fa434fc 100644 --- a/Intersect.Client/Core/Controls/ControlValue.cs +++ b/Intersect.Client/Core/Controls/ControlValue.cs @@ -13,7 +13,11 @@ public partial class ControlValue public Keys Key { get; set; } - public bool IsMouseKey => Key == Keys.LButton || Key == Keys.RButton || Key == Keys.MButton; + public bool IsMouseKey => Key == Keys.LButton + || Key == Keys.RButton + || Key == Keys.MButton + || Key == Keys.XButton1 + || Key == Keys.XButton2; [JsonConstructor] public ControlValue(Keys modifier, Keys key) @@ -66,6 +70,20 @@ public bool IsDown() return true; } + break; + case Keys.XButton1: + if (Globals.InputManager.MouseButtonDown(MouseButtons.X1)) + { + return true; + } + + break; + case Keys.XButton2: + if (Globals.InputManager.MouseButtonDown(MouseButtons.X2)) + { + return true; + } + break; } } diff --git a/Intersect.Client/Core/Input.cs b/Intersect.Client/Core/Input.cs index 150b5888f8..a6deceda15 100644 --- a/Intersect.Client/Core/Input.cs +++ b/Intersect.Client/Core/Input.cs @@ -306,6 +306,14 @@ public static void OnMouseDown(Keys modifier, MouseButtons btn) case MouseButtons.Middle: key = Keys.MButton; + break; + case MouseButtons.X1: + key = Keys.XButton1; + + break; + case MouseButtons.X2: + key = Keys.XButton2; + break; } @@ -375,6 +383,14 @@ public static void OnMouseUp(Keys modifier, MouseButtons btn) case MouseButtons.Middle: key = Keys.MButton; + break; + case MouseButtons.X1: + key = Keys.XButton1; + + break; + case MouseButtons.X2: + key = Keys.XButton2; + break; } diff --git a/Intersect.Client/MonoGame/Input/MonoInput.cs b/Intersect.Client/MonoGame/Input/MonoInput.cs index 21599f3688..8804bd6752 100644 --- a/Intersect.Client/MonoGame/Input/MonoInput.cs +++ b/Intersect.Client/MonoGame/Input/MonoInput.cs @@ -116,6 +116,10 @@ public override bool MouseButtonDown(MouseButtons mb) return mLastMouseState.RightButton == ButtonState.Pressed; case MouseButtons.Middle: return mLastMouseState.MiddleButton == ButtonState.Pressed; + case MouseButtons.X1: + return mLastMouseState.XButton1 == ButtonState.Pressed; + case MouseButtons.X2: + return mLastMouseState.XButton2 == ButtonState.Pressed; default: throw new ArgumentOutOfRangeException(nameof(mb), mb, null); } @@ -206,6 +210,8 @@ public override void Update() CheckMouseButton(modifier, state.LeftButton, MouseButtons.Left); CheckMouseButton(modifier, state.RightButton, MouseButtons.Right); CheckMouseButton(modifier, state.MiddleButton, MouseButtons.Middle); + CheckMouseButton(modifier, state.XButton1, MouseButtons.X1); + CheckMouseButton(modifier, state.XButton2, MouseButtons.X2); CheckMouseScrollWheel(state.ScrollWheelValue, state.HorizontalScrollWheelValue); @@ -258,6 +264,8 @@ public override void Update() CheckMouseButton(modifier, ButtonState.Released, MouseButtons.Left); CheckMouseButton(modifier, ButtonState.Released, MouseButtons.Right); CheckMouseButton(modifier, ButtonState.Released, MouseButtons.Middle); + CheckMouseButton(modifier, ButtonState.Released, MouseButtons.X1); + CheckMouseButton(modifier, ButtonState.Released, MouseButtons.X2); mLastKeyboardState = new KeyboardState(); mLastMouseState = new MouseState(); }