Class: DXOpal::Input::Touch
- Inherits:
-
Object
- Object
- DXOpal::Input::Touch
- Defined in:
- lib/dxopal/input.rb
Overview
Represents a touch
Instance Attribute Summary collapse
-
#_released_at ⇒ Object
readonly
Returns the value of attribute _released_at.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #_move(x, y) ⇒ Object
- #_released(tick) ⇒ Object
-
#initialize(id, x, y) ⇒ Touch
constructor
A new instance of Touch.
- #inspect ⇒ Object
-
#released? ⇒ Boolean
Return true if this touch is released in the last tick.
Constructor Details
#initialize(id, x, y) ⇒ Touch
Returns a new instance of Touch.
278 279 280 281 282 283 |
# File 'lib/dxopal/input.rb', line 278 def initialize(id, x, y) @id = id _move(x, y) @_released_at = nil @data = {} end |
Instance Attribute Details
#_released_at ⇒ Object (readonly)
Returns the value of attribute _released_at.
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def _released_at @_released_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def id @id end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def y @y end |
Instance Method Details
#_move(x, y) ⇒ Object
296 297 298 299 |
# File 'lib/dxopal/input.rb', line 296 def _move(x, y) @x = x @y = y end |
#_released(tick) ⇒ Object
301 302 303 |
# File 'lib/dxopal/input.rb', line 301 def _released(tick) @_released_at = tick end |
#inspect ⇒ Object
291 292 293 294 |
# File 'lib/dxopal/input.rb', line 291 def inspect rel = (released_at ? " released_at=#{released_at}" : "") "#<DXOpal::Touch id=#{id} x=#{x} y=#{y} data=#{data.inspect}#{rel}>" end |
#released? ⇒ Boolean
Return true if this touch is released in the last tick
287 288 289 |
# File 'lib/dxopal/input.rb', line 287 def released? !!@_released_at end |