Polling input library for MonoGame.
- Manages the input states for you every frame
- Mouse, Keyboard, and GamePad buttons abstractions
- Touch screen contacts, with one pointer position shared with the mouse
- Long press and key repeat, on any condition and so on any device
- Tracking mode so that you don't accidentally consume the same input multiple times
- Static or instanced usage
In your game's LoadContent(), pass the game class to InputHelper.Setup():
protected override void LoadContent() {
InputHelper.Setup(this);
}In your game's Update(GameTime gameTime), call the two functions:
protected override void Update(GameTime gameTime) {
// Call UpdateSetup at the start. It needs the GameTime to drive InputHelper.TotalMS.
InputHelper.UpdateSetup(gameTime);
// ...
// Call UpdateCleanup at the end.
InputHelper.UpdateCleanup();
}// Create a condition to jump.
// It should work on space, the first gamepad's A button, the mouse's left button,
// or a touch screen contact.
ICondition jump =
new AnyCondition(
new KeyboardCondition(Keys.Space),
new GamePadCondition(GamePadButton.A, 0),
new MouseCondition(MouseButton.LeftButton),
new TouchCondition()
);// To check if the jump is triggered:
if (jump.Pressed()) {
// Do the jump change.
}- Apos.Gui - UI library for MonoGame.
- Apos.Camera - Camera library for MonoGame.
- Apos.History - A C# library that makes it easy to handle undo and redo.
- Apos.Content - Content builder library for MonoGame.
- Apos.Framework - Game architecture for MonoGame.