async function main() {
    // creates engine
    const engine = new Engine();

    // defines which DOM canvas to use
    engine.setRenderingCanvas(document.getElementById('screen'));

    // builds level.
    // buildLevel() is an ASYNCHRONOUS function, which return a promise
    // we use the "await" keywork to be sure the level is completly loaded before doing something else.
    await engine.buildLevel(LEVEL, { startpoint: 0 });

    // bindings keyboard events
    window.addEventListener('keydown', event => engine.camera.thinker.keyDown(event.key));
    window.addEventListener('keyup', event => engine.camera.thinker.keyUp(event.key));

    // starts engine doomloop
    engine.startDoomLoop();
}
// note that we use an "async" function, because we deal with promises when textures are loading
note that we use an "async" function, because we deal with promises when textures are loading
note that we use an " async " function because we deal with promises when textures are loading
async function main() {
    const engine = new Engine();
    engine.setRenderingCanvas(document.getElementById('screen'));
    await engine.buildLevel(LEVEL, { startpoint: 0 });
    window.addEventListener('keydown', event => engine.camera.thinker.keyDown(event.key));
    window.addEventListener('keyup', event => engine.camera.thinker.keyUp(event.key));
    engine.startDoomLoop();
}
async function main ( ) { const engine = new Engine ( ) ; engine . setRenderingCanvas ( document . getElementById ( 'screen' ) ) ; await engine . buildLevel ( LEVEL , { startpoint : 0 } ) ; window . addEventListener ( 'keydown' , event => engine . camera . thinker . keyDown ( event . key ) ) ; window . addEventListener ( 'keyup' , event => engine . camera . thinker . keyUp ( event . key ) ) ; engine . startDoomLoop ( ) ; }
note that we use an "async" function, because we deal with promises when textures are loading
note that we use an " async " function because we deal with promises when textures are loading
// creates engine // defines which DOM canvas to use // builds level. // buildLevel() is an ASYNCHRONOUS function, which return a promise // we use the "await" keywork to be sure the level is completly loaded before doing something else. // bindings keyboard events // starts engine doomloop