Module: LiteRGSS::Input

Defined in:
LiteRGSS.rb

Overview

Module that helps to know the input state during the game time

The virtual keys of the Input module are : :A, :B, :X, :Y, :L, :R, :L2, :R2, :L3, :R3, :START (:start), :SELECT (:select), :HOME (:home), :UP (:up), :DOWN (:down), :LEFT (:left), :RIGHT (:right)

The binding of these keys can be changed by accessing `Input::Keys`, the id of the keys are one of the constants of `Input::Keyboard` or (-32 * joy_id - button_id - 1) for joypads.

Defined Under Namespace

Modules: Keyboard

Constant Summary

JoyAxisX =

Joypad X axis

0
JoyAxisY =

Joypad Y axis

1
JoyAxisZ =

Joypad Z axis

2
JoyAxisR =

Joypad R axis

3
JoyAxisU =

Joypad U axis

4
JoyAxisV =

Joypad V axis

5
JoyAxisPovX =

Joypad povX axis

6
JoyAxisPovY =

Joypad povY axis

7

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.main_joyInteger

ID of the main joypad (for dir4 and dir8)

Returns:

  • (Integer)

    id of the joypad in SFML

.x_axisInteger

Axis used for the right / left movement

Returns:

  • (Integer)

    one of the JoyAxis constant

.y_axisInteger

Axis used for the up / down movement

Returns:

  • (Integer)

    one of the JoyAxis constant

Class Method Details

.dir4Integer

Indicate the direction of the Inputs : 8 = up, 2 = down, 4 = left, 6 = right

Returns:

  • (Integer)

.dir8Integer

Indicate the direction of the Inputs : 7 = upper left, 9 = upper right, 1 = lower left, 3 = lower right or dir4

Returns:

  • (Integer)

.get_textString?

Note:

If you press CTRL+ the result is “u0001” + A - key, ex : CTRL+C = “u0003”

Return the entered text by the user

Returns:

  • (String, nil)

    nil means no text has been entered

.press?(sym) ⇒ Boolean

Tell if a key is pressed

Parameters:

  • sym (Symbol)

    symbol of the key

Returns:

  • (Boolean)

.released?(sym) ⇒ Boolean

Tell if a key has been released

Parameters:

  • sym (Symbol)

    symbol of the key

Returns:

  • (Boolean)

.repeat?(sym) ⇒ Boolean

Tell if a key has been triggered and is still pressed (each period of time ~8 frames after the 20 first frames)

Parameters:

  • sym (Symbol)

    symbol of the key

Returns:

  • (Boolean)

.trigger?(sym) ⇒ Boolean

Tell if a key has been triggered

Parameters:

  • sym (Symbol)

    symbol of the key

Returns:

  • (Boolean)