InputSystem

Defines a system of inputs, buttons, axes or both.

Members

Aliases

Axes
alias Axes = AxisState.Inputs

The enum of axes that the input system has.

AxisEvent
alias AxisEvent = void delegate(Axes, AxisStorageType)

A delegate that takes the changed axis and the new state.

ButtonEvent
alias ButtonEvent = void delegate(Buttons, ButtonStorageType)

A delegate that takes the changed button and the new state.

ButtonStateEvent
alias ButtonStateEvent = void delegate(Buttons)

A delegate that takes the changed button.

Buttons
alias Buttons = ButtonState.Inputs

The enum of buttons that the input system has.

Functions

addAxisEvent
void addAxisEvent(Axes axis, AxisEvent event)

Add an event to be fired when the given axis changes.

addButtonDownEvent
void addButtonDownEvent(Buttons buttonCode, ButtonStateEvent func)

Add a button event only when the button is down.

addButtonEvent
void addButtonEvent(Buttons buttonCode, ButtonEvent func)

Add an event to be fired when the given button changes.

addButtonUpEvent
void addButtonUpEvent(Buttons buttonCode, ButtonStateEvent func)

Add a button event only when the button is up.

getAxisState
AxisStorageType getAxisState(Axes axis)

Get the state of a given axis.

getButtonState
ButtonStorageType getButtonState(Buttons buttonCode)

Check if a given button is down.

isButtonDown
ButtonStorageType isButtonDown(Buttons buttonCode, bool checkPrevious = false)

Check if a given button is down.

isButtonUp
ButtonStorageType isButtonUp(Buttons buttonCode, bool checkPrevious = false)

Check if a given button is up.

setAxisState
void setAxisState(Axes axisCode, AxisStorageType newState)

Sets the state of the axis to be assigned at the beginning of next frame. Should only be called from a window controller.

setButtonState
void setButtonState(Buttons buttonCode, ButtonStorageType newState)

Sets the state of the button to be assigned at the beginning of next frame. Should only be called from a window controller.

Static functions

initialize
void initialize()

Initialize all states and events.

update
void update()

Update all events and states.

Static variables

HasAxes
enum HasAxes;

Whether or not the system has axes.

HasButtons
enum HasButtons;

Whether or not the system has buttons.

Meta