new PreciseLoop(cb, tps, autostart)
A nanotimer
based game loop, cb is called tps times (ticks per second)
Beware This is a more accurate version of Loop which uses
setImmediate
polling under the hoop, if used with delays under 25ms it can be very cpu intensive because it is executed as fast as possible
Parameters:
Name | Type | Default | Description |
---|---|---|---|
cb |
function | ||
tps |
Number | ||
autostart |
Boolean |
true
|
Members
lasttick
- Source:
ms timestamp of the last time
Methods
start()
- Source:
start the loop
stop()
- Source:
stop the loop