Class: Tea::Mouse::Up
- Inherits:
-
Object
- Object
- Tea::Mouse::Up
- 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
-
#button ⇒ Object
readonly
Returns the value of attribute button.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(sdl_event) ⇒ Up
constructor
A new instance of Up.
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. 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
#button ⇒ Object (readonly)
Returns the value of attribute button.
54 55 56 |
# File 'lib/tea/m_event_mouse.rb', line 54 def @button end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
54 55 56 |
# File 'lib/tea/m_event_mouse.rb', line 54 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
54 55 56 |
# File 'lib/tea/m_event_mouse.rb', line 54 def y @y end |