diff --git a/404.html b/404.html index f615c03..9e53fc4 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -
An ICondition is an abstraction over button-based input. A button can pressed or not pressed which maps to on
or off
respectively. By comparing it’s previous and current states, we get the following cases.
In the following functions, when canConsume
is true
, it means that the Consume()
function gets called implicitly if the condition is part of the tracking system.
Read the source code.
bool Pressed(bool canConsume = true);
+ICondition - Apos.Input ICondition
An ICondition is an abstraction over button-based input. A button can pressed or not pressed which maps to on
or off
respectively. By comparing it’s previous and current states, we get the following cases.
In the following functions, when canConsume
is true
, it means that the Consume()
function gets called implicitly if the condition is part of the tracking system.
Source code
Read the source code.
Pressed
bool Pressed(bool canConsume = true);
Previous state is off
, current state is on
. Triggers only on the first frame that the current state becomes on
.
Held
bool Held(bool canConsume = true);
Previous state ignored, current state is on
. Triggers every frame for as long as the current state stays on
.
HeldOnly
bool HeldOnly(bool canConsume = true);
Previous state is on
, current state is on
. Since HeldOnly
doesn’t get triggered on the same frame as Pressed
it’s useful as a way to break an action into multiple steps.
Released
bool Released(bool canConsume = true);
diff --git a/api/InputHelper/index.html b/api/InputHelper/index.html
index bb8a1e7..1ad6a3f 100644
--- a/api/InputHelper/index.html
+++ b/api/InputHelper/index.html
@@ -1,4 +1,4 @@
-InputHelper - Apos.Input InputHelper
This static class holds all the data required to handle inputs. It takes care of saving the previous and new input states.
Source code
Read the source code.
Game
public static Game Game {
+InputHelper - Apos.Input InputHelper
This static class holds all the data required to handle inputs. It takes care of saving the previous and new input states.
Source code
Read the source code.
Game
public static Game Game {
get;
set;
}
diff --git a/api/MouseButton/index.html b/api/MouseButton/index.html
index 04f6949..80d6f87 100644
--- a/api/MouseButton/index.html
+++ b/api/MouseButton/index.html
@@ -1,4 +1,4 @@
-MouseButton - Apos.Input MouseButton
An enum with all the available mouse buttons.
Source code
Read the source code.
LeftButton
.LeftButton
+MouseButton - Apos.Input MouseButton
An enum with all the available mouse buttons.
Source code
Read the source code.
LeftButton
.LeftButton
MouseButton
Left mouse button.
MiddleButton
.MiddleButton
MouseButton
Middle mouse button.
RightButton
.RightButton
MouseButton
Right mouse button.
XButton1
.XButton1
diff --git a/api/index.html b/api/index.html
index 5cceabd..81b3012 100644
--- a/api/index.html
+++ b/api/index.html
@@ -1 +1 @@
-API - Apos.Input API
- InputHelper
- ICondition
- AllCondition
- AnyCondition
- KeyboardCondition
- MouseCondition
- GamePadCondition
- AnyGamePadCondition
- Track
- KeyboardCondition
- MouseCondition
- GamePadCondition
- MouseButton
- GamePadButton
Edit this page on GitHub
\ No newline at end of file
+API - Apos.Input API
- InputHelper
- ICondition
- AllCondition
- AnyCondition
- KeyboardCondition
- MouseCondition
- GamePadCondition
- AnyGamePadCondition
- Track
- KeyboardCondition
- MouseCondition
- GamePadCondition
- MouseButton
- GamePadButton
Edit this page on GitHub
\ No newline at end of file
diff --git a/design-choices/index.html b/design-choices/index.html
index 9ea7718..6362b9a 100644
--- a/design-choices/index.html
+++ b/design-choices/index.html
@@ -1 +1 @@
-Design choices - Apos.Input Design choices
Design and ideas behind this library.
Polling
This library’s goal is to enable a polling-based paradigm on input handling. Inputs come from mouse, keyboard, gamepad, touch screen, etc. Polling means that you can check for an input’s current state anywhere that feels natural in your game code instead of managing them through events and callbacks.
Abstraction
For an input button, the state can either be on
or off
. It’s useful to know when the state becomes on
and when the state becomes off
. This library defines the moment a state becomes on
as Pressed
and the moment the state becomes off
as Released
. It also defines the exclusive state in between those as HeldOnly
. When either Pressed
or HeldOnly
are true, this is defined as Held
. These are included in the ICondition interface.
Tracking
This library comes with a built-in tracking system. This allows you to resolve conflicts between different ICondition instances that reuse the same keys or buttons. The tracking system is opt-in and separated into it’s own namespace at Apos.Input.Track
. To accommodate it, ICondition offers an optional parameter canConsume
in Pressed(canConsume = true)
, Held(canConsume = true)
, HeldOnly(canConsume = true)
, and Released(canConsume = true)
. This optional parameter allows you to handle the tracking yourself by setting canConsume
to false and calling Consume()
manually.
Edit this page on GitHub
\ No newline at end of file
+Design choices - Apos.Input Design choices
Design and ideas behind this library.
Polling
This library’s goal is to enable a polling-based paradigm on input handling. Inputs come from mouse, keyboard, gamepad, touch screen, etc. Polling means that you can check for an input’s current state anywhere that feels natural in your game code instead of managing them through events and callbacks.
Abstraction
For an input button, the state can either be on
or off
. It’s useful to know when the state becomes on
and when the state becomes off
. This library defines the moment a state becomes on
as Pressed
and the moment the state becomes off
as Released
. It also defines the exclusive state in between those as HeldOnly
. When either Pressed
or HeldOnly
are true, this is defined as Held
. These are included in the ICondition interface.
Tracking
This library comes with a built-in tracking system. This allows you to resolve conflicts between different ICondition instances that reuse the same keys or buttons. The tracking system is opt-in and separated into it’s own namespace at Apos.Input.Track
. To accommodate it, ICondition offers an optional parameter canConsume
in Pressed(canConsume = true)
, Held(canConsume = true)
, HeldOnly(canConsume = true)
, and Released(canConsume = true)
. This optional parameter allows you to handle the tracking yourself by setting canConsume
to false and calling Consume()
manually.
Edit this page on GitHub
\ No newline at end of file
diff --git a/getting-started/index.html b/getting-started/index.html
index eec2fdf..018df1f 100644
--- a/getting-started/index.html
+++ b/getting-started/index.html
@@ -1,4 +1,4 @@
-Getting started - Apos.Input Getting started
This guide will show you how to get started with this library.
Install
Install using the following dotnet command:
Getting started - Apos.Input Getting started
This guide will show you how to get started with this library.
Install
Install using the following dotnet command:
dotnet add package Apos.Input
Setup
Import the library with:
using Apos.Input;
using Track = Apos.Input.Track;
In your game’s LoadContent()
, pass the game class to InputHelper.Setup()
:
protected override void LoadContent() {
diff --git a/index.html b/index.html
index 5dc60dd..170723a 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-Apos.Input Apos.Input
Polling input library for MonoGame.
Documentation
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() {
+Apos.Input Apos.Input
Polling input library for MonoGame.
Documentation
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) {
dotnet add package Apos.Input
+
MouseButton
MouseButton