This demo just sets up Shaku and create a running game loop.
You should see nothing but a bluish rectangle below, which is the canvas we'll render on in the other examples.
The following code shows a minimal code example on how to init Shaku and create a main loop.
async function runGame()
{
// init shaku
await Shaku.init();
// add shaku's canvas to document and set resolution to 800x600
document.body.appendChild(Shaku.gfx.canvas);
Shaku.gfx.setResolution(800, 600, true);
// do a single main loop step
function step()
{
// start new frame and clear screen
Shaku.startFrame();
Shaku.gfx.clear(Shaku.utils.Color.cornflowerblue);
// PUT YOUR GAME LOGIC HERE
// end frame and request next frame
Shaku.endFrame();
Shaku.requestAnimationFrame(step);
}
// start main loop
step();
}
runGame();