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)
-
- (Integer) button
the mouse button index.
-
- (Integer) clicks
1 for single click, 2 for double click.
-
- (Boolean) pressed
(also: #pressed?)
button is pressed or not.
-
- (Integer) which
the mouse index.
-
- (Integer) window_id
the window id with mouse focus.
-
- (Integer) x
the x coordinate of the mouse pointer, relative to window.
-
- (Integer) y
the y coordinate of the mouse pointer, relative to window.
Attributes inherited from SDL2::Event
Instance Method Summary (collapse)
-
- (String) inspect
Inspection string.
Methods inherited from SDL2::Event
enable=, enabled?, poll, #window
Instance Attribute Details
- (Integer) button
the mouse button index
- (Integer) clicks
1 for single click, 2 for double click
This attribute is available after SDL 2.0.2
- (Boolean) pressed Also known as: pressed?
button is pressed or not
- (Integer) which
the mouse index
- (Integer) window_id
the window id with mouse focus
- (Integer) x
the x coordinate of the mouse pointer, relative to window
- (Integer) y
the y coordinate of the mouse pointer, relative to window
Instance Method Details
- (String) inspect
Returns inspection string
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'event.c', line 501
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);
}
|