-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathInput.cs
More file actions
40 lines (33 loc) · 1.04 KB
/
Input.cs
File metadata and controls
40 lines (33 loc) · 1.04 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SortRenderWithCSharp {
public class Input {
public static Input Instance = new Input();
// 表示鼠标是否按下
public bool isMouseDown;
// 表示是否有键盘按下
public bool isKeyDown;
// 表示当前按下的鼠标的键位
public MouseButtons mouseCode;
// 表示当前按下的键盘的键位
public Keys keyCode;
public void Reset() {
isMouseDown = false;
isKeyDown = false;
mouseCode = MouseButtons.None;
keyCode = Keys.None;
}
public void OperateKeybordEvent(KeyEventArgs keyEvent) {
isKeyDown = true;
keyCode = keyEvent.KeyCode;
}
public void OperateMouseEvent(MouseEventArgs mouseEvent) {
isMouseDown = true;
mouseCode = mouseEvent.Button;
}
}
}