Class: Tea::Mouse::Move
- Inherits:
-
Object
- Object
- Tea::Mouse::Move
- Defined in:
- lib/tea/m_event_mouse.rb
Overview
Event generated when the mouse cursor is moved.
x
,y
-
coordinates of the mouse cursor
buttons
-
an array that may contain
:left
,:middle
and:right
Instance Attribute Summary collapse
-
#buttons ⇒ Object
readonly
Returns the value of attribute buttons.
-
#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) ⇒ Move
constructor
A new instance of Move.
Constructor Details
#initialize(sdl_event) ⇒ Move
Returns a new instance of Move.
21 22 23 24 25 26 27 28 |
# File 'lib/tea/m_event_mouse.rb', line 21 def initialize(sdl_event) @x = sdl_event.x @y = sdl_event.y @buttons = {} @buttons[Mouse::LEFT] = (sdl_event.state & SDL::Mouse::BUTTON_LMASK) != 0 @buttons[Mouse::MIDDLE] = (sdl_event.state & SDL::Mouse::BUTTON_MMASK) != 0 @buttons[Mouse::RIGHT] = (sdl_event.state & SDL::Mouse::BUTTON_RMASK) != 0 end |
Instance Attribute Details
#buttons ⇒ Object (readonly)
Returns the value of attribute buttons.
20 21 22 |
# File 'lib/tea/m_event_mouse.rb', line 20 def @buttons end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
20 21 22 |
# File 'lib/tea/m_event_mouse.rb', line 20 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
20 21 22 |
# File 'lib/tea/m_event_mouse.rb', line 20 def y @y end |