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

- (Integer) mod

current key modifier

Returns:

  • (Integer)

See Also:

- (Integer) pressed Also known as: pressed?

key is pressed

Returns:

  • (Integer)

- (Integer) repeat Also known as: repeat?

key repeat

Returns:

  • (Integer)

- (Integer) scancode

physical key code

Returns:

  • (Integer)

See Also:

- (Integer) sym

virtual key code

Returns:

  • (Integer)

See Also:

- (Integer) window_id

the associate window id

Returns:

  • (Integer)

Instance Method Details

- (String) inspect

Returns inspection string

Returns:

  • (String)

    inspection string



351
352
353
354
355
356
357
358
359
360
# File 'event.c', line 351

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);
}