Module: SDL2::Key::Mod
- Defined in:
- ext/sdl2_ext/key.c,
ext/sdl2_ext/key.c
Overview
This module has key modifier bitmask constants and some functions to handle key modifier states.
Constant Summary collapse
- NONE =
0 (no modifier is applicable)
INT2NUM(KMOD_NONE)
- LSHIFT =
the modifier key bit mask for the left shift key
INT2NUM(KMOD_LSHIFT)
- RSHIFT =
the modifier key bit mask for the right shift key
INT2NUM(KMOD_RSHIFT)
- LCTRL =
the modifier key bit mask for the left control key
INT2NUM(KMOD_LCTRL)
- RCTRL =
the modifier key bit mask for the right control key
INT2NUM(KMOD_RCTRL)
- LALT =
the modifier key bit mask for the left alt key
INT2NUM(KMOD_LALT)
- RALT =
the modifier key bit mask for the right alt key
INT2NUM(KMOD_RALT)
- LGUI =
the modifier key bit mask for the left GUI key (often the window key)
INT2NUM(KMOD_LGUI)
- RGUI =
the modifier key bit mask for the right GUI key (often the window key)
INT2NUM(KMOD_RGUI)
- NUM =
the modifier key bit mask for the numlock key
INT2NUM(KMOD_NUM)
- CAPS =
the modifier key bit mask for the capslock key
INT2NUM(KMOD_CAPS)
- MODE =
the modifier key bit mask for the mode key (AltGr)
INT2NUM(KMOD_MODE)
- CTRL =
the modifier key bit mask for the left and right control key
INT2NUM(KMOD_CTRL)
- SHIFT =
the modifier key bit mask for the left and right shift key
INT2NUM(KMOD_SHIFT)
- ALT =
the modifier key bit mask for the left and right alt key
INT2NUM(KMOD_ALT)
- GUI =
the modifier key bit mask for the left and right GUI key
INT2NUM(KMOD_GUI)
- RESERVED =
reserved for future use
INT2NUM(KMOD_RESERVED)
Class Method Summary collapse
-
.state ⇒ Integer
Get the current key modifier state.
-
.state=(keymod) ⇒ keymod
Set the current key modifier state.
Class Method Details
.state ⇒ Integer
Get the current key modifier state
You can examine whether the modifier key is pressed using bitmask constants of SDL2::Key::Mod.
150 151 152 153 |
# File 'ext/sdl2_ext/key.c', line 150
static VALUE Mod_s_state(VALUE self)
{
return UINT2NUM(SDL_GetModState());
}
|
.state=(keymod) ⇒ keymod
This does not change the keyboard state, only the key modifier flags.
Set the current key modifier state
165 166 167 168 169 |
# File 'ext/sdl2_ext/key.c', line 165
static VALUE Mod_s_set_state(VALUE self, VALUE keymod)
{
SDL_SetModState(NUM2UINT(keymod));
return Qnil;
}
|