A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using osu.Framework.Input.States;
5using osuTK;
6
7namespace osu.Framework.Input.Events
8{
9 /// <summary>
10 /// An event representing a move of the mouse cursor.
11 /// </summary>
12 public class MouseMoveEvent : MouseEvent
13 {
14 /// <summary>
15 /// The last mouse position before this mouse move in the screen space.
16 /// </summary>
17 public readonly Vector2 ScreenSpaceLastMousePosition;
18
19 /// <summary>
20 /// The last mouse position before this mouse move in local space.
21 /// </summary>
22 public Vector2 LastMousePosition => ToLocalSpace(ScreenSpaceLastMousePosition);
23
24 /// <summary>
25 /// The difference of mouse position from last position to current position in local space.
26 /// </summary>
27 public Vector2 Delta => MousePosition - LastMousePosition;
28
29 public MouseMoveEvent(InputState state, Vector2? screenSpaceLastMousePosition = null)
30 : base(state)
31 {
32 ScreenSpaceLastMousePosition = screenSpaceLastMousePosition ?? ScreenSpaceMousePosition;
33 }
34 }
35}