From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/Input/Internal/MouseEvent.cs | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 V3/Input/Internal/MouseEvent.cs (limited to 'V3/Input/Internal/MouseEvent.cs') 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 +{ + /// + /// Default implementation of an event that is sent when a mouse button is + /// pressed or released. + /// + internal sealed class MouseEvent : IMouseEvent + { + /// + /// The mouse button that was pressed or released. + /// + public MouseButton MouseButton { get; } + /// + /// The state of the mouse button (pressed or released?). + /// + public ButtonState ButtonState { get; } + /// + /// The position where the mouse button was pressed the last time. + /// + public Point PositionPressed { get; } + /// + /// The position where the mouse button was released if this is a + /// release event, null otherwise. + /// + public Point? PositionReleased { get; } + /// + /// True if PositionReleased is a valid on-screen position, otherwise + /// false. + /// + public bool ReleasedOnScreen { get; } + + /// + /// Creates a new mouse event with the given data. + /// + /// the mouse button that was pressed or + /// released + /// the type of the event (pressed or + /// released?) + /// the position of the last press of + /// the button + /// the position of the release of the + /// button if this is a release event, or null otherwise + /// true if positionReleased is a valid + /// on-screen position. + public MouseEvent(MouseButton mouseButton, ButtonState buttonState, Point positionPressed, Point? positionReleased, bool releasedOnScreen) + { + MouseButton = mouseButton; + ButtonState = buttonState; + PositionPressed = positionPressed; + PositionReleased = positionReleased; + ReleasedOnScreen = releasedOnScreen; + } + } +} -- cgit v1.2.1