Class: SDL2::Event::TouchFinger

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

Overview

This class represents touch finger events.

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

Direct Known Subclasses

FingerDown, FingerMotion, FingerUp

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

#finger_idInteger

the finger id

Returns:

  • (Integer)

#pressureFloat

the quantity of pressure applied, normalized (0…1)

Returns:

  • (Float)

#touch_idInteger

the touch device id

Returns:

  • (Integer)

#xFloat

the x-axis location of the touch event, normalized (0…1)

Returns:

  • (Float)

#yFloat

the y-axis location of the touch event, normalized (0…1)

Returns:

  • (Float)

Instance Method Details

#inspectString

Returns inspection string

Returns:

  • (String)

    inspection string



954
955
956
957
958
959
960
961
962
963
# File 'event.c', line 954

static VALUE EvTouchFinger_inspect(VALUE self)
{
    SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
    return rb_sprintf("<%s: type=%u timestamp=%u"
                      " touch_id=%d finger_id=%d"
                      " x=%f y=%f pressure=%f>",
                      rb_obj_classname(self), ev->common.type, ev->common.timestamp,
                      (int)ev->tfinger.touchId, (int)ev->tfinger.fingerId,
                      ev->tfinger.x, ev->tfinger.y, ev->tfinger.pressure);
}