apostolique/apos.input

Polling input library for MonoGame

Gui - UI library for MonoGame

Polling input library for MonoGame

Apos.Input

.

Documentation

  • Getting started
  • Design choices
  • API

Build

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():

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.
    InputHelper.UpdateSetup();

    //...

    //Call UpdateCleanup at the end.
    InputHelper.UpdateCleanup();
}
//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)
    );
//To check if the jump is triggered:
if (jump.Pressed()) {
    //Do the jump change.
}

Other projects you might like

  • Apos.Gui - UI 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.
  • AposGameStarter - MonoGame project starter. Common files to help create a game faster.
Issues

Quick list of the latest Issues we found

Apostolique

Apostolique

bug
Icon For Comments0

When a key is held and the game loses focus (IsActive becomes false), it's possible for the player to let go of that key. When that happens the Released() condition doesn't fire. It might be useful to consider the focus loss to be the same as letting go of the key.

Apostolique

Apostolique

enhancement
Icon For Comments1

Some work has been started with the static scroll and pointer API:

Perhaps it could be worth it to abstract this into a condition with an out parameter so that it can be used in a non static manner:

Or something similar.

Eventually, this could be used to map analog joystick values, triggers, etc.

Apostolique

Apostolique

enhancement
Icon For Comments0

In some cases, some keys shouldn't trigger Pressed or Released. For example: CTRL + A.

If we're currently holding A, then pressing CTRL shouldn't trigger a CTRL + A press.

In a select all CTRL is a modifier. A new class could be created handle that case:

Modifier would always return false for Pressed and Released.

Note: There might be an edge case to think about. What happens if a user is currently pressing A then presses CTRL, Should that trigger Held and HeldOnly for CTRL + A? It might make some code harder to write on the user side.

Apostolique

Apostolique

enhancement
Icon For Comments0

Sometimes it's nice to be able to press a key, have a Pressed() event happen, wait X milliseconds, then have Held() trigger every Y milliseconds.

Apostolique

Apostolique

enhancement
Icon For Comments0

It would be nice to have a built-in way to support combos.

For example press A then B to trigger an action. Perhaps with a timeout option before it's too late to press B.

Ideally, the combo would happen behind the scene and the API could look like this:

Library Stats (Sep 17, 2022)

Subscribers: 3
Stars: 27
Forks: 2
Issues: 4
Audio

4.1K

NAudio is an open source

NET audio library written by NAudio NuGet package

NAudio is an open source

Libraries (NuGet)

NET library which helps with automated UI testing of Windows applications (Win32, WinForms, WPF, Store Apps,

Libraries (NuGet)

GraphQL Conventions Library for

GraphQL library written by lexer/parser originally written by NuGet:

GraphQL Conventions Library for
Net - Simple and Fast Multimedia Library for

Essentials is a library with common purpose functionality for working with

Install this NuGet package in your Visual Studio project

Essentials is a library with common purpose functionality for working with
5 library which adds an extension for the MicroLite ORM Framework to integrate with ASP
5 library which adds an extension for the MicroLite ORM Framework to integrate with ASP

Arbitrary precision rational number class

This library is also available on nuget:

Arbitrary precision rational number class
NET portable class library (PCL) for the InterPlanetary File System (IPFS) API

Themes is the repo for add-ons NuGet packages that can be added to any new...

Uno Cupertino library is designed to help you use Uno Gallery repository

Themes is the repo for add-ons NuGet packages that can be added to any new...