fromString static method
Future<RenderableTiledMap>
fromString(
- String contents,
- Vector2 destTileSize, {
- double? atlasMaxX,
- double? atlasMaxY,
- String prefix = 'assets/tiles/',
- CameraComponent? camera,
- bool? ignoreFlip,
- Images? images,
- AssetBundle? bundle,
- bool tsxPackingFilter()?,
- bool useAtlas = true,
- Paint layerPaintFactory(
- double opacity
- double atlasPackingSpacingX = 0,
- double atlasPackingSpacingY = 0,
Parses a string returning a RenderableTiledMap
.
This method looks for files under the path "assets/tiles/" by default.
This can be changed by providing a different path to prefix
.
By default, FlameTileLayer
renders flipped tiles if they exist.
You can disable this by setting ignoreFlip
to true
.
Implementation
static Future<RenderableTiledMap> fromString(
String contents,
Vector2 destTileSize, {
double? atlasMaxX,
double? atlasMaxY,
String prefix = 'assets/tiles/',
CameraComponent? camera,
bool? ignoreFlip,
Images? images,
AssetBundle? bundle,
bool Function(Tileset)? tsxPackingFilter,
bool useAtlas = true,
Paint Function(double opacity)? layerPaintFactory,
double atlasPackingSpacingX = 0,
double atlasPackingSpacingY = 0,
}) async {
final map = await TiledMap.fromString(
contents,
(key) => FlameTsxProvider.parse(key, bundle, prefix),
);
return fromTiledMap(
map,
destTileSize,
atlasMaxX: atlasMaxX,
atlasMaxY: atlasMaxY,
camera: camera,
ignoreFlip: ignoreFlip,
images: images,
bundle: bundle,
tsxPackingFilter: tsxPackingFilter,
useAtlas: useAtlas,
layerPaintFactory: layerPaintFactory ?? _defaultLayerPaintFactory,
atlasPackingSpacingX: atlasPackingSpacingX,
atlasPackingSpacingY: atlasPackingSpacingY,
);
}