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.



129
130
131
# File 'lib/rubydraw/events.rb', line 129

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

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



127
128
129
# File 'lib/rubydraw/events.rb', line 127

def button
  @button
end

#positionObject (readonly)

Returns the value of attribute position.



127
128
129
# File 'lib/rubydraw/events.rb', line 127

def position
  @position
end

Instance Method Details

#from_sdl_event(sdl_event) ⇒ Object



123
124
125
# File 'lib/rubydraw/events.rb', line 123

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