Class: Rubydraw::Events::Event
Overview
The basic Event class. All events should inherit from this class, otherwise it won’t be recognized as an event and therefore will not participate in event matching.
Direct Known Subclasses
FocusEvent, KeyboardEvent, MouseMove, MousePressed, MouseReleased, QuitRequest, UnknownEvent, WindowResize
Class Method Summary collapse
-
.from_sdl_event(sdl_event) ⇒ Object
Just creates a new instance of this class by default.
-
.matches?(sdl_event) ⇒ Boolean
Returns true if this is the overlaying class for the given SDL event.
-
.matching_sdl_type ⇒ Object
Returns the matching SDL event, override this in subclasses.
-
.wants_to_match? ⇒ Boolean
Include the class for searching by default.
Instance Method Summary collapse
-
#event? ⇒ Boolean
Returns true for all event objects.
Class Method Details
.from_sdl_event(sdl_event) ⇒ Object
Just creates a new instance of this class by default. Override this if the subclass requires parameters in initialize,
like Rubydraw::Events::MouseDown::from_sdl_event.
42 43 44 |
# File 'lib/rubydraw/events.rb', line 42 def self.from_sdl_event(sdl_event) self.new end |
.matches?(sdl_event) ⇒ Boolean
Returns true if this is the overlaying class for the given SDL event. Override this for custom matching.
48 49 50 |
# File 'lib/rubydraw/events.rb', line 48 def self.matches?(sdl_event) sdl_event.type == matching_sdl_type end |
.matching_sdl_type ⇒ Object
Returns the matching SDL event, override this in subclasses. Returns nil by default.
59 60 61 |
# File 'lib/rubydraw/events.rb', line 59 def self.matching_sdl_type nil end |
.wants_to_match? ⇒ Boolean
Include the class for searching by default.
36 37 38 |
# File 'lib/rubydraw/events.rb', line 36 def self.wants_to_match? true end |
Instance Method Details
#event? ⇒ Boolean
Returns true for all event objects. Also see Object#event?
53 54 55 |
# File 'lib/rubydraw/events.rb', line 53 def event? true end |