react 前端框架如何驱动企业数字化转型与创新发展
837
2022-10-14
SKTiledMap- TMX TileMap 框架
SKTiledMap 是用于 SpriteKit 的 TMX TileMap 框架。支持 iOS8 和 OS X 10.10 及以上版本。
这是一个用于解析 Tiled Map Editor 产生的地图的库。
安装
Cocoapodspod 'SKTiledMap'Add #import
基本用法
SKTMMapLayer *mapLayer = [[SKTMMapLayer alloc] initWithContentsOfFile:@"map.tmx"];[self addChild:mapLayer];// get tile layerSKTMTileLayer *tileLayer = [mapLayer tileLayerWithName:@"Ground"];// get object layerSKTMObjectGroupLayer *objLayer = [mapLayer objectLayerWithName:@"Obj"];// get shape in object layerSKTMObjectGroupShape *heroObjShape = [objLayer shapeWithName:@"Hero"];// get custom properties[heroObjShape.model propertyForName:@"status"];// get image layerSKTMImageLayer *imgLayer = [mapLayer imageLayerWithName:@"Background"];// Coordinates System ConvertCGPoint tilePoint = [mapLayer.mapRenderer screenToTileCoords:CGPointMake(320, 600)];CGPoint mapPoint = [mapLayer.mapRenderer tileToScreenCoords:CGPointMake(1, 1)];// more detail you can see in demo or source code.
特点:
All map types:OrthogonalIsometricIsometric (staggered)Hexagonal (staggered)All TileLayerFormat:XMLBase64 (uncompressed)Base64 (gzip compressed)Base64 (zlib compressed)CSVAll Tile Render Ways:Stagger Axis (X, Y)Stagger Index (Odd, Even)Tile Render Order (RightDown, RightUp, LeftDown, LeftUp)Flipped/Rotated Tiles Or ObjectsAll ObjectGroup ShapeRectangleEllipsePolygonPolylineAnimated tile support
路线图
请查看 TMX map format reference page.
SKTiledMap(root)└── Framework │ │-- SKTiledMap.h│ ├── Model │ |-- TMXObject│ |-- TMXTile│ |-- TMXTileset│ |-- TMXTileLayer│ |-- TMXObjectGroupNode│ |-- TMXObjectGroup│ |-- TMXImageLayer│ |-- TMXMap│ ├── Classes │ |-- SKMapRenderer│ |-- OrthogonalRenderer│ |-- IsometricRenderer│ |-- StaggeredRenderer│ |-- HexagonalRenderer│ └── SpriteKitNode |-- SKTMNode|-- SKTMTileNode|-- SKTMObjectGroupTile|-- SKTMObjectGroupShape│ |-- SKTMLayer|-- SKTMTileLayer|-- SKTMObjectGroupLayer|-- SKTMImageLayer|-- SKTMMapLayer
iOS
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~