back to the school
main.ts
1 import * as state from "./state";
2 import * as io from "./input";
3 import * as sim from "./update";
4 import * as screen from "./draw";
5
6 // The frame loop wires the four jobs together. It holds no state of its own.
7 export function frame(game: state.Game, keys: io.KeyReader, frame_time: number): screen.DrawCommand[] {
8 const input: io.Input = io.read_input(keys); // read_input: one snapshot per frame
9 sim.advance(game, input, frame_time); // clock: the caller supplies elapsed time
10 return screen.draw_game(game); // draw_game: paint what the steps produced
11 }