https://github.com/apostolique/apos.input
Polling input library for MonoGame.
https://github.com/apostolique/apos.input
apos game input library monogame nuget
Last synced: 2 months ago
JSON representation
Polling input library for MonoGame.
- Host: GitHub
- URL: https://github.com/apostolique/apos.input
- Owner: Apostolique
- License: mit
- Created: 2019-02-01T14:37:47.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T23:53:10.000Z (10 months ago)
- Last Synced: 2025-02-21T20:04:33.998Z (2 months ago)
- Topics: apos, game, input, library, monogame, nuget
- Language: C#
- Homepage: https://apostolique.github.io/Apos.Input/
- Size: 937 KB
- Stars: 58
- Watchers: 5
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Apos.Input
Polling input library for MonoGame.
[](https://discord.gg/MonoGame)
## Documentation
* [Getting started](https://apostolique.github.io/Apos.Input/getting-started/)
* [Design choices](https://apostolique.github.io/Apos.Input/design-choices/)
* [API](https://apostolique.github.io/Apos.Input/api/)## Build
[](https://www.nuget.org/packages/Apos.Input/) [](https://www.nuget.org/packages/Apos.Input/)
## Features
* Manages the input states for you every frame
* Mouse, Keyboard, and GamePad buttons abstractions
* Tracking mode so that you don't accidentally consume the same input multiple times
* Static or instanced usage## Usage samples
In your game's `LoadContent()`, pass the game class to `InputHelper.Setup()`:
```csharp
protected override void LoadContent() {
InputHelper.Setup(this);
}
```In your game's `Update(GameTime gameTime)`, call the two functions:
```csharp
protected override void Update(GameTime gametime) {
// Call UpdateSetup at the start.
InputHelper.UpdateSetup();// ...
// Call UpdateCleanup at the end.
InputHelper.UpdateCleanup();
}
``````csharp
// Create a condition to jump.
// It should work on space, the first gamepad's A button, or the mouse's left button.
ICondition jump =
new AnyCondition(
new KeyboardCondition(Keys.Space),
new GamePadCondition(GamePadButton.A, 0),
new MouseCondition(MouseButton.LeftButton)
);
``````csharp
// To check if the jump is triggered:
if (jump.Pressed()) {
// Do the jump change.
}
```## Other projects you might like
* [Apos.Gui](https://github.com/Apostolique/Apos.Gui) - UI library for MonoGame.
* [Apos.Camera](https://github.com/Apostolique/Apos.Camera) - Camera library for MonoGame.
* [Apos.History](https://github.com/Apostolique/Apos.History) - A C# library that makes it easy to handle undo and redo.
* [Apos.Content](https://github.com/Apostolique/Apos.Content) - Content builder library for MonoGame.
* [Apos.Framework](https://github.com/Apostolique/Apos.Framework) - Game architecture for MonoGame.