Class: Rubydraw::Events::MouseMove

Inherits:
Event show all
Defined in:
lib/rubydraw/events.rb

Overview

Created when the mouse is moved.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.



191
192
193
# File 'lib/rubydraw/events.rb', line 191

def initialize(position, relative_position)
  @position, @relative_position = position, relative_position
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



184
185
186
# File 'lib/rubydraw/events.rb', line 184

def position
  @position
end

#relative_positionObject (readonly)

Returns the value of attribute relative_position.



184
185
186
# File 'lib/rubydraw/events.rb', line 184

def relative_position
  @relative_position
end

Class Method Details

.from_sdl_event(sdl_event) ⇒ Object



176
177
178
# File 'lib/rubydraw/events.rb', line 176

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_typeObject



180
181
182
# File 'lib/rubydraw/events.rb', line 180

def self.matching_sdl_type
  SDL::MOUSEMOTION
end