1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-05 06:49:09 +01:00
MLEM/MLEM/Input/MouseExtensions.cs

39 lines
1 KiB
C#
Raw Normal View History

2019-09-04 18:49:59 +02:00
using System;
2019-09-04 21:10:51 +02:00
using System.Linq;
2019-09-04 18:49:59 +02:00
using Microsoft.Xna.Framework.Input;
2019-09-04 21:10:51 +02:00
using MLEM.Misc;
2019-09-04 18:49:59 +02:00
namespace MLEM.Input {
public static class MouseExtensions {
2019-09-04 21:10:51 +02:00
public static readonly MouseButton[] MouseButtons = EnumHelper.GetValues<MouseButton>().ToArray();
2019-09-04 18:49:59 +02:00
public static ButtonState GetState(this MouseState state, MouseButton button) {
switch (button) {
case MouseButton.Left:
return state.LeftButton;
case MouseButton.Middle:
return state.MiddleButton;
case MouseButton.Right:
return state.RightButton;
case MouseButton.Extra1:
return state.XButton1;
case MouseButton.Extra2:
return state.XButton2;
default:
throw new ArgumentException(nameof(button));
}
}
}
public enum MouseButton {
Left,
Middle,
Right,
Extra1,
Extra2
}
}