Files
esengine/packages/tilemap/src/TilemapRuntimeModule.ts

33 lines
1.0 KiB
TypeScript
Raw Normal View History

/**
* Tilemap Runtime Module (Pure runtime, no editor dependencies)
* Tilemap
*/
import type { IScene } from '@esengine/ecs-framework';
import { ComponentRegistry } from '@esengine/ecs-framework';
import type { IRuntimeModuleLoader, SystemContext } from '@esengine/ecs-components';
import { TilemapComponent } from './TilemapComponent';
import { TilemapRenderingSystem } from './systems/TilemapRenderingSystem';
/**
* Tilemap Runtime Module
* Tilemap
*/
export class TilemapRuntimeModule implements IRuntimeModuleLoader {
registerComponents(registry: typeof ComponentRegistry): void {
registry.register(TilemapComponent);
}
createSystems(scene: IScene, context: SystemContext): void {
const tilemapSystem = new TilemapRenderingSystem();
scene.addSystem(tilemapSystem);
if (context.renderSystem) {
context.renderSystem.addRenderDataProvider(tilemapSystem);
}
context.tilemapSystem = tilemapSystem;
}
}