Skip to content

utils.clock.wren

clsource edited this page Nov 9, 2020 · 3 revisions

A simple Clock that counts ticks, seconds, minutes and hours. Use this in conjunction with the static update() and static draw(dt) of your DOME Game class.

  • Example:
import "domepunk/utils/clock" for Clock
  • Since: 1.0.0

API

Initializes a new clock object.

  • Signature: constructor new() -> Clock
  • Since: 1.0.0
  • Returns: A new instance of Clock

Number of ticks of the clock.

  • Since: 1.0.0
  • Signature: var ticks:Num

Number of seconds elapsed. Counts every 60 ticks.

  • Since: 1.0.0
  • Signature: var seconds:Num

Number of minutes elapsed. Counts every 60 seconds.

  • Since: 1.0.0
  • Signature: var minutes:Num

Number of hours elapsed. Counts every 60 minutes.

  • Since: 1.0.0
  • Signature: var hours:Num

The value last value obtained in draw(dt). Use this variable inside static draw(dt) method.

  • Signature: var dt:Num
  • Since: 1.0.0

Returns the number of seconds (including fractional seconds) when the clock was created.

  • Signature: var epoch:Num
  • Since: 1.0.0

Returns the number of seconds (including fractional seconds) since the program was started. This is usually used for benchmarking. Uses System.clock.

  • Signature: var clock:Num
  • Since: 1.0.0

Increase ticks by 1. Use this function inside your static update() method.

  • Signature: func tick() -> Void
  • Since: 1.0.0

Returns the formatted clock string.

  • Since: 1.0.0
  • Example: 23:00:00
  • Signature: static var string:String

A debugging description of the clock instance.

  • Since: 1.0.0
  • Signature: static var description:String