/** * a Timer class to manage timing related function (FPS, Game Tick, Time...) * @see {@link timer} the default global timer instance */ declare class Timer { tick: number; fps: number; maxfps: number; interpolation: boolean; framecount: number; framedelta: number; last: number; now: number; delta: number; step: number; minstep: number; timers: { fn: (...args: any[]) => any; delay: number; elapsed: number; repeat: boolean; timerId: number; pauseable: boolean; args: any[]; }[]; timerId: number; constructor(); /** * reset time (e.g. usefull in case of pause) * @ignore */ reset(): void; /** * Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function. * @param fn - the function you want to execute after delay milliseconds. * @param delay - the number of milliseconds (thousandths of a second) that the function call should be delayed by. * @param [pauseable] - respects the pause state of the engine. * @param args - optional parameters which are passed through to the function specified by fn once the timer expires. * @returns a positive integer value which identifies the timer created by the call to setTimeout(), which can be used later with me.timer.clearTimeout(). * @example * // set a timer to call "myFunction" after 1000ms * me.timer.setTimeout(myFunction, 1000); * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2 * me.timer.setTimeout(myFunction, 1000, true, param1, param2); */ setTimeout(fn: (...args: any[]) => any, delay: number, pauseable?: boolean, ...args: any[]): number; /** * Calls a function continously at the specified interval. See setTimeout to call function a single time. * @param fn - the function to execute * @param delay - the number of milliseconds (thousandths of a second) on how often to execute the function * @param [pauseable] - respects the pause state of the engine. * @param args - optional parameters which are passed through to the function specified by fn once the timer expires. * @returns a numeric, non-zero value which identifies the timer created by the call to setInterval(), which can be used later with me.timer.clearInterval(). * @example * // set a timer to call "myFunction" every 1000ms * me.timer.setInterval(myFunction, 1000); * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2 * me.timer.setInterval(myFunction, 1000, true, param1, param2); */ setInterval(fn: (...args: any[]) => any, delay: number, pauseable?: boolean, ...args: any[]): number; /** * Cancels a timeout previously established by calling setTimeout(). * @param timeoutID - ID of the timeout to be cancelled */ clearTimeout(timeoutID: number): void; /** * cancels the timed, repeating action which was previously established by a call to setInterval(). * @param intervalID - ID of the interval to be cleared */ clearInterval(intervalID: number): void; /** * Return the current timestamp in milliseconds
* since the game has started or since linux epoch (based on browser support for High Resolution Timer) * @returns current time */ getTime(): number; /** * Return elapsed time in milliseconds since the last update * @returns elapsed time */ getDelta(): number; /** * compute the actual frame time and fps rate * @ignore */ countFPS(): void; /** * update * @ignore */ update(time: number): void; /** * clear Timers * @ignore */ clearTimer(timerId: number): void; /** * update timers * @ignore */ updateTimers(): void; } declare const timer: Timer; /** * the default global Timer instance * @see Timer * @example * // set a timer to call "myFunction" after 1000ms * timer.setTimeout(myFunction, 1000); * // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2 * timer.setTimeout(myFunction, 1000, true, param1, param2); * // set a timer to call "myFunction" every 1000ms * timer.setInterval(myFunction, 1000); * // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2 * timer.setInterval(myFunction, 1000, true, param1, param2); */ export default timer; //# sourceMappingURL=timer.d.ts.map