Add stub demo-playback code

This commit is contained in:
Tangent Wantwight 2020-02-15 14:12:53 -05:00
parent 21886c00a8
commit 14ccebc703

View file

@ -80,6 +80,24 @@ export class LockstepState<Input, State> {
} }
} }
export class Playback<Input, State> {
private frame = 0;
public constructor(
private state: State,
private inputLog: Input[],
private engine: LockstepProcessor<Input, State>,
) {}
public getNextState(): State {
if(this.frame < this.inputLog.length) {
this.engine.advanceState(this.state, this.inputLog[this.frame]);
this.frame++;
}
return this.state;
}
}
export class LockstepLoop<Input, State extends DeepCopy<State>> { export class LockstepLoop<Input, State extends DeepCopy<State>> {
} }