Input

A module that handles input data from a gamepad or keyboard.

Module Methods

Input.update

Updates input data. As a rule, this method is called once per frame.

Input.press?(num)

Determines whether the button num is currently being pressed.

If the button is being pressed, returns TRUE. If not, returns FALSE.

if Input.press?(Input::C)
  do_something
end
Input.trigger?(num)

Determines whether the button num is being pressed again.

"Pressed again" is seen as time having passed between the button being not pressed and being pressed.

If the button is being pressed, returns TRUE. If not, returns FALSE.

Input.repeat?(num)

Determines whether the button num is being pressed again.

Unlike trigger?, takes into account the repeat input of a button being held down continuously.

If the button is being pressed, returns TRUE. If not, returns FALSE.

Input.dir4

Checks the status of the directional buttons, translates the data into a specialized 4-direction input format, and returns the number pad equivalent (2, 4, 6, 8).

If no directional buttons are being pressed (or the equivalent), returns 0.

Input.dir8

Checks the status of the directional buttons, translates the data into a specialized 8-direction input format, and returns the number pad equivalent (1, 2, 3, 4, 6, 7, 8, 9).

If no directional buttons are being pressed (or the equivalent), returns 0.

Constants

DOWN LEFT RIGHT UP

Numbers corresponding to the directions down, left, right, and up.

A B C X Y Z L R

Numbers corresponding to the various controller buttons.

SHIFT CTRL ALT

Numbers directly corresponding to the keyboard's SHIFT, CTRL, and ALT keys.

F5 F6 F7 F8 F9

Numbers corresponding to the keyboard's function keys. The other function keys are reserved by the system and cannot be obtained.

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)