Module: SDL2::Keyboard
- Defined in:
- lib/sdl2/keyboard.rb
Class Method Summary collapse
-
.get_focus ⇒ Object
Get the window which currently has keyboard focus.
-
.get_mod ⇒ Object
Get the current key modifier state for the keyboard.
-
.get_state ⇒ Object
Get a snapshot of the current state of the keyboard.
-
.set_mod(modstate) ⇒ Object
Set the current key modifire state for the keyboard.
Class Method Details
.get_focus ⇒ Object
Get the window which currently has keyboard focus
94 95 96 |
# File 'lib/sdl2/keyboard.rb', line 94 def self.get_focus() SDL2::get_keyboard_focus() end |
.get_mod ⇒ Object
Get the current key modifier state for the keyboard.
109 110 111 |
# File 'lib/sdl2/keyboard.rb', line 109 def self.get_mod() SDL2::get_mod_state() end |
.get_state ⇒ Object
Get a snapshot of the current state of the keyboard.
99 100 101 102 103 104 105 106 |
# File 'lib/sdl2/keyboard.rb', line 99 def self.get_state() count = FFI::MemoryPointer.new :int, 1 state = FFI::Pointer.new :uint8, SDL2::get_keyboard_state(count) result = state.get_array_of_int(0, count.get_int(0)) count.free state.free return result end |
.set_mod(modstate) ⇒ Object
Note:
This does not change the keyboard state, only the key modifier flags.
Set the current key modifire state for the keyboard.
115 116 117 |
# File 'lib/sdl2/keyboard.rb', line 115 def self.set_mod(modstate) SDL2::set_mod_state(modstate) end |