Module: Input
- Included in:
- GamePlay::Base
- Defined in:
- docs/00000_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
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
-
.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.
-
.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
359 360 361 |
# File 'docs/00000_Dependencies.rb', line 359 def main_joy @main_joy end |
.x_axis
Get the X axis
361 362 363 |
# File 'docs/00000_Dependencies.rb', line 361 def x_axis @x_axis end |
.x_joy_axis
Get the Joystick X axis
365 366 367 |
# File 'docs/00000_Dependencies.rb', line 365 def x_joy_axis @x_joy_axis end |
.y_axis
Get the Y axis
363 364 365 |
# File 'docs/00000_Dependencies.rb', line 363 def y_axis @y_axis end |
.y_joy_axis
Get the Joystick Y axis
367 368 369 |
# File 'docs/00000_Dependencies.rb', line 367 def y_joy_axis @y_joy_axis end |
Class Method Details
.dir4 ⇒ Integer
Get the 4 direction status
370 371 |
# File 'docs/00000_Dependencies.rb', line 370 def dir4 end |
.dir8 ⇒ Integer
Get the 8 direction status
374 375 |
# File 'docs/00000_Dependencies.rb', line 374 def dir8 end |
.get_text ⇒ String?
Get the last entered text
378 379 |
# File 'docs/00000_Dependencies.rb', line 378 def get_text end |
.joy_axis_position(id, axis) ⇒ Integer
Get the axis position of a joystick
384 385 |
# File 'docs/00000_Dependencies.rb', line 384 def joy_axis_position(id, axis) end |
.press?(key) ⇒ Boolean
Tell if a key is pressed
389 390 |
# File 'docs/00000_Dependencies.rb', line 389 def press?(key) end |
.register_events(window)
Register all events in the window
411 412 |
# File 'docs/00000_Dependencies.rb', line 411 def register_events(window) end |
.released?(key) ⇒ Boolean
Tell if a key was released
399 400 |
# File 'docs/00000_Dependencies.rb', line 399 def released?(key) end |
.repeat?(key) ⇒ Boolean
Tell if a key is repeated (0.25s then each 0.08s)
404 405 |
# File 'docs/00000_Dependencies.rb', line 404 def repeat?(key) end |
.swap_states
Swap the states (each time input gets updated)
407 408 |
# File 'docs/00000_Dependencies.rb', line 407 def swap_states end |
.trigger?(key) ⇒ Boolean
Tell if a key was triggered
394 395 |
# File 'docs/00000_Dependencies.rb', line 394 def trigger?(key) end |