Class: Rubydraw::Events::MouseButtonEvent

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

Overview

Provides methods used in Rubydraw::Events::MousePressed and Rubydraw::Events::MouseReleased. No instances of this class should be created, but instances of subclasses are find.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(position, button) ⇒ MouseButtonEvent

Returns a new instance of MouseButtonEvent.



137
138
139
# File 'lib/rubydraw/events.rb', line 137

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

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



135
136
137
# File 'lib/rubydraw/events.rb', line 135

def button
  @button
end

#positionObject (readonly)

Returns the value of attribute position.



135
136
137
# File 'lib/rubydraw/events.rb', line 135

def position
  @position
end

Instance Method Details

#from_sdl_event(sdl_event) ⇒ Object



131
132
133
# File 'lib/rubydraw/events.rb', line 131

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