Class: Rubydraw::Events::MouseReleased

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

Overview

Created when a mouse button is released. Note: this event is used for any mouse button.

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, button) ⇒ MouseReleased

Creates a new MouseReleased event, specifying where (the position) it happened and what button was released.



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

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

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



173
174
175
# File 'lib/rubydraw/events.rb', line 173

def button
  @button
end

#positionObject (readonly)

Returns the value of attribute position.



173
174
175
# File 'lib/rubydraw/events.rb', line 173

def position
  @position
end

Class Method Details

.from_sdl_event(sdl_event) ⇒ Object



165
166
167
# File 'lib/rubydraw/events.rb', line 165

def self.from_sdl_event(sdl_event)
  self.new(Point[sdl_event.x, sdl_event.y], sdl_event.button)
end

.matching_sdl_typeObject



169
170
171
# File 'lib/rubydraw/events.rb', line 169

def self.matching_sdl_type
  SDL::MOUSEBUTTONUP
end