Module: SDL::Key
- Defined in:
- ext/sdl/sdl.c
Class Method Summary collapse
-
.press?(keycode_) ⇒ Boolean
// SDL::Key methods:.
- .scan ⇒ Object
Class Method Details
.press?(keycode_) ⇒ Boolean
// SDL::Key methods:
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'ext/sdl/sdl.c', line 323
static VALUE Key_s_press_p(VALUE mod, VALUE keycode_) {
UNUSED(mod);
if (!key_state)
rb_raise(eSDLError,
"You should call SDL::Key#scan before calling SDL::Key#press?");
SDL_Keycode keycode = NUM2INT(keycode_);
SDL_Scancode scancode = SDL_GetScancodeFromKey(keycode);
if (0 >= scancode || scancode >= (SDL_Scancode)key_state_len)
rb_raise(eSDLError, "%d (%d) is out of bounds: %d",
keycode, scancode, key_state_len);
return INT2BOOL(key_state[scancode]);
}
|
.scan ⇒ Object
340 341 342 343 344 345 346 347 |
# File 'ext/sdl/sdl.c', line 340
static VALUE Key_s_scan(VALUE mod) {
UNUSED(mod);
key_state = (Uint8 *) SDL_GetKeyboardState(&key_state_len);
mod_state = SDL_GetModState();
return Qnil;
}
|