2020-04-15 19:23:06 +02:00
|
|
|
/**
|
|
|
|
* Tiled Map Interface
|
|
|
|
*
|
|
|
|
* Represents the interface for the Tiled exported data structure (JSON). Used
|
|
|
|
* when loading resources via Resource loader.
|
|
|
|
*/
|
|
|
|
export interface ITiledMap {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
layers: ITiledMapLayer[];
|
|
|
|
nextobjectid: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Map orientation (orthogonal)
|
|
|
|
*/
|
|
|
|
orientation: string;
|
2021-04-15 22:39:35 +02:00
|
|
|
properties?: ITiledMapLayerProperty[];
|
2020-04-15 19:23:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render order (right-down)
|
|
|
|
*/
|
|
|
|
renderorder: string;
|
|
|
|
tileheight: number;
|
|
|
|
tilewidth: number;
|
|
|
|
tilesets: ITiledTileSet[];
|
|
|
|
version: number;
|
2021-04-15 22:39:35 +02:00
|
|
|
compressionlevel?: number;
|
|
|
|
infinite?: boolean;
|
|
|
|
nextlayerid?: number;
|
|
|
|
tiledversion?: string;
|
|
|
|
type?: string;
|
2020-04-15 19:23:06 +02:00
|
|
|
}
|
|
|
|
|
2020-06-19 16:36:40 +02:00
|
|
|
export interface ITiledMapLayerProperty {
|
|
|
|
name: string;
|
|
|
|
type: string;
|
|
|
|
value: string|boolean|number|undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*export interface ITiledMapLayerBooleanProperty {
|
|
|
|
name: string,
|
|
|
|
type: 'bool',
|
|
|
|
value: boolean
|
|
|
|
}*/
|
|
|
|
|
2021-04-15 22:39:35 +02:00
|
|
|
export type ITiledMapLayer = ITiledMapGroupLayer | ITiledMapObjectLayer | ITiledMapTileLayer;
|
|
|
|
|
|
|
|
export interface ITiledMapGroupLayer {
|
|
|
|
id?: number,
|
|
|
|
name: string;
|
|
|
|
opacity: number;
|
|
|
|
properties?: ITiledMapLayerProperty[];
|
|
|
|
|
|
|
|
type: "group";
|
|
|
|
visible: boolean;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
/**
|
|
|
|
* Layers for group layer
|
|
|
|
*/
|
|
|
|
layers: ITiledMapLayer[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITiledMapTileLayer {
|
|
|
|
id?: number,
|
2020-04-15 19:23:06 +02:00
|
|
|
data: number[]|string;
|
|
|
|
height: number;
|
|
|
|
name: string;
|
|
|
|
opacity: number;
|
2021-04-15 22:39:35 +02:00
|
|
|
properties?: ITiledMapLayerProperty[];
|
|
|
|
encoding?: string;
|
2020-04-15 19:23:06 +02:00
|
|
|
compression?: string;
|
|
|
|
|
2021-04-15 22:39:35 +02:00
|
|
|
type: "tilelayer";
|
2020-04-15 19:23:06 +02:00
|
|
|
visible: boolean;
|
|
|
|
width: number;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw order (topdown (default), index)
|
|
|
|
*/
|
2021-04-15 22:39:35 +02:00
|
|
|
draworder?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITiledMapObjectLayer {
|
|
|
|
id?: number,
|
|
|
|
height: number;
|
|
|
|
name: string;
|
|
|
|
opacity: number;
|
|
|
|
properties?: ITiledMapLayerProperty[];
|
|
|
|
encoding?: string;
|
|
|
|
compression?: string;
|
|
|
|
|
|
|
|
type: "objectgroup";
|
|
|
|
visible: boolean;
|
|
|
|
width: number;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
2021-02-27 15:23:57 +01:00
|
|
|
|
|
|
|
/**
|
2021-04-15 22:39:35 +02:00
|
|
|
* Draw order (topdown (default), index)
|
2021-02-27 15:23:57 +01:00
|
|
|
*/
|
2021-04-15 22:39:35 +02:00
|
|
|
draworder?: string;
|
|
|
|
objects: ITiledMapObject[];
|
2020-04-15 19:23:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITiledMapObject {
|
|
|
|
id: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tile object id
|
|
|
|
*/
|
|
|
|
gid: number;
|
|
|
|
height: number;
|
|
|
|
name: string;
|
|
|
|
properties: {[key: string]: string};
|
|
|
|
rotation: number;
|
|
|
|
type: string;
|
|
|
|
visible: boolean;
|
|
|
|
width: number;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not object is an ellipse
|
|
|
|
*/
|
|
|
|
ellipse: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Polygon points
|
|
|
|
*/
|
|
|
|
polygon: {x: number, y: number}[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Polyline points
|
|
|
|
*/
|
|
|
|
polyline: {x: number, y: number}[];
|
2021-04-16 21:29:05 +02:00
|
|
|
|
|
|
|
text?: ITiledText
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITiledText {
|
|
|
|
text: string,
|
|
|
|
wrap?: boolean,
|
|
|
|
fontfamily?: string,
|
|
|
|
pixelsize?: number,
|
|
|
|
color?: string,
|
|
|
|
underline?: boolean,
|
|
|
|
italic?: boolean,
|
|
|
|
strikeout?: boolean,
|
|
|
|
halign?: "center"|"right"|"justify"|"left"
|
2020-04-15 19:23:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITiledTileSet {
|
|
|
|
firstgid: number;
|
|
|
|
image: string;
|
|
|
|
|
|
|
|
imageheight: number;
|
|
|
|
imagewidth: number;
|
|
|
|
margin: number;
|
|
|
|
name: string;
|
|
|
|
properties: {[key: string]: string};
|
|
|
|
spacing: number;
|
|
|
|
tilecount: number;
|
|
|
|
tileheight: number;
|
|
|
|
tilewidth: number;
|
|
|
|
transparentcolor: string;
|
|
|
|
terrains: ITiledMapTerrain[];
|
2021-06-19 15:17:28 +02:00
|
|
|
tiles?: Array<ITile>;
|
2020-04-15 19:23:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Refers to external tileset file (should be JSON)
|
|
|
|
*/
|
|
|
|
source: string;
|
|
|
|
}
|
|
|
|
|
2021-06-19 15:17:28 +02:00
|
|
|
export interface ITile {
|
|
|
|
id: number,
|
|
|
|
type?: string
|
|
|
|
|
|
|
|
properties?: Array<ITiledMapLayerProperty>
|
|
|
|
}
|
|
|
|
|
2020-04-15 19:23:06 +02:00
|
|
|
export interface ITiledMapTerrain {
|
|
|
|
name: string;
|
|
|
|
tile: number;
|
|
|
|
}
|