Following the Tiled improvements and optimizations done in January, it was most natural to introduce a dedicated class
TCastleTiledMap that represents a Tiled map in a viewport. It descends from
TCastleTransform and thus can be moved, rotated, scaled (in 2D or 3D), just like anything else in the viewport.
The usage demo, along with many sample maps, is in examples/tiled/map_viewer_in_viewport.
Most important Tiled-specific API:
TCastleTiledMap.URL– map to load
TCastleTiledMap.SmoothScaling– controls texture filtering
TCastleTiledMap.ForceTilesetSpacing– provide 2 alternative ways to deal with smooth scaling artifacts, when
TCastleTiledMap.SmoothScalingis used with tilesets not perfectly prepared for it.
TCastleTiledMap.Map– read-only map data (as
TCastleTiledMapData), may be used e.g. to query what tile type lies at some map position.
TCastleTiledMap.Layers– choose which layers to render; this can also be used to split map into 2 pieces, e.g. front and back, and place them at distinct Z values: simply use 2 instances of
TCastleTiledMapwith disjoint layers.
TCastleTiledMap.StopAnimations– control animations. By default, Tiled animations automatically play when the map is loaded.
The full documentation is in Tiled map manual page.
Many thanks go to Freedomax for implementing animations on Tiled maps and providing a lot of Tiled fixes (seams fix, ForceTilesetSpacing, proper Z-order of tiles in all situations, relative URL fix…) and examples!