Class: Rubydraw::Events::MouseMove
- Defined in:
- lib/rubydraw/events.rb
Overview
Created when the mouse is moved.
Instance Attribute Summary collapse
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#relative_position ⇒ Object
readonly
Returns the value of attribute relative_position.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(position, relative_position) ⇒ MouseMove
constructor
Create a new MouseMove event with the new mouse position.
-
#x ⇒ Object
Returns the new x positon of the mouse.
-
#y ⇒ Object
Returns the new y mouse positon.
Methods inherited from Event
#event?, matches?, wants_to_match?
Constructor Details
#initialize(position, relative_position) ⇒ MouseMove
Create a new MouseMove event with the new mouse position.
x
and y
: The new position of the cursor.
relative_x
and relative_y
: The relative movement of the cursor since the lasttick.
199 200 201 |
# File 'lib/rubydraw/events.rb', line 199 def initialize(position, relative_position) @position, @relative_position = position, relative_position end |
Instance Attribute Details
#position ⇒ Object (readonly)
Returns the value of attribute position.
192 193 194 |
# File 'lib/rubydraw/events.rb', line 192 def position @position end |
#relative_position ⇒ Object (readonly)
Returns the value of attribute relative_position.
192 193 194 |
# File 'lib/rubydraw/events.rb', line 192 def relative_position @relative_position end |
Class Method Details
.from_sdl_event(sdl_event) ⇒ Object
184 185 186 |
# File 'lib/rubydraw/events.rb', line 184 def self.from_sdl_event(sdl_event) self.new(Point[sdl_event.x, sdl_event.y], Point[sdl_event.xrel, sdl_event.yrel]) end |
.matching_sdl_type ⇒ Object
188 189 190 |
# File 'lib/rubydraw/events.rb', line 188 def self.matching_sdl_type SDL::MOUSEMOTION end |