Courage.Input#
require("Courage.Input") exposes keyboard and controller input queries.
Loading the module#
API#
Input.last_scancode() (returns integer)#
Returns the scancode of the last key pressed on the keyboard. Returns 0 if no key was pressed.
Game Controller API#
Input.pad_trigger(pad?) (returns integer)#
Returns a bitmask of controller buttons pressed (triggered) on controller index pad (defaults to controller 0).
Input.pad_hold(pad?) (returns integer)#
Returns a bitmask of controller buttons currently held down on controller index pad (defaults to controller 0).
Input.BUTTON table#
Bitmask constants for matching controller button queries:
| Constant | Value | Button |
|---|---|---|
Input.BUTTON.LEFT | 0x0001 | D-Pad Left |
Input.BUTTON.RIGHT | 0x0002 | D-Pad Right |
Input.BUTTON.DOWN | 0x0004 | D-Pad Down |
Input.BUTTON.UP | 0x0008 | D-Pad Up |
Input.BUTTON.Z | 0x0010 | Z Trigger |
Input.BUTTON.R | 0x0020 | R Trigger |
Input.BUTTON.L | 0x0040 | L Trigger |
Input.BUTTON.A | 0x0100 | A Button |
Input.BUTTON.B | 0x0200 | B Button |
Input.BUTTON.X | 0x0400 | X Button |
Input.BUTTON.Y | 0x0800 | Y Button |
Input.BUTTON.START | 0x1000 | Start / Pause Button |