Class: SDL2::Event::ControllerDevice

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

Overview

This class represents controller device events (connected/disconnected/remapped).

The event of this event doesn’t occur. Only the event of the following subclasses occur in Ruby/SDL2.

* {SDL2::Event::ControllerDeviceAdded}
* {SDL2::Event::ControllerDeviceRemoved}
* {SDL2::Event::ControllerDeviceRemapped}

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

#whichInteger

the controller index

Returns:

  • (Integer)

Instance Method Details

#inspectString

Returns inspection string.

Returns:

  • (String)

    inspection string



895
896
897
898
899
900
901
# File 'ext/sdl2_ext/event.c', line 895

static VALUE ControllerDevice_inspect(VALUE self)
{
    SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
    return rb_sprintf("<%s: type=%u timestamp=%u which=%d>",
                      rb_obj_classname(self), ev->common.type, ev->common.timestamp,
                      ev->cdevice.which);
}