Class: Tea::Mouse::Up

Inherits:
Object
  • Object
show all
Defined in:
lib/tea/m_event_mouse.rb

Overview

Event generated when a mouse button that was held down is released.

x, y

coordinates of the mouse cursor

button

the mouse button that was released: :left, :middle or :right

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdl_event) ⇒ Up

Returns a new instance of Up.



55
56
57
58
59
60
61
62
63
# File 'lib/tea/m_event_mouse.rb', line 55

def initialize(sdl_event)
  @x = sdl_event.x
  @y = sdl_event.y
  case sdl_event.button
  when SDL::Mouse::BUTTON_LEFT   then @button = Mouse::LEFT
  when SDL::Mouse::BUTTON_MIDDLE then @button = Mouse::MIDDLE
  when SDL::Mouse::BUTTON_RIGHT  then @button = Mouse::RIGHT
  end
end

Instance Attribute Details

#buttonObject (readonly)

Returns the value of attribute button.



54
55
56
# File 'lib/tea/m_event_mouse.rb', line 54

def button
  @button
end

#xObject (readonly)

Returns the value of attribute x.



54
55
56
# File 'lib/tea/m_event_mouse.rb', line 54

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



54
55
56
# File 'lib/tea/m_event_mouse.rb', line 54

def y
  @y
end