Class: Clock
Overview
Simple implementation of a clock
Constant Summary collapse
- ATOMIC_DELTA =
Atomic delta value to avoid high imprecision due to big framerates
0.001
Class Attribute Summary collapse
-
.main ⇒ Clock
readonly
Get the main clock.
Instance Attribute Summary collapse
-
#speed_factor ⇒ Float, Integer
Get the clock speed factor.
Instance Method Summary collapse
-
#elapsed_time ⇒ Float
Get the elapsed time (in seconds).
-
#freeze
Freeze the clock.
-
#frozen? ⇒ Boolean
Tell if the clock is frozen.
-
#initialize ⇒ Clock
(also: #reset)
constructor
Create a new clock.
-
#unfreeze
Unfreeze the clock.
Constructor Details
#initialize ⇒ Clock Also known as: reset
Create a new clock
9 10 |
# File 'docs/4_Systems_005_Animation.rb', line 9 def initialize end |
Class Attribute Details
.main ⇒ Clock (readonly)
Get the main clock
39 40 41 |
# File 'docs/4_Systems_005_Animation.rb', line 39 def main @main end |
Instance Attribute Details
#speed_factor ⇒ Float, Integer
Get the clock speed factor
7 8 9 |
# File 'docs/4_Systems_005_Animation.rb', line 7 def speed_factor @speed_factor end |
Instance Method Details
#elapsed_time ⇒ Float
Get the elapsed time (in seconds)
25 26 |
# File 'docs/4_Systems_005_Animation.rb', line 25 def elapsed_time end |
#freeze
Freeze the clock
18 19 |
# File 'docs/4_Systems_005_Animation.rb', line 18 def freeze end |
#frozen? ⇒ Boolean
Tell if the clock is frozen
15 16 |
# File 'docs/4_Systems_005_Animation.rb', line 15 def frozen? end |
#unfreeze
Unfreeze the clock
21 22 |
# File 'docs/4_Systems_005_Animation.rb', line 21 def unfreeze end |