Class: SDL2::Event::Keyboard

Inherits:
SDL2::Event show all
Defined in:
event.c,
event.c

Overview

This class represents keyboard event.

You don’t handle the instance of this class directly, but you handle the instances of two subclasses of this subclasses: KeyDown and KeyUp.

Direct Known Subclasses

KeyDown, KeyUp

Instance Attribute Summary collapse

Attributes inherited from SDL2::Event

#timestamp, #type

Instance Method Summary collapse

Methods inherited from SDL2::Event

enable=, enabled?, poll, #window

Instance Attribute Details

#modInteger

current key modifier

Returns:

  • (Integer)

See Also:

#pressedInteger Also known as: pressed?

key is pressed

Returns:

  • (Integer)

#repeatInteger Also known as: repeat?

key repeat

Returns:

  • (Integer)

#scancodeInteger

physical key code

Returns:

  • (Integer)

See Also:

#symInteger

virtual key code

Returns:

  • (Integer)

See Also:

#window_idInteger

the associate window id

Returns:

  • (Integer)

Instance Method Details

#inspectString

Returns inspection string

Returns:

  • (String)

    inspection string



358
359
360
361
362
363
364
365
366
367
# File 'event.c', line 358

static VALUE EvKeyboard_inspect(VALUE self)
{
    SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
    return rb_sprintf("<%s: type=%u timestamp=%u"
                      " window_id=%u state=%u repeat=%u"
                      " scancode=%u sym=%u mod=%u>",
                      rb_obj_classname(self), ev->common.type, ev->common.timestamp,
                      ev->key.windowID, ev->key.state, ev->key.repeat,
                      ev->key.keysym.scancode, ev->key.keysym.sym, ev->key.keysym.mod);
}