Module: RbSDL2::Keyboard::ModState
- Included in:
- RbSDL2::Keyboard
- Defined in:
- lib/rb_sdl2/keyboard/mod_state.rb
Constant Summary collapse
- KMOD_NONE =
0x0000- KMOD_LSHIFT =
0x0001- KMOD_RSHIFT =
0x0002- KMOD_LCTRL =
0x0040- KMOD_RCTRL =
0x0080- KMOD_LALT =
0x0100- KMOD_RALT =
0x0200- KMOD_LGUI =
0x0400- KMOD_RGUI =
0x0800- KMOD_NUM =
0x1000- KMOD_CAPS =
0x2000- KMOD_MODE =
0x4000- KMOD_SCROLL =
0x8000- KMOD_CTRL =
KMOD_LCTRL | KMOD_RCTRL
- KMOD_SHIFT =
KMOD_LSHIFT | KMOD_RSHIFT
- KMOD_ALT =
KMOD_LALT | KMOD_RALT
- KMOD_GUI =
KMOD_LGUI | KMOD_RGUI
Class Method Summary collapse
Instance Method Summary collapse
- #alt_key? ⇒ Boolean
- #caps_key? ⇒ Boolean
- #ctrl_key? ⇒ Boolean
- #gui_key? ⇒ Boolean
- #l_alt_key? ⇒ Boolean
- #l_ctrl_key? ⇒ Boolean
- #l_gui_key? ⇒ Boolean
- #l_shift_key? ⇒ Boolean
- #mod_key? ⇒ Boolean
- #mode_key? ⇒ Boolean
- #num_key? ⇒ Boolean
- #r_alt_key? ⇒ Boolean
- #r_ctrl_key? ⇒ Boolean
- #r_gui_key? ⇒ Boolean
- #r_shift_key? ⇒ Boolean
- #scroll_lock_key? ⇒ Boolean
- #shift_key? ⇒ Boolean
Class Method Details
.state ⇒ Object
5 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 5 def state = ::SDL.GetModState |
.state=(num) ⇒ Object
9 10 11 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 9 def state=(num) ::SDL::SetModState(num) end |
.state?(num) ⇒ Boolean
7 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 7 def state?(num) = state & num != 0 |
Instance Method Details
#alt_key? ⇒ Boolean
33 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 33 def alt_key? = ModState.state?(KMOD_ALT) |
#caps_key? ⇒ Boolean
35 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 35 def caps_key? = ModState.state?(KMOD_CAPS) |
#ctrl_key? ⇒ Boolean
37 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 37 def ctrl_key? = ModState.state?(KMOD_CTRL) |
#gui_key? ⇒ Boolean
39 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 39 def gui_key? = ModState.state?(KMOD_GUI) |
#l_alt_key? ⇒ Boolean
41 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 41 def l_alt_key? = ModState.state?(KMOD_LALT) |
#l_ctrl_key? ⇒ Boolean
43 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 43 def l_ctrl_key? = ModState.state?(KMOD_LCTRL) |
#l_gui_key? ⇒ Boolean
45 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 45 def l_gui_key? = ModState.state?(KMOD_LGUI) |
#l_shift_key? ⇒ Boolean
47 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 47 def l_shift_key? = ModState.state?(KMOD_LSHIFT) |
#mod_key? ⇒ Boolean
49 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 49 def mod_key? = ModState.state != 0 |
#mode_key? ⇒ Boolean
51 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 51 def mode_key? = ModState.state?(KMOD_MODE) |
#num_key? ⇒ Boolean
53 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 53 def num_key? = ModState.state?(KMOD_NUM) |
#r_alt_key? ⇒ Boolean
55 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 55 def r_alt_key? = ModState.state?(KMOD_RALT) |
#r_ctrl_key? ⇒ Boolean
57 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 57 def r_ctrl_key? = ModState.state?(KMOD_RCTRL) |
#r_gui_key? ⇒ Boolean
59 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 59 def r_gui_key? = ModState.state?(KMOD_RGUI) |
#r_shift_key? ⇒ Boolean
61 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 61 def r_shift_key? = ModState.state?(KMOD_RSHIFT) |
#scroll_lock_key? ⇒ Boolean
63 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 63 def scroll_lock_key? = ModState.state?(KMOD_SCROLL) |
#shift_key? ⇒ Boolean
65 |
# File 'lib/rb_sdl2/keyboard/mod_state.rb', line 65 def shift_key? = ModState.state?(KMOD_SHIFT) |