diff options
author | Thomas Leyh <leyh.thomas@web.de> | 2016-07-24 08:14:18 +0200 |
---|---|---|
committer | Thomas Leyh <leyh.thomas@web.de> | 2016-07-24 08:14:18 +0200 |
commit | ced3d03bdb3ce866d832e03fb212865140905a9a (patch) | |
tree | 2a16c2063a46d3c354ce1585029dda3124f6ad93 /V3/Input/Internal/MouseEvent.cs | |
parent | 0394dccaf06e1009e591a6ff4d645895574724c1 (diff) | |
download | V3-release.tar.gz V3-release.tar.bz2 |
Diffstat (limited to 'V3/Input/Internal/MouseEvent.cs')
-rw-r--r-- | V3/Input/Internal/MouseEvent.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/V3/Input/Internal/MouseEvent.cs b/V3/Input/Internal/MouseEvent.cs new file mode 100644 index 0000000..f8024aa --- /dev/null +++ b/V3/Input/Internal/MouseEvent.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; + +namespace V3.Input.Internal +{ + /// <summary> + /// Default implementation of an event that is sent when a mouse button is + /// pressed or released. + /// </summary> + internal sealed class MouseEvent : IMouseEvent + { + /// <summary> + /// The mouse button that was pressed or released. + /// </summary> + public MouseButton MouseButton { get; } + /// <summary> + /// The state of the mouse button (pressed or released?). + /// </summary> + public ButtonState ButtonState { get; } + /// <summary> + /// The position where the mouse button was pressed the last time. + /// </summary> + public Point PositionPressed { get; } + /// <summary> + /// The position where the mouse button was released if this is a + /// release event, null otherwise. + /// </summary> + public Point? PositionReleased { get; } + /// <summary> + /// True if PositionReleased is a valid on-screen position, otherwise + /// false. + /// </summary> + public bool ReleasedOnScreen { get; } + + /// <summary> + /// Creates a new mouse event with the given data. + /// </summary> + /// <param name="mouseButton">the mouse button that was pressed or + /// released</param> + /// <param name="buttonState">the type of the event (pressed or + /// released?)</param> + /// <param name="positionPressed">the position of the last press of + /// the button</param> + /// <param name="positionReleased">the position of the release of the + /// button if this is a release event, or null otherwise</param> + /// <param name="releasedOnScreen">true if positionReleased is a valid + /// on-screen position.</param> + public MouseEvent(MouseButton mouseButton, ButtonState buttonState, Point positionPressed, Point? positionReleased, bool releasedOnScreen) + { + MouseButton = mouseButton; + ButtonState = buttonState; + PositionPressed = positionPressed; + PositionReleased = positionReleased; + ReleasedOnScreen = releasedOnScreen; + } + } +} |