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
95 96 97 |
# File 'lib/sdl2/keyboard.rb', line 95 def self.get_focus() SDL2::get_keyboard_focus() end |
.get_mod ⇒ Object
Get the current key modifier state for the keyboard.
112 113 114 |
# File 'lib/sdl2/keyboard.rb', line 112 def self.get_mod() SDL2::get_mod_state() end |
.get_state ⇒ Object
Get a snapshot of the current state of the keyboard.
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/sdl2/keyboard.rb', line 100 def self.get_state() count = SDL2::TypedPointer::Int.new state = SDL2::get_keyboard_state(count) #binding.pry result = state.get_array_of_uint8(:uint8, :get_uint8, count.value) 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.
118 119 120 |
# File 'lib/sdl2/keyboard.rb', line 118 def self.set_mod(modstate) SDL2::set_mod_state(modstate) end |