Class: SDL2::Event::MouseButton
- Inherits:
-
SDL2::Event
- Object
- SDL2::Event
- SDL2::Event::MouseButton
- Defined in:
- event.c,
event.c
Overview
This class represents mouse button events.
You don’t handle the instance of this class directly, but you handle the instances of two subclasses of this subclasses: MouseButtonDown and MouseButtonUp.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#button ⇒ Integer
the mouse button index.
-
#clicks ⇒ Integer
1 for single click, 2 for double click.
-
#pressed ⇒ Boolean
(also: #pressed?)
button is pressed or not.
-
#which ⇒ Integer
the mouse index.
-
#window_id ⇒ Integer
the window id with mouse focus.
-
#x ⇒ Integer
the x coordinate of the mouse pointer, relative to window.
-
#y ⇒ Integer
the y coordinate of the mouse pointer, relative to window.
Attributes inherited from SDL2::Event
Instance Method Summary collapse
-
#inspect ⇒ String
Inspection string.
Methods inherited from SDL2::Event
enable=, enabled?, poll, #window
Instance Attribute Details
#button ⇒ Integer
the mouse button index
#clicks ⇒ Integer
1 for single click, 2 for double click
This attribute is available after SDL 2.0.2
#pressed ⇒ Boolean Also known as: pressed?
button is pressed or not
#which ⇒ Integer
the mouse index
#window_id ⇒ Integer
the window id with mouse focus
#x ⇒ Integer
the x coordinate of the mouse pointer, relative to window
#y ⇒ Integer
the y coordinate of the mouse pointer, relative to window
Instance Method Details
#inspect ⇒ String
Returns inspection string
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'event.c', line 508
static VALUE EvMouseButton_inspect(VALUE self)
{
SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
return rb_sprintf("<%s: type=%u timestamp=%u"
" window_id=%u which=%u button=%hhu pressed=%s"
#if SDL_VERSION_ATLEAST(2,0,2)
" clicks=%hhu"
#endif
" x=%d y=%d>",
rb_obj_classname(self), ev->common.type, ev->common.timestamp,
ev->button.windowID, ev->button.which,
ev->button.button, INT2BOOLCSTR(ev->button.state),
#if SDL_VERSION_ATLEAST(2,0,2)
ev->button.clicks,
#endif
ev->button.x, ev->button.y);
}
|