Class: Tea::Mouse::Scroll
- Inherits:
-
Object
- Object
- Tea::Mouse::Scroll
- Defined in:
- lib/tea/m_event_mouse.rb
Overview
Event generated when the mouse wheel is scrolled.
x
,y
-
coordinates of the mouse cursor.
delta
-
1 when scrolling down, -1 when scrolling up.
Instance Attribute Summary collapse
-
#delta ⇒ Object
readonly
Returns the value of attribute delta.
-
#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) ⇒ Scroll
constructor
A new instance of Scroll.
Constructor Details
#initialize(sdl_event) ⇒ Scroll
Returns a new instance of Scroll.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/tea/m_event_mouse.rb', line 72 def initialize(sdl_event) @x = sdl_event.x @y = sdl_event.y case sdl_event. when Event::BUTTON_WHEELDOWN_ then @delta = 1 when Event::BUTTON_WHEELUP_ then @delta = -1 else raise Tea::Error, "Tea::Mouse::Scroll given an unexpected event: #{sdl_event.inspect}", caller end end |
Instance Attribute Details
#delta ⇒ Object (readonly)
Returns the value of attribute delta.
71 72 73 |
# File 'lib/tea/m_event_mouse.rb', line 71 def delta @delta end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
71 72 73 |
# File 'lib/tea/m_event_mouse.rb', line 71 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
71 72 73 |
# File 'lib/tea/m_event_mouse.rb', line 71 def y @y end |