Class: Clock

Inherits:
Object show all
Defined in:
docs/4_Systems_005_Animation.rb

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Returns:



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

Returns:

  • (Float, Integer)


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)

Returns:

  • (Float)


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

Returns:

  • (Boolean)


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