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.Extensions.TypeExtensions;
5using osu.Framework.Input.States;
6using osuTK;
7
8namespace osu.Framework.Input.Events
9{
10 /// <summary>
11 /// An event representing a change of the mouse wheel.
12 /// </summary>
13 public class ScrollEvent : MouseEvent
14 {
15 /// <summary>
16 /// The relative change in scroll associated with this event.
17 /// </summary>
18 public readonly Vector2 ScrollDelta;
19
20 /// <summary>
21 /// Whether the change came from a device supporting precision scrolling.
22 /// </summary>
23 /// <remarks>
24 /// In cases this is true, scroll events will generally map 1:1 to user's input, rather than incrementing in large "notches" (as expected of traditional scroll wheels).
25 /// </remarks>
26 public readonly bool IsPrecise;
27
28 public ScrollEvent(InputState state, Vector2 scrollDelta, bool isPrecise = false)
29 : base(state)
30 {
31 ScrollDelta = scrollDelta;
32 IsPrecise = isPrecise;
33 }
34
35 public override string ToString() => $"{GetType().ReadableName()}({ScrollDelta}, {IsPrecise})";
36 }
37}