NewClock creates a new timer which allows you to measure ticks per seconds. Be sure to call `Tick()` whenever you want a tick to occur - it does not automatically tick each frame.
()
| 39 | // NewClock creates a new timer which allows you to measure ticks per seconds. Be sure to call `Tick()` whenever you |
| 40 | // want a tick to occur - it does not automatically tick each frame. |
| 41 | func NewClock() *Clock { |
| 42 | currStamp := theTimer.Now() |
| 43 | |
| 44 | clock := new(Clock) |
| 45 | clock.frameStamp = currStamp |
| 46 | clock.startStamp = currStamp |
| 47 | return clock |
| 48 | } |
| 49 | |
| 50 | // Tick indicates a new tick/frame has occurred. |
| 51 | func (c *Clock) Tick() { |