Class: SDL2::Event::JoyButton

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

Overview

This class represents joystick button events.

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

Direct Known Subclasses

JoyButtonDown, JoyButtonUp

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

#buttonInteger

the joystick button index

Returns:

  • (Integer)

#pressedBoolean Also known as: pressed?

button is pressed or not

Returns:

  • (Boolean)

#whichInteger

the joystick index

Returns:

  • (Integer)

Instance Method Details

#inspectString

Returns inspection string

Returns:

  • (String)

    inspection string



652
653
654
655
656
657
658
659
660
# File 'event.c', line 652

static VALUE EvJoyButton_inspect(VALUE self)
{
    SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
    return rb_sprintf("<%s: type=%u timestamp=%u"
                      " which=%d button=%u pressed=%s>",
                      rb_obj_classname(self), ev->common.type, ev->common.timestamp,
                      ev->jbutton.which, ev->jbutton.button,
                      INT2BOOLCSTR(ev->jbutton.state));
}