-
-
Notifications
You must be signed in to change notification settings - Fork 314
/
IInputReceiver.cs
83 lines (73 loc) · 4.23 KB
/
IInputReceiver.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended.Input;
using MonoGame.Extended.Input.InputListeners;
namespace MonoGame.Extended.NuclexGui.Input
{
/// <summary>Interface for classes that can process user input</summary>
/// <remarks>
/// This interface is implemented by any class that can process user input.
/// Normally, user input is directly fed into the <see cref="GuiScreen" /> class
/// which manages the global state of an isolated GUI system. It is also possible,
/// though not recommended, to use this interface for sending input directly
/// to a control, for example, to simulate text input for an input box.
/// </remarks>
public interface IInputReceiver
{
/// <summary>Injects an input command into the input receiver</summary>
/// <param name="command">Input command to be injected</param>
/// <remarks>
/// <para>
/// If the GUI is run without the usual GUI input methods (eg. when a GUI is
/// displayed on a gaming console), this is the sole way to feed input to
/// the controls.
/// </para>
/// <para>
/// By default, normal key presses will generate a command in addition to the
/// KeyPress itself, so unless a control does something very special, it
/// should respond to this method only and leave the KeyPress method alone ;)
/// </para>
/// </remarks>
void InjectCommand(Command command);
/// <summary>Called when a button on the gamepad has been pressed</summary>
/// <param name="button">Button that has been pressed</param>
void InjectButtonPress(Buttons button);
/// <summary>Called when a button on the gamepad has been released</summary>
/// <param name="button">Button that has been released</param>
void InjectButtonRelease(Buttons button);
/// <summary>Injects a mouse position update into the receiver</summary>
/// <param name="x">New X coordinate of the mouse cursor on the screen</param>
/// <param name="y">New Y coordinate of the mouse cursor on the screen</param>
/// <remarks>
/// When the mouse leaves the valid region (eg. if the game runs in windowed mode
/// and the mouse cursor is moved outside of the window), a final mouse move
/// notification is generated with the coordinates -1, -1
/// </remarks>
void InjectMouseMove(float x, float y);
/// <summary>Called when a mouse button has been pressed down</summary>
/// <param name="button">Index of the button that has been pressed</param>
void InjectMousePress(MouseButton button);
/// <summary>Called when a mouse button has been released again</summary>
/// <param name="button">Index of the button that has been released</param>
void InjectMouseRelease(MouseButton button);
/// <summary>Called when the mouse wheel has been rotated</summary>
/// <param name="ticks">Number of ticks that the mouse wheel has been rotated</param>
void InjectMouseWheel(float ticks);
/// <summary>Called when a key on the keyboard has been pressed down</summary>
/// <param name="keyCode">Code of the key that was pressed</param>
/// <remarks>
/// Only handle this if you need it for some special purpose. For standard commands
/// like confirmation and cancellation, simply respond to InjectCommand()
/// </remarks>
void InjectKeyPress(Keys keyCode);
/// <summary>Called when a key on the keyboard has been released again</summary>
/// <param name="keyCode">Code of the key that was released</param>
/// <remarks>
/// Only handle this if you need it for some special purpose. For standard commands
/// like confirmation and cancellation, simply respond to InjectCommand()
/// </remarks>
void InjectKeyRelease(Keys keyCode);
/// <summary>Handle user text input by a physical or virtual keyboard</summary>
/// <param name="character">Character that has been entered</param>
void InjectCharacter(char character);
}
}