Class: Rubygame::Events::MouseMoved
- Inherits:
-
Object
- Object
- Rubygame::Events::MouseMoved
- Defined in:
- lib/rubygame/events/mouse_events.rb
Overview
MouseMoved is an event class which occurs when the mouse cursor moves. It has attribute readers for #pos (new position), #rel (change since the last MouseMoved event), and #buttons (an Array of the mouse buttons that were held down while moving).
Instance Attribute Summary collapse
-
#buttons ⇒ Object
readonly
Returns the value of attribute buttons.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
Instance Method Summary collapse
-
#initialize(pos, rel, buttons = []) ⇒ MouseMoved
constructor
Create a new MouseReleased instance.
Constructor Details
#initialize(pos, rel, buttons = []) ⇒ MouseMoved
Create a new MouseReleased instance.
- pos
-
an Array for the new position of the mouse cursor. The point [0,0] is the top-left corner of the window (or the screen if running full-screen). (Array, required)
- rel
-
an Array for the position change since the last MouseMoved event, in pixels. (Array, required)
- buttons
-
an Array of symbols for the mouse buttons that were being held down while the mouse was moving. [] if no buttons were being held. (Array, optional)
140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/rubygame/events/mouse_events.rb', line 140 def initialize( pos, rel, =[] ) @pos = pos.to_ary.dup @pos.freeze @rel = rel.to_ary.dup @rel.freeze = .to_ary.dup .freeze end |
Instance Attribute Details
#buttons ⇒ Object (readonly)
Returns the value of attribute buttons.
123 124 125 |
# File 'lib/rubygame/events/mouse_events.rb', line 123 def end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
123 124 125 |
# File 'lib/rubygame/events/mouse_events.rb', line 123 def pos @pos end |
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
123 124 125 |
# File 'lib/rubygame/events/mouse_events.rb', line 123 def rel @rel end |