Class: Tea::Mouse::Down
- Inherits:
-
Object
- Object
- Tea::Mouse::Down
- Defined in:
- lib/tea/m_event_mouse.rb
Overview
Event generated when a mouse button is held down.
x
,y
-
coordinates of the mouse cursor
button
-
the mouse button that is down:
: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) ⇒ Down
constructor
A new instance of Down.
Constructor Details
#initialize(sdl_event) ⇒ Down
Returns a new instance of Down.
37 38 39 40 41 42 43 44 45 |
# File 'lib/tea/m_event_mouse.rb', line 37 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.
36 37 38 |
# File 'lib/tea/m_event_mouse.rb', line 36 def @button end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
36 37 38 |
# File 'lib/tea/m_event_mouse.rb', line 36 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
36 37 38 |
# File 'lib/tea/m_event_mouse.rb', line 36 def y @y end |