Class: ICurses::IMouseEvent
- Inherits:
-
Object
- Object
- ICurses::IMouseEvent
- Defined in:
- lib/ektoplayer/ui.rb,
lib/ektoplayer/icurses/sugar.rb
Instance Attribute Summary collapse
-
#bstate ⇒ Object
Returns the value of attribute bstate.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #from_mouse_event!(m) ⇒ Object
-
#initialize(mouse_event = nil, bstate: 0, x: 0, y: 0, z: 0) ⇒ IMouseEvent
constructor
A new instance of IMouseEvent.
- #pos ⇒ Object
- #to_fake ⇒ Object
- #to_s ⇒ Object
- #update!(x: nil, y: nil, z: nil, bstate: nil) ⇒ Object
Constructor Details
#initialize(mouse_event = nil, bstate: 0, x: 0, y: 0, z: 0) ⇒ IMouseEvent
Returns a new instance of IMouseEvent.
5 6 7 8 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 5 def initialize(mouse_event=nil, bstate: 0, x: 0, y: 0, z: 0) @x, @y, @z, @bstate = x, y, z, bstate from_mouse_event!(mouse_event) end |
Instance Attribute Details
#bstate ⇒ Object
Returns the value of attribute bstate.
3 4 5 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 3 def bstate @bstate end |
#x ⇒ Object
Returns the value of attribute x.
3 4 5 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
3 4 5 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 3 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
3 4 5 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 3 def z @z end |
Instance Method Details
#[](key) ⇒ Object
10 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 10 def [](key) send(key) end |
#[]=(key, value) ⇒ Object
11 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 11 def []=(key, value) send("#{key}=", value) end |
#from_mouse_event!(m) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 13 def from_mouse_event!(m) @x, @y, @z, @bstate = m.x, m.y, m.z, m.bstate rescue begin @x, @y, @z, @bstate = m[:x], m[:y], m[:z], m[:bstate] rescue end end |
#pos ⇒ Object
347 348 349 |
# File 'lib/ektoplayer/ui.rb', line 347 def pos UI::Point.new(x: x, y: y) end |
#to_fake ⇒ Object
351 352 353 |
# File 'lib/ektoplayer/ui.rb', line 351 def to_fake IMouseEvent.new(self) end |
#to_s ⇒ Object
355 356 357 |
# File 'lib/ektoplayer/ui.rb', line 355 def to_s "[(IMouseEvent) bstate=#{bstate}, x=#{x}, y=#{y}, z=#{z}]" end |
#update!(x: nil, y: nil, z: nil, bstate: nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/ektoplayer/icurses/sugar.rb', line 21 def update!(x: nil, y: nil, z: nil, bstate: nil) @x = x if x @y = y if y @z = z if z @bstate = bstate if bstate end |