TMXUtils
namespace TMXUtils
a collection of utility functions for parsing TMX maps
Summary
Public Methods
applyTMXProperties(obj: object, data: object) → {object}
Apply TMX Properties to the given object
Name | Type | Description |
---|---|---|
obj | object |
object to apply the properties to |
data | object |
TMX data object |
Type | Description |
---|---|
object |
obj |
decode(data: string, encoding: string) → {Array<number>}
Decode a encoded array into a binary array
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data | string |
data to be decoded |
||
encoding | string |
<optional> |
"none" |
data encoding ("csv", "base64", "xml") |
Type | Description |
---|---|
Array<number> |
Decoded data |
decodeBase64AsArray(input: string, bytes: number) → {Uint32Array}
Decode a base64 encoded string into a byte array
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
input | string |
Base64 encoded data |
||
bytes | number |
<optional> |
1 |
number of bytes per array entry |
Type | Description |
---|---|
Uint32Array |
Decoded data |
decodeCSV(input-: string) → {Array<number>}
Decode a CSV encoded array into a binary array
Name | Type | Description |
---|---|---|
input- | string |
CSV formatted data (only numbers, everything else will be converted to NaN) |
Type | Description |
---|---|
Array<number> |
Decoded data |
decompress(input: string, format: string) → {Uint32Array}
decompress and decode zlib/gzip data
Name | Type | Description |
---|---|---|
input | string |
Base64 encoded and compressed data |
format | string |
compressed data format ("gzip","zlib", "zstd") |
Type | Description |
---|---|
Uint32Array |
Decoded and decompress data |
parse(xml: Document) → {object}
Parse a XML TMX object and returns the corresponding javascript object
Name | Type | Description |
---|---|---|
xml | Document |
XML TMX object |
Type | Description |
---|---|
object |
Javascript object |
setInflateFunction(fn: Func) → {}
set the function used to inflate gzip/zlib data
Name | Type | Description |
---|---|---|
fn | Func |
inflate function |