Module: Input
- Included in:
- GamePlay::Base
- Defined in:
- docs/0_Dependencies.rb
Overview
The virtual keys of the Input module are : :A, :B, :X, :Y, :L, :R, :L2, :R2, :L3, :R3, :START, :SELECT, :HOME, :UP, :DOWN, :LEFT, :RIGHT
Defined Under Namespace
Classes: InputTouch, RepeatKeyHandler
Constant Summary collapse
- Keyboard =
Alias for the Keyboard module
Sf::Keyboard
- DEAD_ZONE =
Range giving dead zone of axis
-20..20
- NON_TRIGGER_ZONE =
Range outside of which a trigger is considered on an exis
-50..50
- AXIS_SENSITIVITY =
Sensitivity in order to take a trigger in account on joystick movement
10- REPEAT_COOLDOWN =
Cooldown delta of Input.repeat?
0.25- REPEAT_SPACE =
Time between each signals of Input.repeat? after cooldown
0.08- Keys =
List of keys the input knows
{A: [s::C, s::Space, s::Enter, s::NumpadEnter, -1], B: [s::X, s::Backspace, s::Escape, s::LShift, -2], X: [s::V, s::Menu, s::Numpad3, s::V, -3], Y: [s::B, s::Numpad1, s::RShift, s::B, -4], L: [s::F, s::Num1, s::Numpad7, s::F, -5], R: [s::G, s::Num3, s::Numpad9, s::G, -6], L2: [s::R, s::R, s::R, s::R, -7], R2: [s::T, s::T, s::T, s::T, -8], L3: [s::Num4, s::Num4, s::Y, s::F2, -9], R3: [s::Num5, s::Num5, s::U, s::F3, -10], START: [s::J, s::J, s::Insert, s::Insert, -8], SELECT: [s::H, s::H, s::Pause, s::Pause, -7], HOME: [s::Semicolon, s::Semicolon, s::Home, s::Home, 255], UP: [s::Up, s::W, s::Numpad8, s::Up, -13], DOWN: [s::Down, s::S, s::Numpad2, s::Down, -14], LEFT: [s::Left, s::A, s::Numpad4, s::Left, -15], RIGHT: [s::Right, s::D, s::Numpad6, s::Right, -16]}
- ALIAS_KEYS =
List of key ALIAS
{up: :UP, down: :DOWN, left: :LEFT, right: :RIGHT, a: :A, b: :B, x: :X, y: :Y, start: :START, select: :SELECT}
- AXIS_MAPPING =
List of Axis mapping (axis => key_neg, key_pos)
{Sf::Joystick::Z => %i[R2 L2]}
Class Attribute Summary collapse
-
.main_joy ⇒ Integer
Get the main joystick.
-
.x_axis
Get the X axis.
-
.x_joy_axis
Get the Joystick X axis.
-
.y_axis
Get the Y axis.
-
.y_joy_axis
Get the Joystick Y axis.
Class Method Summary collapse
-
.clear
Clear the inputs (#press? #trigger? #repeat? #released?).
-
.close_virtual_keyboard
Force the closing of the virtual keyboard (only works on platform where virtual keyboards are supported).
-
.dir4 ⇒ Integer
Get the 4 direction status.
-
.dir8 ⇒ Integer
Get the 8 direction status.
-
.get_text ⇒ String?
Get the last entered text.
-
.joy_axis_position(id, axis) ⇒ Integer
Get the axis position of a joystick.
-
.load_touch_screen
Load the touch screen interface.
-
.open_virtual_keyboard
Force the opening of the virtual keyboard (only works on platform where virtual keyboards are supported).
-
.press?(key) ⇒ Boolean
Tell if a key is pressed.
-
.register_events(window)
Register all events in the window.
-
.released?(key) ⇒ Boolean
Tell if a key was released.
-
.repeat?(key) ⇒ Boolean
Tell if a key is repeated (0.25s then each 0.08s).
-
.swap_states
Swap the states (each time input gets updated).
-
.trigger?(key) ⇒ Boolean
Tell if a key was triggered.
Class Attribute Details
.main_joy ⇒ Integer
Get the main joystick
981 982 983 |
# File 'docs/0_Dependencies.rb', line 981 def main_joy @main_joy end |
.x_axis
Get the X axis
983 984 985 |
# File 'docs/0_Dependencies.rb', line 983 def x_axis @x_axis end |
.x_joy_axis
Get the Joystick X axis
987 988 989 |
# File 'docs/0_Dependencies.rb', line 987 def x_joy_axis @x_joy_axis end |
.y_axis
Get the Y axis
985 986 987 |
# File 'docs/0_Dependencies.rb', line 985 def y_axis @y_axis end |
.y_joy_axis
Get the Joystick Y axis
989 990 991 |
# File 'docs/0_Dependencies.rb', line 989 def y_joy_axis @y_joy_axis end |
Class Method Details
.clear
Clear the inputs (#press? #trigger? #repeat? #released?)
1003 1004 |
# File 'docs/0_Dependencies.rb', line 1003 def clear end |
.close_virtual_keyboard
Force the closing of the virtual keyboard (only works on platform where virtual keyboards are supported)
1027 1028 |
# File 'docs/0_Dependencies.rb', line 1027 def close_virtual_keyboard end |
.dir4 ⇒ Integer
Get the 4 direction status
992 993 |
# File 'docs/0_Dependencies.rb', line 992 def dir4 end |
.dir8 ⇒ Integer
Get the 8 direction status
996 997 |
# File 'docs/0_Dependencies.rb', line 996 def dir8 end |
.get_text ⇒ String?
Get the last entered text
1000 1001 |
# File 'docs/0_Dependencies.rb', line 1000 def get_text end |
.joy_axis_position(id, axis) ⇒ Integer
Get the axis position of a joystick
1009 1010 |
# File 'docs/0_Dependencies.rb', line 1009 def joy_axis_position(id, axis) end |
.load_touch_screen
Load the touch screen interface
1182 1183 |
# File 'docs/0_Dependencies.rb', line 1182 def load_touch_screen end |
.open_virtual_keyboard
Force the opening of the virtual keyboard (only works on platform where virtual keyboards are supported)
1023 1024 |
# File 'docs/0_Dependencies.rb', line 1023 def open_virtual_keyboard end |
.press?(key) ⇒ Boolean
Tell if a key is pressed
1014 1015 |
# File 'docs/0_Dependencies.rb', line 1014 def press?(key) end |
.register_events(window)
Register all events in the window
1044 1045 |
# File 'docs/0_Dependencies.rb', line 1044 def register_events(window) end |
.released?(key) ⇒ Boolean
Tell if a key was released
1032 1033 |
# File 'docs/0_Dependencies.rb', line 1032 def released?(key) end |
.repeat?(key) ⇒ Boolean
Tell if a key is repeated (0.25s then each 0.08s)
1037 1038 |
# File 'docs/0_Dependencies.rb', line 1037 def repeat?(key) end |
.swap_states
Swap the states (each time input gets updated)
1040 1041 |
# File 'docs/0_Dependencies.rb', line 1040 def swap_states end |
.trigger?(key) ⇒ Boolean
Tell if a key was triggered
1019 1020 |
# File 'docs/0_Dependencies.rb', line 1019 def trigger?(key) end |