-
Notifications
You must be signed in to change notification settings - Fork 0
LDtkLoader
Jump To | Go Back |
Methods | Variables | Macros |
---|
Name | Type | Purpose |
---|---|---|
verbose | bool |
If true, will output additional messages. Mainly for debugging. |
Jump To | top |
open | reload | listen | unlisten | signal | watch |
---|
Returns: bool
Whether or not an error occurred.
Throws: LDtkError Signals: open
Name | Type | Purpose |
---|---|---|
filename | string |
The name of the file to open. |
objectMap | struct |
A struct containing key-value pairs in the form LDtk-Asset.GMObject |
tilesetMap | struct |
A struct containing key-value pairs in the form LDTk-Asset.GMTileset |
Attempts to open the provided file and parse the contents. If an exception occurs, such as the file did not exist, an LDtkError is thrown.
Returns: undefined
Signals: reload
Name | Type | Purpose |
---|---|---|
levelId | string |
The level id (LDtk level name) to reload. |
Attempts to reopen the level source file and parse it. This is typically only used by by the file watcher, but you can manually trigger a reload by calling it.
Returns: ref
Name | Type | Purpose |
---|---|---|
signal | string |
The name of the signal to listen to. |
method | method |
The method to call when the signal is triggered. |
Attaches the given method to be called when signal
is triggered. LDtkLoader only has two signals, "open" and "reload".
Returns: ref
Name | Type | Purpose |
---|---|---|
signal | string |
The name of the signal to unlisten from. |
ref | ref |
The method that should be removed from the signal. |
Removes the given method from the signal. Typically this would be the return from listen
.
Returns: undefined
Name | Type | Purpose |
---|---|---|
signal | string |
The name of the signal to transmit to. |
value | any |
A value that will be passed into the methods attached to the signal. |
This function is called as needed by LDtkLoader. However, if you wish to create your own signals this is how you would call them when needed.
Returns: undefined
Name | Type | Purpose |
---|---|---|
... | string |
Any number of filenames and/or directories. |
Adds the given files to the file watcher. Either a specific file can be provided, or a directory/mask. If the latter is provided, all files in the given directory or matching the provided mask will be added. When a file change is detected, a reload on that level will be triggered.
Jump To | top |
---|
Name | Type | Initial | Purpose |
---|---|---|---|
mappings | struct |
{} | Contains two structs, objects and tilesets used to lookup LDtk assets by their GM equivalents. |
levels | struct |
{} | A struct allowing look up of LDtkLevels via byId , byKey or byIid
|
enums | struct |
{} | A struct of all LDtk enumerators. |
tilesets | struct |
{} | A struct of all LDtk tilesets |
uids | struct |
{} | A struct of all uids via byId or byKey
|
signals | struct |
{} | A struct of all signal listeners by signal. |
path | string |
"" | Mostly used for live reloading, an absolute path to the source file. |
source | string |
"" | The name of the source file. |
verbose | bool |
false |
Whether or not verbose messages should be used. |
watcher | Id.TimeSource |
undefined |
If instantiated, this is the pointer to the time source used by the file watcher. |
watchList | Array | [] | A list of files to be watched by the file watcher. |
Jump To | top |
---|
Name | Value | Purpose |
---|---|---|
LDTK_WATCHER_TICK_RATE | 0.5 |
How often the watcher should "tick" and check for file updates. |