RenderableTiledMap constructor
RenderableTiledMap(})
This is a wrapper over Tiled's TiledMap which can be rendered to a canvas.
Internally each layer is wrapped with a RenderableLayer
which handles
rendering and caching for supported layer types:
- TileLayer is supported with pre-computed SpriteBatches
- ImageLayer is supported with paintImage
This also supports the following properties:
- TiledMap.backgroundColor
- Layer.opacity
- Layer.offsetX
- Layer.offsetY
- Layer.parallaxX (only supported if a
CameraComponent
is supplied) - Layer.parallaxY (only supported if a
CameraComponent
is supplied)
Implementation
RenderableTiledMap(
this.map,
this.renderableLayers,
this.destTileSize, {
this.camera,
this.animationFrames = const {},
}) {
_refreshCache();
final backgroundColor = map.backgroundColor;
if (backgroundColor != null) {
_backgroundPaint = Paint();
_backgroundPaint!.color = backgroundColor;
} else {
_backgroundPaint = null;
}
}