Class: Rubydraw::Events::MousePressed
- Defined in:
- lib/rubydraw/events.rb
Overview
Created when a mouse button is down. Note: this event is used for any mouse button.
Instance Attribute Summary collapse
-
#button ⇒ Object
readonly
Returns the value of attribute button.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(position, button) ⇒ MousePressed
constructor
Creates a new MousePressed event, specifying where (the position) it happened and what button was pressed.
Methods inherited from Event
#event?, matches?, wants_to_match?
Constructor Details
#initialize(position, button) ⇒ MousePressed
Creates a new MousePressed event, specifying where (the position) it happened and what button was pressed.
157 158 159 |
# File 'lib/rubydraw/events.rb', line 157 def initialize(position, ) @position, @button = position, end |
Instance Attribute Details
#button ⇒ Object (readonly)
Returns the value of attribute button.
153 154 155 |
# File 'lib/rubydraw/events.rb', line 153 def @button end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
153 154 155 |
# File 'lib/rubydraw/events.rb', line 153 def position @position end |
Class Method Details
.from_sdl_event(sdl_event) ⇒ Object
145 146 147 |
# File 'lib/rubydraw/events.rb', line 145 def self.from_sdl_event(sdl_event) self.new(Point[sdl_event.x, sdl_event.y], sdl_event.) end |
.matching_sdl_type ⇒ Object
149 150 151 |
# File 'lib/rubydraw/events.rb', line 149 def self.matching_sdl_type SDL::MOUSEBUTTONDOWN end |