FlatRedBall.Input.IPressableInput

Introduction

IPressableInput is an interface which can be used to generalize input code for whether an input device is being pressed down, was just pressed, or was just released. Numerous common input devices are implemented as IPressableInputs.

Code Example

The following shows how to make an entity perform actions (such as shoot bullets). It assumes that the code has an Entity called Ship, and that Ship has a function called FireBullet.

In Ship.cs:

In the Screen’s CustomInitialize, assuming it has a ShipInstance:

Common Usage

The following shows how to use the most common FRB input classes to get IPressableInputs: