const renderLayers = {
foreground: 1 << 0,
};
export const createEcsGame = async (): Promise<Game> => {
const { game, world, renderContext, time } = createGame('demo-game');
addCamera(world);
const sprite = await createSprite(renderContext, renderLayers.foreground);
createEntity(world, sprite);
world.addSystem(createCameraEcsSystem(time));
world.addSystem(createRenderEcsSystem(renderContext));
world.addSystem(createDemoEcsSystem(time));
return game;
};
This demo shows how to create a simple ECS world, entity, component and system.