Class: Thing
- Defined in:
- ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
-
#vector ⇒ Object
Returns the value of attribute vector.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(pos = nil, vec = nil) ⇒ Thing
constructor
A new instance of Thing.
- #move ⇒ Object
- #pixelsPerSecToPixelsPerMove(pixelsPerSecond) ⇒ Object
Constructor Details
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
12 13 14 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 12 def position @position end |
#vector ⇒ Object
Returns the value of attribute vector.
12 13 14 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 12 def vector @vector end |
#view ⇒ Object
Returns the value of attribute view.
12 13 14 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 12 def view @view end |
Instance Method Details
#draw ⇒ Object
25 26 27 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 25 def draw view.draw() if view end |
#move ⇒ Object
19 20 21 22 23 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 19 def move position.x += vector.x position.y += vector.y position.z += vector.z end |
#pixelsPerSecToPixelsPerMove(pixelsPerSecond) ⇒ Object
29 30 31 32 33 |
# File 'ext/ruby/qtruby/examples/ruboids/ruboids/Thing.rb', line 29 def pixelsPerSecToPixelsPerMove(pixelsPerSecond) pps = (pixelsPerSecond.to_f / (1000.0 / 75.0)).to_i pps = 1 if pps == 0 return pps end |