@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
49 lines • 1.28 kB
TypeScript
import type { TgdEvent } from "../event";
export interface TgdTimeOptions {
speed: number;
context: {
eventPaintEnter: TgdEvent<{
playing: boolean;
}>;
};
}
/**
* Use this class to abstract the time given by a `TgdContext`.
*/
export declare class TgdTime {
/**
* Multiply the real time by this factor.
*/
private _speed;
private playing;
private timeStart;
private timeStop;
private secondsAtSpeedZero;
private speedAtPause;
private firstUpdate;
private context;
constructor({ speed, context }?: Partial<TgdTimeOptions>);
get speed(): number;
set speed(speed: number);
get seconds(): number;
set seconds(seconds: number);
get milliseconds(): number;
set milliseconds(milliseconds: number);
/**
* If you bind to a context, you don't need to call `update()` yourself,
* because it will be called automatically at every repaint.
*/
bind(context: {
eventPaintEnter: TgdEvent<{
playing: boolean;
}>;
} | undefined): void;
unbind(): void;
reset(): void;
update(context: {
playing: boolean;
}): void;
private get time();
private readonly actualUpdate;
}
//# sourceMappingURL=time.d.ts.map