Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "Input/Index"

Provides support for mice, keyboards, and controllers.

Working with Input

Excalibur offers several modes of input for your games.

The Engine.input property that can be inspected during Actor.update or other areas of the game. This makes it easy to respond to any type of user input without writing complex input event code.

Learn more about Mouse and Touch, Keyboard, and Controller support.

Inspecting engine input

Access Engine.input to see if any input is being tracked during the current update frame.

class Player extends ex.Actor {
  public update(engine, delta) {
    if (engine.input.keyboard.isKeyDown(ex.Input.Keys.W) || engine.input.gamepads.at(0).getAxes(ex.Input.Axes.LeftStickY) > 0.5) {
      player._moveForward();
    }
  }
}

Index

References

ActorsUnderPointer

ActorsUnderPointer:

Axes

Axes:

Buttons

Buttons:

EngineInput

EngineInput:

Gamepad

Gamepad:

GamepadConfiguration

GamepadConfiguration:

Gamepads

Gamepads:

KeyEvent

KeyEvent:

Keyboard

Keyboard:

Keys

Keys:

NativePointerButton

NativePointerButton:

NavigatorGamepad

NavigatorGamepad:

NavigatorGamepadButton

NavigatorGamepadButton:

NavigatorGamepadEvent

NavigatorGamepadEvent:

NavigatorGamepads

NavigatorGamepads:

Pointer

Pointer:

PointerButton

PointerButton:

PointerCancelEvent

PointerCancelEvent:

PointerDownEvent

PointerDownEvent:

PointerDragEvent

PointerDragEvent:

PointerEnterEvent

PointerEnterEvent:

PointerEvent

PointerEvent:

PointerEventFactory

PointerEventFactory:

PointerEventName

PointerEventName:

PointerLeaveEvent

PointerLeaveEvent:

PointerMoveEvent

PointerMoveEvent:

PointerScope

PointerScope:

PointerType

PointerType:

PointerUpEvent

PointerUpEvent:

Pointers

Pointers:

WheelDeltaMode

WheelDeltaMode:

WheelEvent

WheelEvent:

createPointerEventByName

createPointerEventByName: