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.
275 276 277 278 279 280 |
# File 'lib/dxopal/input.rb', line 275 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.
281 282 283 |
# File 'lib/dxopal/input.rb', line 281 def _released_at @_released_at end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
281 282 283 |
# File 'lib/dxopal/input.rb', line 281 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
281 282 283 |
# File 'lib/dxopal/input.rb', line 281 def id @id end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
281 282 283 |
# File 'lib/dxopal/input.rb', line 281 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
281 282 283 |
# File 'lib/dxopal/input.rb', line 281 def y @y end |
Instance Method Details
#_move(x, y) ⇒ Object
293 294 295 296 |
# File 'lib/dxopal/input.rb', line 293 def _move(x, y) @x = x @y = y end |
#_released(tick) ⇒ Object
298 299 300 |
# File 'lib/dxopal/input.rb', line 298 def _released(tick) @_released_at = tick end |
#inspect ⇒ Object
288 289 290 291 |
# File 'lib/dxopal/input.rb', line 288 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
284 285 286 |
# File 'lib/dxopal/input.rb', line 284 def released? !!@_released_at end |