This repository has been archived by the owner on Jul 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CartographerMap.d.ts
66 lines (55 loc) · 2.19 KB
/
CartographerMap.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {TiledMapOrthogonal, TiledMapStaggered, TiledTile, TiledTileset} from "tiled-lua-types"
import {CartographerLayer} from "./CartographerLayer"
/** Interface of Cartographer Map */
export interface ICartographerMap {
/**
* Get the tileset that has the tile with the given global ID if it exists
* @param gid The global ID of the tile
*/
getTileset(gid: number): TiledTileset | undefined
/**
* Get a tile with the given global ID if it exists
* @param gid The global ID of the tile
*/
getTile(gid: number): TiledTile | undefined
/**
* Get the type of a tile if it exists
* @param gid The global ID of the tile
*/
getTileType(gid: number): string | undefined
/**
* Get the value of a property of a tile if it exists
* @param gid The global ID of the tile
* @param property_name The name of the property
*/
getTileProperty(gid: number, property_name: string): string | number | boolean | undefined
/**
* Set the value of a tile property if it exists
* @param gid The global ID of the tile
* @param property_name The name of the property
* @param property_value The value to set the property to
*/
setTileProperty(gid: number, property_name: string, property_value: string | number | boolean): void
/**
* Get a layer by name, it can get nested layers
* @param vargs The name(s) of the layers to get
* @returns The last one of `vargs`, if there's any name could not match the layer, then `undefined` will be returned
*/
getLayer(...vargs: string[]): CartographerLayer | undefined
/**
* Update all animations in the map
* @param dt Delta Time
*/
update(dt: number): void
/** Draw the solid color background of the map */
drawBackground(): void
/** Draw the map */
draw(): void
/** Cartographer Map Layers */
layers: CartographerLayer[]
}
/**
* Cartographer Map
* @description Since isometic and hexagonal maps are not supported yet, the map types will only extends `TiledMapOrthogonal` or `TiledMapStaggered`
*/
export type CartographerMap = (TiledMapOrthogonal & ICartographerMap) | (TiledMapStaggered & ICartographerMap)