MonoGame.Extended.Input provides extensions on top of the normal input classes.
MonoGame.Extended.Input is distributed via a NuGet package. You can add the NuGet package to your C# project through your IDE of choice (Visual Studio, Xamarin Studio, Rider, etc) or through the Command Line Interface (CLI) using the dotnet command.
MouseExtended is an extension of the
Mouse class. The
MouseStateExtended struct, obtained with
MouseExtended.GetState() provides useful utilities such as
WasButtonJustUp() by keeping track of the previous
KeyboardExtended is an extension of the
Keyboard class. The
KeyboardStateExtended struct, obtained with
KeyboardExtended.GetState() provides useful utilities such as
WasKeyJustUp() by keeping track of the previous
Listener classes have events you can use to subscribe to input events, instead of having to poll for input changes.
We start by including the required namespace.
Next, we declare our
You can manually call the
Update method of the
Listeners, but you can also use
InputListenerComponent this this.
Finaly, we subscribe to the events of the