Module: Input
- Includes:
- Gosu
- Defined in:
- lib/rgss3/input.rb
Overview
Usage: Input.trigger?(2) Input.trigger?(:DOWN) Input.trigger?(Input::KB_DOWN) Input.trigger?(Input::Key)
Defined Under Namespace
Classes: Key
Constant Summary collapse
- KEY_TO_INT =
{ DOWN: 2, LEFT: 4, RIGHT: 6, UP: 8, A: 11, B: 12, C: 13, X: 14, Y: 15, Z: 16, L: 17, R: 18, SHIFT: 21, CTRL: 22, ALT: 23, F5: 25, F6: 26, F7: 27, F8: 28, F9: 29 }
- KEY_TO_INT_PROC =
KEY_TO_INT.to_proc
- KEY_MAPPER =
{ KB_ENTER => C, KB_LEFT_SHIFT => [SHIFT, A], KB_RIGHT_SHIFT => [SHIFT, A], KB_LEFT_CONTROL => CTRL, KB_RIGHT_CONTROL => CTRL, KB_LEFT_ALT => ALT, KB_RIGHT_ALT => ALT, KB_SPACE => C, KB_ESCAPE => B, KB_DOWN => DOWN, KB_LEFT => LEFT, KB_RIGHT => RIGHT, KB_UP => UP, KB_INSERT => B, KB_NUMPAD_0 => B, KB_NUMPAD_2 => DOWN, KB_NUMPAD_4 => LEFT, KB_NUMPAD_6 => RIGHT, KB_NUMPAD_8 => UP, KB_F5 => F5, KB_F6 => F6, KB_F7 => F7, KB_F8 => F8, KB_F9 => F9, KB_Z => C, KB_X => B, KB_A => X, KB_S => Y, KB_D => Z, KB_Q => L, KB_W => R }.freeze
- REVERSE_KEY_MAPPER =
{}
Class Method Summary collapse
- .dir4 ⇒ Object
- .dir8 ⇒ Object
- .press?(key) ⇒ Boolean
- .repeat?(key) ⇒ Boolean
- .trigger?(key) ⇒ Boolean
- .update ⇒ Object
Class Method Details
.dir4 ⇒ Object
123 124 125 |
# File 'lib/rgss3/input.rb', line 123 def self.dir4 @dir_4_8[0] end |
.dir8 ⇒ Object
127 128 129 |
# File 'lib/rgss3/input.rb', line 127 def self.dir8 @dir_4_8[1] end |
.press?(key) ⇒ Boolean
115 116 117 |
# File 'lib/rgss3/input.rb', line 115 def self.press?(key) presstime?(key, &:positive?) end |
.repeat?(key) ⇒ Boolean
119 120 121 |
# File 'lib/rgss3/input.rb', line 119 def self.repeat?(key) presstime?(key) { |t| t == 1 || t > 23 && t % 6 == 0 } end |
.trigger?(key) ⇒ Boolean
111 112 113 |
# File 'lib/rgss3/input.rb', line 111 def self.trigger?(key) presstime?(key) { |t| t == 1 } end |