forked from craftworkgames/MonoGame.Extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MouseExtended.cs
34 lines (29 loc) · 1.05 KB
/
MouseExtended.cs
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
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace MonoGame.Extended.Input
{
public static class MouseExtended
{
// TODO: This global static state was a horrible idea.
private static MouseState _currentMouseState;
private static MouseState _previousMouseState;
public static MouseStateExtended GetState()
{
return new MouseStateExtended(_currentMouseState, _previousMouseState);
}
public static void Refresh()
{
_previousMouseState = _currentMouseState;
_currentMouseState = Mouse.GetState();
}
public static void SetPosition(int x, int y) => Mouse.SetPosition(x, y);
public static void SetPosition(Point point) => Mouse.SetPosition(point.X, point.Y);
public static void SetCursor(MouseCursor cursor) => Mouse.SetCursor(cursor);
public static IntPtr WindowHandle
{
get => Mouse.WindowHandle;
set => Mouse.WindowHandle = value;
}
}
}