├── .gitignore
├── test
├── res
│ ├── cavesofgallet_tiles.png
│ ├── cavesofgallet_tiles.tsx
│ └── map.tmx
└── src
│ └── Test.hx
├── .vscode
├── settings.json
├── launch.json
├── tasks.json
└── commandbar.json
├── test.hxml
├── haxelib.json
├── README.md
├── src
└── tiled
│ ├── com
│ ├── TTileset.hx
│ ├── TLayer.hx
│ └── TObject.hx
│ └── TMap.hx
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | test/bin/*.*
--------------------------------------------------------------------------------
/test/res/cavesofgallet_tiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deepnight/heapsTiled/HEAD/test/res/cavesofgallet_tiles.png
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "workbench.colorCustomizations": {
3 | "titleBar.activeBackground": "#5e8b20",
4 | "titleBar.activeForeground": "#ffffff"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/test.hxml:
--------------------------------------------------------------------------------
1 | -cp src
2 | -cp test/src
3 | -lib heaps
4 | -lib hlsdl
5 | -lib heapsTiled
6 | -main Test
7 |
8 | -D resourcesPath=test/res
9 | -D windowSize=1200x900
10 | -hl test/bin/test.hl
11 |
--------------------------------------------------------------------------------
/test/res/cavesofgallet_tiles.tsx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/haxelib.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "heapsTiled",
3 | "url" : "https://github.com/deepnight/heapsTiled",
4 | "license": "Apache",
5 | "tags": ["Heaps","Hashlink","Tiled","import"],
6 | "description": "Import Tiled generated maps to Heaps based projects.",
7 | "version": "0.0.14",
8 | "classPath": "src/",
9 | "releasenote": "Haxelib dependencies",
10 | "contributors": ["sbenard"],
11 | "dependencies": {
12 | "heaps":"",
13 | "deepnightLibs":""
14 | }
15 | }
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "HL run",
9 | "request": "launch",
10 | "type": "hl",
11 | "hxml": "test.hxml",
12 | "cwd": "${workspaceRoot}",
13 | "preLaunchTask": "HL test"
14 |
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | A simple lib to import Tiled maps to Heaps projects. It only supports basic stuff, and it's not meant to support 100% of all Tiled features. You can extend it quite easily :)
4 |
5 | # Usage
6 |
7 | See Test.hx
8 |
9 | # Folder structure
10 |
11 | ```bash
12 | │ Test.hx
13 | │
14 | └───tiled
15 | │ TMap.hx
16 | │
17 | └───com
18 | TLayer.hx
19 | TObject.hx
20 | TTileset.hx
21 | ```
22 |
23 | # Credit
24 |
25 | "Caves of Gallet" tileset by Adam Saltsman: https://adamatomic.itch.io/caves-of-gallet
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "HL test",
8 | "type": "hxml",
9 | "file": "test.hxml",
10 | "presentation": {
11 | "reveal": "never",
12 | "panel": "dedicated",
13 | "clear": true
14 | },
15 | "problemMatcher": [
16 | "$haxe"
17 | ],
18 | "group": {
19 | "kind": "build",
20 | "isDefault": true
21 | }
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/.vscode/commandbar.json:
--------------------------------------------------------------------------------
1 | {
2 | "skipTerminateQuickPick": true,
3 | "skipSwitchToOutput": false,
4 | "skipErrorMessage": true,
5 | "commands": [
6 | {
7 | "text": "🍊 Build test",
8 | "color": "orange",
9 | "commandType":"palette",
10 | "command": "workbench.action.tasks.runTask|HL test",
11 | "alignment": "right",
12 | "skipTerminateQuickPick": false,
13 | "priority": -10
14 | },
15 | {
16 | "text": "Run test",
17 | "color": "orange",
18 | "command": "hl test/bin/test.hl",
19 | "alignment": "right",
20 | "skipTerminateQuickPick": false,
21 | "priority": -11
22 | },
23 | {
24 | "text": "➠ Submit to haxelib",
25 | "color": "yellow",
26 | "command": "start haxelib submit .",
27 | "alignment": "right",
28 | "skipTerminateQuickPick": false,
29 | "priority": -99
30 | }
31 | ]
32 | }
--------------------------------------------------------------------------------
/src/tiled/com/TTileset.hx:
--------------------------------------------------------------------------------
1 | package tiled.com;
2 |
3 | class TTileset {
4 | public var name : String;
5 | public var tile : h2d.Tile;
6 | public var baseId : Int = 0;
7 | public var lastId(get,never) : Int; inline function get_lastId() return baseId + cwid*chei - 1;
8 | public var tileWid : Int;
9 | public var tileHei : Int;
10 |
11 | public var cwid(get,never) : Int; inline function get_cwid() return Std.int( tile.width / tileWid );
12 | public var chei(get,never) : Int; inline function get_chei() return Std.int( tile.height / tileHei );
13 |
14 | public function new(n:Null, t:h2d.Tile, tw,th, base) {
15 | tile = t;
16 | name = n==null ? "Unnamed" : n;
17 | baseId = base;
18 | tileWid = tw;
19 | tileHei = th;
20 | }
21 |
22 | public function toString() {
23 | return 'TTileSet($cwid x $chei):$baseId>$lastId';
24 | }
25 |
26 | public function getTile(id:Int) : h2d.Tile {
27 | id-=baseId;
28 | var cy = Std.int( id/cwid );
29 | var cx = Std.int( id - cy*cwid );
30 | return tile.sub(
31 | cx*tileWid, cy*tileHei,
32 | tileWid, tileHei
33 | );
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/test/src/Test.hx:
--------------------------------------------------------------------------------
1 | import tiled.TMap;
2 | import tiled.com.*;
3 |
4 | class Test extends hxd.App {
5 | // Boot
6 | static function main() {
7 | new Test();
8 | }
9 |
10 | // Engine ready
11 | override function init() {
12 | hxd.Res.initEmbed();
13 | var wrapper = new h2d.Object(s2d);
14 | wrapper.setScale(2);
15 |
16 | var map = new tiled.TMap( hxd.Res.map );
17 |
18 | h3d.Engine.getCurrent().backgroundColor = map.bgColor;
19 |
20 | // Render map
21 | for(l in map.layers)
22 | map.renderLayerBitmap(l, wrapper);
23 |
24 | // Render objects
25 | var g = new h2d.Graphics(wrapper);
26 | var rc = 0x00ffcc;
27 | var ec = 0xff00ff;
28 | var pc = 0xffc200;
29 | for(o in map.getObjects("markers")) {
30 | if( o.isRect() ) {
31 | g.lineStyle(1, rc, 1);
32 | g.beginFill(rc, 0.3);
33 | g.drawRect(o.x, o.y, o.wid, o.hei);
34 | }
35 | else if( o.isEllipse() ) {
36 | g.lineStyle(1, ec, 1);
37 | g.beginFill(ec, 0.3);
38 | g.drawEllipse(o.centerX, o.centerY, o.wid*0.5, o.hei*0.5);
39 | }
40 | else if( o.isTile() ) {
41 | var b = new h2d.Bitmap( o.getTile(), g );
42 | b.x = o.x;
43 | b.y = o.y;
44 | g.lineStyle(1, rc, 1);
45 | g.beginFill(rc, 0.3);
46 | g.drawRect(o.x, o.y, o.wid, o.hei);
47 | }
48 | else {
49 | g.lineStyle(1, pc, 1);
50 | g.beginFill(pc, 0.3);
51 | g.drawCircle(o.x, o.y, 6);
52 | }
53 | }
54 | }
55 |
56 | override function update(deltaTime:Float) {
57 | super.update(deltaTime);
58 | }
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/src/tiled/com/TLayer.hx:
--------------------------------------------------------------------------------
1 | package tiled.com;
2 |
3 | class TLayer {
4 | public var id : Int;
5 | public var name : String = "";
6 | public var wid : Int;
7 | public var hei : Int;
8 | var props : Map = new Map();
9 | var tmap : TMap;
10 |
11 | var ids : Array = [];
12 | var xFlip : Map = new Map();
13 | var yFlip : Map = new Map();
14 | var content : Map = new Map();
15 |
16 | public function new(tmap:TMap, name:String, id:Int, w, h) {
17 | this.tmap = tmap;
18 | this.name = name;
19 | this.id = id;
20 | wid = w;
21 | hei = h;
22 | }
23 |
24 | public inline function isXFlipped(cx:Int, cy:Int) return xFlip.get(cx+cy*wid) == true;
25 | public inline function isYFlipped(cx:Int, cy:Int) return yFlip.get(cx+cy*wid) == true;
26 |
27 | inline function checkBit(v:UInt, bit:Int) : Bool {
28 | return v&(1<) {
36 | // Check for flip bits
37 | xFlip = new Map();
38 | yFlip = new Map();
39 | for(i in 0...a.length) {
40 | if( checkBit(a[i], 31) ) {
41 | xFlip.set(i, true);
42 | a[i] = clearBit(a[i], 31);
43 | }
44 | if( checkBit(a[i],30) ) {
45 | yFlip.set(i,true);
46 | a[i] = clearBit(a[i], 30);
47 | }
48 | }
49 |
50 | // Store IDs
51 | ids = a;
52 | content = new Map();
53 | var i = 0;
54 | for(id in ids) {
55 | if( id>0 )
56 | content.set(i, id);
57 | i++;
58 | }
59 | }
60 |
61 | public inline function getIds() return ids;
62 |
63 | public function hasTile(cx,cy) return content.exists(cx + cy*wid);
64 | public function getGlobalTileId(cx,cy) {
65 | return !hasTile(cx,cy) ? -1 : content.get(cx+cy*wid);
66 | }
67 | public function getLocalTileId(cx,cy) {
68 | if( !hasTile(cx,cy) )
69 | return -1;
70 | var id = content.get(cx+cy*wid);
71 | id -= tmap.getTileSet(id).baseId;
72 | return id;
73 | }
74 |
75 | public function setProp(name, v) {
76 | props.set(name, v);
77 | }
78 |
79 | public inline function hasProp(name) {
80 | return props.exists(name);
81 | }
82 |
83 | public function getPropStr(name) : Null {
84 | return props.get(name);
85 | }
86 |
87 | public function getPropInt(name) : Int {
88 | var v = getPropStr(name);
89 | return v==null ? 0 : Std.parseInt(v);
90 | }
91 |
92 | public function getPropFloat(name) : Float {
93 | var v = getPropStr(name);
94 | return v==null ? 0 : Std.parseFloat(v);
95 | }
96 |
97 | public function getPropBool(name) : Bool {
98 | var v = getPropStr(name);
99 | return v=="true";
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/tiled/com/TObject.hx:
--------------------------------------------------------------------------------
1 | package tiled.com;
2 |
3 | class TObject {
4 | var tmap : TMap;
5 | public var name : Null;
6 | public var type : Null;
7 | public var x : Int;
8 | public var y : Int;
9 | public var wid = 0;
10 | public var hei = 0;
11 | public var cwid(get,never) : Int; inline function get_cwid() return Std.int(wid/tmap.tileWid);
12 | public var chei(get,never) : Int; inline function get_chei() return Std.int(hei/tmap.tileHei);
13 | public var ellipse = false;
14 |
15 | public var centerX(get,never) : Int; inline function get_centerX() return Std.int(x+wid*0.5);
16 | public var centerY(get,never) : Int; inline function get_centerY() return Std.int(y+hei*0.5);
17 |
18 | public var cx(get,never) : Int; inline function get_cx() return Std.int(x/tmap.tileWid);
19 | public var cy(get,never) : Int; inline function get_cy() return Std.int(y/tmap.tileHei);
20 |
21 | public var xr(get,never) : Float; inline function get_xr() return (x-cx*tmap.tileWid) / tmap.tileWid;
22 | public var yr(get,never) : Float; inline function get_yr() return (y-cy*tmap.tileHei) / tmap.tileHei;
23 |
24 | public var tileId : Null;
25 | var props : Map = new Map();
26 |
27 | public function new(m:TMap, x:Int, y:Int, ?w=0, ?h=0) {
28 | tmap = m;
29 | this.x = x;
30 | this.y = y;
31 | wid = w;
32 | hei = h;
33 | }
34 |
35 | public function toString() {
36 | return 'Obj:$name($type)@$cx,$cy' + (wid>0 ? ' / $wid x $hei' : "");
37 | }
38 |
39 | public inline function isPoint() return !isTile() && wid<=0 && hei<=0;
40 | public inline function isRect() return !isTile() && wid>0 && hei>0 && !ellipse;
41 | public inline function isEllipse() return !isTile() && wid>0 && hei>0 && ellipse;
42 | public inline function isTile() return tileId!=null;
43 |
44 | public inline function rectContains(xx:Float, yy:Float) {
45 | return isRect() && xx>=x && xx=y && yy {
57 | if( !isTile() )
58 | return null;
59 | var l = tmap.getTileSet(tileId);
60 | if( l==null )
61 | return null;
62 | return l.getTile(tileId);
63 | }
64 |
65 |
66 |
67 | public function setProp(name, v) {
68 | props.set(name, v);
69 | }
70 |
71 | public inline function hasProp(name) {
72 | return props.exists(name);
73 | }
74 |
75 | public function getPropStr(name) : Null {
76 | return props.get(name);
77 | }
78 |
79 | public function getPropInt(name) : Int {
80 | var v = getPropStr(name);
81 | return v==null ? 0 : Std.parseInt(v);
82 | }
83 |
84 | public function getPropFloat(name) : Float {
85 | var v = getPropStr(name);
86 | return v==null ? 0 : Std.parseFloat(v);
87 | }
88 |
89 | public function getPropBool(name) : Bool {
90 | var v = getPropStr(name);
91 | return v=="true";
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/tiled/TMap.hx:
--------------------------------------------------------------------------------
1 | package tiled;
2 |
3 | import tiled.com.*;
4 |
5 | @:allow(tiled.com.TObject)
6 | @:allow(tiled.com.TLayer)
7 | class TMap {
8 | public var wid : Int;
9 | public var hei : Int;
10 | public var tileWid : Int;
11 | public var tileHei : Int;
12 |
13 | public var tilesets : Array = [];
14 | public var layers : Array = [];
15 | public var objects : Map> = new Map();
16 | var props : Map = new Map();
17 |
18 | public var bgColor : Null;
19 |
20 | private function htmlHexToInt(s:String) : Null {
21 | if( s.indexOf("#") == 0 )
22 | return Std.parseInt("0x" + s.substring(1));
23 |
24 | return null;
25 | }
26 |
27 | public function new(tmxRes:hxd.res.Resource) {
28 | var folder = tmxRes.entry.directory;
29 | var xml = new haxe.xml.Access( Xml.parse(tmxRes.entry.getText()) );
30 | xml = xml.node.map;
31 |
32 | wid = Std.parseInt( xml.att.width );
33 | hei = Std.parseInt( xml.att.height );
34 | tileWid = Std.parseInt( xml.att.tilewidth );
35 | tileHei = Std.parseInt( xml.att.tileheight );
36 | bgColor = xml.has.backgroundcolor ? htmlHexToInt(xml.att.backgroundcolor) : null;
37 |
38 | // Parse tilesets
39 | for(t in xml.nodes.tileset) {
40 | var set = readTileset(folder, t.att.source, Std.parseInt( t.att.firstgid ));
41 | tilesets.push(set);
42 | }
43 |
44 | // Parse layers
45 | for(l in xml.nodes.layer) {
46 | var layer = new TLayer( this, Std.string(l.att.name), Std.parseInt(l.att.id), Std.parseInt(l.att.width), Std.parseInt(l.att.height) );
47 | layers.push(layer);
48 |
49 | // Properties
50 | if( l.hasNode.properties )
51 | for(p in l.node.properties.nodes.property)
52 | layer.setProp(p.att.name, p.att.value);
53 |
54 | // Tile IDs
55 | var data = l.node.data;
56 | switch( data.att.encoding ) {
57 | case "csv" :
58 | layer.setIds( data.innerHTML.split(",").map( function(id:String) : UInt {
59 | var f = Std.parseFloat(id);
60 | if( f > 2147483648. ) // dirty fix for Float>UInt casting issue when "bit #32" is set
61 | return ( cast (f-2147483648.) : UInt ) | (1<<31);
62 | else
63 | return ( cast f : UInt );
64 | }) );
65 |
66 | case _ : throw "Unsupported layer encoding "+data.att.encoding+" in "+tmxRes.entry.path;
67 | }
68 | }
69 |
70 | // Parse objects
71 | for(ol in xml.nodes.objectgroup) {
72 | objects.set(ol.att.name, []);
73 | for(o in ol.nodes.object) {
74 | var e = new TObject(this, Std.parseInt(o.att.x), Std.parseInt(o.att.y));
75 | if( o.has.width ) e.wid = Std.parseInt( o.att.width );
76 | if( o.has.height ) e.hei = Std.parseInt( o.att.height );
77 | if( o.has.name ) e.name = o.att.name;
78 | if( o.has.type ) e.type = o.att.type;
79 | if( o.has.gid ) {
80 | e.tileId = Std.parseInt( o.att.gid );
81 | e.y-=e.hei; // fix stupid bottom-left based coordinate
82 | }
83 | else if( o.hasNode.ellipse ) {
84 | e.ellipse = true;
85 | if( e.wid==0 ) {
86 | // Fix 0-sized ellipses
87 | e.x-=tileWid>>1;
88 | e.y-=tileHei>>1;
89 | e.wid = tileWid;
90 | e.hei = tileHei;
91 | }
92 | }
93 |
94 | // Properties
95 | if( o.hasNode.properties )
96 | for(p in o.node.properties.nodes.property)
97 | e.setProp(p.att.name, p.att.value);
98 | objects.get(ol.att.name).push(e);
99 | }
100 | }
101 |
102 | // Parse map properties
103 | if (xml.hasNode.properties) {
104 | for (p in xml.node.properties.nodes.property)
105 | setProp(p.att.name, p.att.value);
106 | }
107 | }
108 |
109 | public function getLayer(name:String) : Null {
110 | for (l in layers)
111 | if (l.name == name)
112 | return l;
113 |
114 | return null;
115 | }
116 |
117 | public function getObject(layer:String, name:String) : Null {
118 | if( !objects.exists(layer) )
119 | return null;
120 |
121 | for(o in objects.get(layer))
122 | if( o.name==name )
123 | return o;
124 |
125 | return null;
126 | }
127 |
128 |
129 | public function getObjects(layer:String, ?type:String) : Array {
130 | if( !objects.exists(layer) )
131 | return [];
132 |
133 | return type==null ? objects.get(layer) : objects.get(layer).filter( function(o) return o.type==type );
134 | }
135 |
136 | public function getPointObjects(layer:String, ?type:String) : Array {
137 | if( !objects.exists(layer) )
138 | return [];
139 |
140 | return objects.get(layer).filter( function(o) return o.isPoint() && ( type==null || o.type==type ) );
141 | }
142 |
143 | public function getRectObjects(layer:String, ?type:String) : Array {
144 | if( !objects.exists(layer) )
145 | return [];
146 |
147 | return objects.get(layer).filter( function(o) return o.isRect() && ( type==null || o.type==type ) );
148 | }
149 |
150 |
151 | public function renderLayerBitmap(l:TLayer, ?p) : h2d.Object {
152 | var wrapper = new h2d.Object(p);
153 | var cx = 0;
154 | var cy = 0;
155 | for(id in l.getIds()) {
156 | if( id!=0 ) {
157 | var b = new h2d.Bitmap(getTile(id), wrapper);
158 | b.setPosition(cx*tileWid, cy*tileHei);
159 | if( l.isXFlipped(cx,cy) ) {
160 | b.scaleX = -1;
161 | b.x+=tileWid;
162 | }
163 | if( l.isYFlipped(cx,cy) ) {
164 | b.scaleY = -1;
165 | b.y+=tileHei;
166 | }
167 | }
168 |
169 | cx++;
170 | if( cx>=wid ) {
171 | cx = 0;
172 | cy++;
173 | }
174 | }
175 | return wrapper;
176 | }
177 |
178 |
179 | public function getTiles(l:TLayer) : Array<{ t:h2d.Tile, x:Int, y:Int }> {
180 | var out = [];
181 | var cx = 0;
182 | var cy = 0;
183 | for(id in l.getIds()) {
184 | if( id!=0 )
185 | out.push({
186 | t : getTile(id),
187 | x : cx*tileWid,
188 | y : cy*tileHei,
189 | });
190 |
191 | cx++;
192 | if( cx>=wid ) {
193 | cx = 0;
194 | cy++;
195 | }
196 | }
197 | return out;
198 | }
199 |
200 | function getTileSet(tileId:Int) : Null {
201 | for(set in tilesets)
202 | if( tileId>=set.baseId && tileId<=set.lastId )
203 | return set;
204 | return null;
205 | }
206 |
207 | inline function getTile(tileId:Int) : Null {
208 | var s = getTileSet(tileId);
209 | return s!=null ? s.getTile(tileId) : null;
210 | }
211 |
212 | function readTileset(folder:String, fileName:String, baseIdx:Int) : TTileset {
213 | var folderUnstack = folder.split("/");
214 | var fileUnstack = fileName.split("/");
215 | while (fileUnstack[0] == "..") {
216 | fileUnstack.shift();
217 | folderUnstack.pop();
218 | }
219 |
220 | folder = folderUnstack.length > 0 ? folderUnstack.join("/") + "/" : "";
221 | fileName = fileUnstack.join("/");
222 |
223 | var file = try hxd.Res.load(folder+fileName)
224 | catch(e:Dynamic) throw "File not found "+fileName;
225 |
226 | var xml = new haxe.xml.Access( Xml.parse(file.entry.getText()) ).node.tileset;
227 | var tile = hxd.Res.load(file.entry.directory + "/" +xml.node.image.att.source).toTile();
228 |
229 | var e = new TTileset(xml.att.name, tile, Std.parseInt(xml.att.tilewidth), Std.parseInt(xml.att.tileheight), baseIdx);
230 | return e;
231 | }
232 |
233 | public function setProp(name, v) {
234 | props.set(name, v);
235 | }
236 |
237 | public inline function hasProp(name) {
238 | return props.exists(name);
239 | }
240 |
241 | public function getPropStr(name) : Null {
242 | return props.get(name);
243 | }
244 |
245 | public function getPropInt(name) : Int {
246 | var v = getPropStr(name);
247 | return v==null ? 0 : Std.parseInt(v);
248 | }
249 |
250 | public function getPropFloat(name) : Float {
251 | var v = getPropStr(name);
252 | return v==null ? 0 : Std.parseFloat(v);
253 | }
254 |
255 | public function getPropBool(name) : Bool {
256 | var v = getPropStr(name);
257 | return v=="true";
258 | }
259 | }
260 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/test/res/map.tmx:
--------------------------------------------------------------------------------
1 |
2 |
129 |
--------------------------------------------------------------------------------