Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Apos.Input - Input library for MonoGame

$
0
0

@Apostolique wrote:

I've been working on an input library for MonoGame. It makes it easier to setup key rebinding and complex hotkeys. Currently supports mouse, keyboard and gamepad buttons.

Available on GitHub and Nuget:

https://github.com/Apostolique/Apos.Input

https://www.nuget.org/packages/Apos.Input/

I'm also writing API documentation for it here: https://apostolique.github.io/Apos.Input/

It's pretty easy to use:

//Create an action to toggle fullscreen.
//It should work on both Alt keys and Enter.
var toggleFullScreen = new ActionKeyboardComposite();
toggleFullscreen.AddSet(Keys.Enter).AddNeed(Keys.LeftAlt);
toggleFullscreen.AddSet(Keys.Enter).AddNeed(Keys.RightAlt);

//To check if toggleFullscreen is triggered:
if (toggleFullscreen.Pressed()) {
    //Do the fullscreen change.
}

Or if you want to create a keybind that works while you press Space but not Shift:

var normalJump = new ActionKeyboardComposite();
normalJump.AddSet(Keys.Space).AddNot(Keys.LeftShift);

var specialJump = new ActionKeyboardComposite();
specialJump.AddSet(Keys.Space).AddNeed(Keys.LeftShift);

I'll soon finish adding full gamepad support.
I'll also be adding ways to mix mouse, keyboard and gamepad actions for extra cool action binding.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles