summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Gui/PointerEventArgs.cs
blob: 18cffacd5ed38b75b77678daa3a8614be9a49e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using Microsoft.Xna.Framework;
using MonoGame.Extended.Input;
using MonoGame.Extended.Input.InputListeners;

namespace MonoGame.Extended.Gui
{
    public class PointerEventArgs : EventArgs
    {
        private PointerEventArgs()
        {
        }

        public Point Position { get; private set; }
        public MouseButton Button { get; private set; }
        public int ScrollWheelDelta { get; private set; }
        public int ScrollWheelValue { get; private set; }
        public TimeSpan Time { get; private set; }

        public static PointerEventArgs FromMouseArgs(MouseEventArgs args)
        {
            return new PointerEventArgs
            {
                Position = args.Position,
                Button = args.Button,
                ScrollWheelDelta = args.ScrollWheelDelta,
                ScrollWheelValue = args.ScrollWheelValue,
                Time = args.Time
            };
        }

        public static PointerEventArgs FromTouchArgs(TouchEventArgs args)
        {
            return new PointerEventArgs
            {
                Position = args.Position,
                Button = MouseButton.Left,
                Time = args.Time
            };
        }
    }
}