@defold-typescript/library-types 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,551 @@
1
+ {
2
+ "info": {
3
+ "namespace": "shutter",
4
+ "brief": "",
5
+ "description": ""
6
+ },
7
+ "elements": [
8
+ {
9
+ "type": "VARIABLE",
10
+ "name": "camera_table",
11
+ "brief": "Every live camera, keyed by the id of the game object it lives on. The",
12
+ "description": "Every live camera, keyed by the id of the game object it lives on. The\nshutter.script file writes to it; read from it rather than manipulating it\ndirectly.",
13
+ "types": [
14
+ "LuaMap<Hash, ShutterCamera>"
15
+ ]
16
+ },
17
+ {
18
+ "type": "VARIABLE",
19
+ "name": "center_behavior",
20
+ "brief": "Keeps the projection fixed and shrinks the viewport to preserve the display",
21
+ "description": "Keeps the projection fixed and shrinks the viewport to preserve the display\nratio, letterboxing or pillarboxing the remainder.",
22
+ "types": [
23
+ "Hash"
24
+ ]
25
+ },
26
+ {
27
+ "type": "VARIABLE",
28
+ "name": "expand_behavior",
29
+ "brief": "Keeps the viewport filling the window and widens the projection as the window",
30
+ "description": "Keeps the viewport filling the window and widens the projection as the window\ngrows, showing more of the game world rather than scaling it.",
31
+ "types": [
32
+ "Hash"
33
+ ]
34
+ },
35
+ {
36
+ "type": "VARIABLE",
37
+ "name": "stretch_behavior",
38
+ "brief": "Keeps both the viewport and the projection filling the window, so the game world",
39
+ "description": "Keeps both the viewport and the projection filling the window, so the game world\ndistorts with the window ratio.",
40
+ "types": [
41
+ "Hash"
42
+ ]
43
+ },
44
+ {
45
+ "type": "FUNCTION",
46
+ "name": "activate",
47
+ "brief": "Installs a camera's viewport, view matrix and projection matrix into the render",
48
+ "description": "Installs a camera's viewport, view matrix and projection matrix into the render\ncontext. Call it from a render script before drawing the world.",
49
+ "parameters": [
50
+ {
51
+ "name": "object",
52
+ "doc": "The game object the camera lives on.",
53
+ "types": [
54
+ "Hash"
55
+ ],
56
+ "is_optional": "False"
57
+ }
58
+ ],
59
+ "returnvalues": [
60
+ {
61
+ "name": "",
62
+ "doc": "The camera's frustum, for passing to `render.draw`.",
63
+ "types": [
64
+ "Matrix4"
65
+ ]
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "type": "FUNCTION",
71
+ "name": "deactivate",
72
+ "brief": "Restores the viewport and matrices Defold's GUI system expects, sized to the",
73
+ "description": "Restores the viewport and matrices Defold's GUI system expects, sized to the\ncurrent window. Call it before drawing GUI.",
74
+ "parameters": [],
75
+ "returnvalues": [
76
+ {
77
+ "name": "",
78
+ "doc": "The frustum matching the restored matrices.",
79
+ "types": [
80
+ "Matrix4"
81
+ ]
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "type": "FUNCTION",
87
+ "name": "force_update",
88
+ "brief": "Recalculates a camera's viewport, view matrix and projection matrix immediately.",
89
+ "description": "Recalculates a camera's viewport, view matrix and projection matrix immediately.\nThe shutter.script game object already does this once per frame; call it directly\nonly after changing a camera property mid-frame.",
90
+ "parameters": [
91
+ {
92
+ "name": "object",
93
+ "doc": "The game object the camera lives on.",
94
+ "types": [
95
+ "Hash"
96
+ ],
97
+ "is_optional": "False"
98
+ }
99
+ ],
100
+ "returnvalues": []
101
+ },
102
+ {
103
+ "type": "FUNCTION",
104
+ "name": "get_viewport",
105
+ "brief": "Calculates the camera's viewport in window coordinates, scaled from the",
106
+ "description": "Calculates the camera's viewport in window coordinates, scaled from the\ngame.project display size and, under center behavior, shrunk and centered to\npreserve the display ratio.",
107
+ "parameters": [
108
+ {
109
+ "name": "object",
110
+ "doc": "The game object the camera lives on.",
111
+ "types": [
112
+ "Hash"
113
+ ],
114
+ "is_optional": "False"
115
+ }
116
+ ],
117
+ "returnvalues": [
118
+ {
119
+ "name": "",
120
+ "doc": "The viewport's x, y, width and height.",
121
+ "types": [
122
+ "LuaMultiReturn<[ number, number, number, number ]>"
123
+ ]
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "type": "FUNCTION",
129
+ "name": "get_view",
130
+ "brief": "Calculates the camera's view matrix from the inverse of its game object's world",
131
+ "description": "Calculates the camera's view matrix from the inverse of its game object's world\ntransform.",
132
+ "parameters": [
133
+ {
134
+ "name": "object",
135
+ "doc": "The game object the camera lives on.",
136
+ "types": [
137
+ "Hash"
138
+ ],
139
+ "is_optional": "False"
140
+ }
141
+ ],
142
+ "returnvalues": [
143
+ {
144
+ "name": "",
145
+ "doc": "",
146
+ "types": [
147
+ "Matrix4"
148
+ ]
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "type": "FUNCTION",
154
+ "name": "get_projection",
155
+ "brief": "Calculates the camera's orthographic projection matrix, sized from the display",
156
+ "description": "Calculates the camera's orthographic projection matrix, sized from the display\nunder center and stretch behavior and from the window under expand behavior.",
157
+ "parameters": [
158
+ {
159
+ "name": "object",
160
+ "doc": "The game object the camera lives on.",
161
+ "types": [
162
+ "Hash"
163
+ ],
164
+ "is_optional": "False"
165
+ }
166
+ ],
167
+ "returnvalues": [
168
+ {
169
+ "name": "",
170
+ "doc": "",
171
+ "types": [
172
+ "Matrix4"
173
+ ]
174
+ }
175
+ ]
176
+ },
177
+ {
178
+ "type": "FUNCTION",
179
+ "name": "get_frustum",
180
+ "brief": "Returns the camera's frustum, the product of its last calculated projection and",
181
+ "description": "Returns the camera's frustum, the product of its last calculated projection and\nview matrices.",
182
+ "parameters": [
183
+ {
184
+ "name": "object",
185
+ "doc": "The game object the camera lives on.",
186
+ "types": [
187
+ "Hash"
188
+ ],
189
+ "is_optional": "False"
190
+ }
191
+ ],
192
+ "returnvalues": [
193
+ {
194
+ "name": "",
195
+ "doc": "",
196
+ "types": [
197
+ "Matrix4"
198
+ ]
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "type": "FUNCTION",
204
+ "name": "get_distance",
205
+ "brief": "Converts a screen distance into the world distance an object must travel to cover",
206
+ "description": "Converts a screen distance into the world distance an object must travel to cover\nit, accounting for the camera's zoom and, under center and stretch behavior, for\nthe viewport no longer mapping to physical screen coordinates.",
207
+ "parameters": [
208
+ {
209
+ "name": "object",
210
+ "doc": "The game object the camera lives on.",
211
+ "types": [
212
+ "Hash"
213
+ ],
214
+ "is_optional": "False"
215
+ },
216
+ {
217
+ "name": "distance",
218
+ "doc": "The screen distance to convert.",
219
+ "types": [
220
+ "Vector3"
221
+ ],
222
+ "is_optional": "False"
223
+ },
224
+ {
225
+ "name": "absolute",
226
+ "doc": "Skip rotating the result by the camera's rotation.",
227
+ "types": [
228
+ "boolean"
229
+ ],
230
+ "is_optional": "True"
231
+ }
232
+ ],
233
+ "returnvalues": [
234
+ {
235
+ "name": "",
236
+ "doc": "",
237
+ "types": [
238
+ "Vector3"
239
+ ]
240
+ }
241
+ ]
242
+ },
243
+ {
244
+ "type": "FUNCTION",
245
+ "name": "shake",
246
+ "brief": "Starts a camera shake animation, cancelling and restarting any shake already",
247
+ "description": "Starts a camera shake animation, cancelling and restarting any shake already\nrunning on this camera.",
248
+ "parameters": [
249
+ {
250
+ "name": "object",
251
+ "doc": "The game object the camera lives on.",
252
+ "types": [
253
+ "Hash"
254
+ ],
255
+ "is_optional": "False"
256
+ },
257
+ {
258
+ "name": "parent",
259
+ "doc": "Shake the camera object's parent instead of the camera itself.",
260
+ "types": [
261
+ "boolean"
262
+ ],
263
+ "is_optional": "False"
264
+ },
265
+ {
266
+ "name": "count",
267
+ "doc": "How many times to displace the camera before stopping.",
268
+ "types": [
269
+ "number"
270
+ ],
271
+ "is_optional": "False"
272
+ },
273
+ {
274
+ "name": "duration",
275
+ "doc": "Seconds each displacement takes.",
276
+ "types": [
277
+ "number"
278
+ ],
279
+ "is_optional": "False"
280
+ },
281
+ {
282
+ "name": "radius",
283
+ "doc": "How far each displacement moves the camera.",
284
+ "types": [
285
+ "number"
286
+ ],
287
+ "is_optional": "False"
288
+ },
289
+ {
290
+ "name": "duration_scalar",
291
+ "doc": "Multiplies the duration after each displacement. Defaults to 1.",
292
+ "types": [
293
+ "number"
294
+ ],
295
+ "is_optional": "True"
296
+ },
297
+ {
298
+ "name": "radius_scalar",
299
+ "doc": "Multiplies the radius after each displacement. Defaults to 1.",
300
+ "types": [
301
+ "number"
302
+ ],
303
+ "is_optional": "True"
304
+ }
305
+ ],
306
+ "returnvalues": []
307
+ },
308
+ {
309
+ "type": "FUNCTION",
310
+ "name": "cancel_shake",
311
+ "brief": "Stops a running camera shake and returns the shaken object to where it started.",
312
+ "description": "Stops a running camera shake and returns the shaken object to where it started.\nDoes nothing if no shake is running.",
313
+ "parameters": [
314
+ {
315
+ "name": "object",
316
+ "doc": "The game object the camera lives on.",
317
+ "types": [
318
+ "Hash"
319
+ ],
320
+ "is_optional": "False"
321
+ },
322
+ {
323
+ "name": "parent",
324
+ "doc": "Whether the shake was started against the camera object's parent.",
325
+ "types": [
326
+ "boolean"
327
+ ],
328
+ "is_optional": "True"
329
+ }
330
+ ],
331
+ "returnvalues": []
332
+ },
333
+ {
334
+ "type": "FUNCTION",
335
+ "name": "screen_to_world",
336
+ "brief": "Converts a screen position to its world position through the inverse of the",
337
+ "description": "Converts a screen position to its world position through the inverse of the\ncamera's frustum.",
338
+ "parameters": [
339
+ {
340
+ "name": "object",
341
+ "doc": "The game object the camera lives on.",
342
+ "types": [
343
+ "Hash"
344
+ ],
345
+ "is_optional": "False"
346
+ },
347
+ {
348
+ "name": "x",
349
+ "doc": "The screen position's x coordinate.",
350
+ "types": [
351
+ "number"
352
+ ],
353
+ "is_optional": "False"
354
+ },
355
+ {
356
+ "name": "y",
357
+ "doc": "The screen position's y coordinate.",
358
+ "types": [
359
+ "number"
360
+ ],
361
+ "is_optional": "False"
362
+ },
363
+ {
364
+ "name": "visible",
365
+ "doc": "Return `nil` instead when the position falls outside the camera's view.",
366
+ "types": [
367
+ "boolean"
368
+ ],
369
+ "is_optional": "True"
370
+ }
371
+ ],
372
+ "returnvalues": [
373
+ {
374
+ "name": "",
375
+ "doc": "The world position, or `nil` if `visible` filtered it out.",
376
+ "types": [
377
+ "Vector3 | undefined"
378
+ ]
379
+ }
380
+ ]
381
+ },
382
+ {
383
+ "type": "FUNCTION",
384
+ "name": "world_to_screen",
385
+ "brief": "Converts a world position to its screen position through the camera's frustum.",
386
+ "description": "Converts a world position to its screen position through the camera's frustum.",
387
+ "parameters": [
388
+ {
389
+ "name": "object",
390
+ "doc": "The game object the camera lives on.",
391
+ "types": [
392
+ "Hash"
393
+ ],
394
+ "is_optional": "False"
395
+ },
396
+ {
397
+ "name": "position",
398
+ "doc": "The world position to convert.",
399
+ "types": [
400
+ "Vector3"
401
+ ],
402
+ "is_optional": "False"
403
+ },
404
+ {
405
+ "name": "visible",
406
+ "doc": "Return `nil` instead when the position falls outside the camera's view.",
407
+ "types": [
408
+ "boolean"
409
+ ],
410
+ "is_optional": "True"
411
+ }
412
+ ],
413
+ "returnvalues": [
414
+ {
415
+ "name": "",
416
+ "doc": "The screen position, or `nil` if `visible` filtered it out.",
417
+ "types": [
418
+ "Vector3 | undefined"
419
+ ]
420
+ }
421
+ ]
422
+ },
423
+ {
424
+ "type": "TYPEDEF",
425
+ "name": "ShutterCamera",
426
+ "properties": [
427
+ {
428
+ "name": "behavior",
429
+ "brief": "One of `center_behavior`, `expand_behavior` or `stretch_behavior`.",
430
+ "description": "One of `center_behavior`, `expand_behavior` or `stretch_behavior`.",
431
+ "types": [
432
+ "Hash"
433
+ ]
434
+ },
435
+ {
436
+ "name": "viewport_x",
437
+ "brief": "",
438
+ "description": "",
439
+ "types": [
440
+ "number"
441
+ ]
442
+ },
443
+ {
444
+ "name": "viewport_y",
445
+ "brief": "",
446
+ "description": "",
447
+ "types": [
448
+ "number"
449
+ ]
450
+ },
451
+ {
452
+ "name": "viewport_width",
453
+ "brief": "",
454
+ "description": "",
455
+ "types": [
456
+ "number"
457
+ ]
458
+ },
459
+ {
460
+ "name": "viewport_height",
461
+ "brief": "",
462
+ "description": "",
463
+ "types": [
464
+ "number"
465
+ ]
466
+ },
467
+ {
468
+ "name": "near",
469
+ "brief": "",
470
+ "description": "",
471
+ "types": [
472
+ "number"
473
+ ]
474
+ },
475
+ {
476
+ "name": "far",
477
+ "brief": "",
478
+ "description": "",
479
+ "types": [
480
+ "number"
481
+ ]
482
+ },
483
+ {
484
+ "name": "zoom",
485
+ "brief": "",
486
+ "description": "",
487
+ "types": [
488
+ "number"
489
+ ]
490
+ },
491
+ {
492
+ "name": "viewport_x_adjusted",
493
+ "brief": "Viewport left edge after the window scale and any letterboxing margin.",
494
+ "description": "Viewport left edge after the window scale and any letterboxing margin.",
495
+ "types": [
496
+ "number"
497
+ ]
498
+ },
499
+ {
500
+ "name": "viewport_y_adjusted",
501
+ "brief": "Viewport bottom edge after the window scale and any pillarboxing margin.",
502
+ "description": "Viewport bottom edge after the window scale and any pillarboxing margin.",
503
+ "types": [
504
+ "number"
505
+ ]
506
+ },
507
+ {
508
+ "name": "viewport_width_adjusted",
509
+ "brief": "",
510
+ "description": "",
511
+ "types": [
512
+ "number"
513
+ ]
514
+ },
515
+ {
516
+ "name": "viewport_height_adjusted",
517
+ "brief": "",
518
+ "description": "",
519
+ "types": [
520
+ "number"
521
+ ]
522
+ },
523
+ {
524
+ "name": "view",
525
+ "brief": "",
526
+ "description": "",
527
+ "types": [
528
+ "Matrix4"
529
+ ]
530
+ },
531
+ {
532
+ "name": "projection",
533
+ "brief": "",
534
+ "description": "",
535
+ "types": [
536
+ "Matrix4"
537
+ ]
538
+ },
539
+ {
540
+ "name": "shake_origin",
541
+ "brief": "Where the shaken object sat before the shake began, and `nil` while no shake",
542
+ "description": "Where the shaken object sat before the shake began, and `nil` while no shake\nis running. `cancel_shake` restores the object to it.",
543
+ "types": [
544
+ "Vector3"
545
+ ],
546
+ "is_optional": "True"
547
+ }
548
+ ]
549
+ }
550
+ ]
551
+ }
@@ -110,6 +110,28 @@
110
110
  "apiDoc": "api-doc/nakama.util.log.json",
111
111
  "upstreamLua": ["fixtures/upstream-lua/nakama-defold/nakama/util/log.lua"]
112
112
  },
113
+ {
114
+ "repo": "https://github.com/heroiclabs/nakama-defold",
115
+ "ref": "v3.4.0",
116
+ "license": "Apache-2.0",
117
+ "authored": "fixtures/authored/nakama.session.d.ts",
118
+ "moduleId": "nakama.session",
119
+ "namespace": "nakama.session",
120
+ "generated": "generated/nakama.session.d.ts",
121
+ "apiDoc": "api-doc/nakama.session.json",
122
+ "upstreamLua": ["fixtures/upstream-lua/nakama-defold/nakama/session.lua"]
123
+ },
124
+ {
125
+ "repo": "https://github.com/heroiclabs/nakama-defold",
126
+ "ref": "v3.4.0",
127
+ "license": "Apache-2.0",
128
+ "authored": "fixtures/authored/nakama.socket.d.ts",
129
+ "moduleId": "nakama.socket",
130
+ "namespace": "nakama.socket",
131
+ "generated": "generated/nakama.socket.d.ts",
132
+ "apiDoc": "api-doc/nakama.socket.json",
133
+ "upstreamLua": ["fixtures/upstream-lua/nakama-defold/nakama/socket.lua"]
134
+ },
113
135
  {
114
136
  "repo": "https://github.com/indiesoftby/defold-yagames",
115
137
  "ref": "0.19.0",
@@ -121,20 +143,6 @@
121
143
  "apiDoc": "api-doc/yagames.json",
122
144
  "upstreamLua": ["fixtures/upstream-lua/defold-yagames/yagames/yagames.lua"]
123
145
  },
124
- {
125
- "repo": "https://github.com/VowSoftware/starly",
126
- "ref": "85d1b2af8bf0618e7f297da41d03eb55d27e49b6",
127
- "license": "Zlib",
128
- "authored": "fixtures/authored/starly.starly.d.ts",
129
- "moduleId": "starly.starly",
130
- "namespace": "starly",
131
- "generated": "generated/starly.d.ts",
132
- "apiDoc": "api-doc/starly.json",
133
- "parityVerdict": {
134
- "reason": "unresolved-path",
135
- "note": "VowSoftware/starly does not resolve at the pinned SHA 85d1b2af — the repository itself returns 404, so neither starly/starly.lua nor any other upstream path can be vendored at this ref."
136
- }
137
- },
138
146
  {
139
147
  "repo": "https://github.com/britzl/defold-input",
140
148
  "ref": "4.7.1",
@@ -398,6 +406,28 @@
398
406
  "generated": "generated/nakama.d.ts",
399
407
  "apiDoc": "api-doc/nakama.json",
400
408
  "upstreamLua": ["fixtures/upstream-lua/nakama-defold/nakama/nakama.lua"]
409
+ },
410
+ {
411
+ "repo": "https://github.com/Klaleus/defold-shutter",
412
+ "ref": "2ed27b50cda551650b01b80c1ccb5dd3f4e161fc",
413
+ "license": "Zlib",
414
+ "authored": "fixtures/authored/shutter.shutter.d.ts",
415
+ "moduleId": "shutter.shutter",
416
+ "namespace": "shutter",
417
+ "generated": "generated/shutter.d.ts",
418
+ "apiDoc": "api-doc/shutter.json",
419
+ "upstreamLua": ["fixtures/upstream-lua/defold-shutter/shutter/shutter.lua"]
420
+ },
421
+ {
422
+ "repo": "https://github.com/Klaleus/defold-checkpoint",
423
+ "ref": "e4268ffba8f4f968f3c27a1a066ac9660bef3a73",
424
+ "license": "Zlib",
425
+ "authored": "fixtures/authored/checkpoint.checkpoint.d.ts",
426
+ "moduleId": "checkpoint.checkpoint",
427
+ "namespace": "checkpoint",
428
+ "generated": "generated/checkpoint.d.ts",
429
+ "apiDoc": "api-doc/checkpoint.json",
430
+ "upstreamLua": ["fixtures/upstream-lua/defold-checkpoint/checkpoint/checkpoint.lua"]
401
431
  }
402
432
  ]
403
433
  }
@@ -0,0 +1,62 @@
1
+ /** @noSelfInFile **/
2
+
3
+ /**
4
+ * @see {@link https://github.com/Klaleus/defold-checkpoint|Github Source}
5
+ * @noResolution
6
+ * @example `import * as checkpoint from 'checkpoint.checkpoint'`
7
+ */
8
+ declare module 'checkpoint.checkpoint' {
9
+ /**
10
+ * The `project.title` from game.project, read once when the module loads. It is
11
+ * the name the save directory is derived from.
12
+ */
13
+ const project_title: string;
14
+
15
+ /**
16
+ * The absolute path of the project's save directory, resolved once when the
17
+ * module loads. Every path the other members take is relative to it, and `list`
18
+ * returns paths relative to it. Ends with a separator, e.g.
19
+ * `/home/klaleus/.local/share/defold-checkpoint/`.
20
+ */
21
+ const project_save_path: string;
22
+
23
+ /**
24
+ * Loads a saved file. A path ending in `.json` is read as text and decoded with
25
+ * `json.decode`; anything else is loaded with `sys.load`. On success the loaded
26
+ * value is returned alone, so the error slot is absent; on any failure — the file
27
+ * missing, unreadable, or holding invalid content — the first value is `false` and
28
+ * the second is the error string. Name the saved shape through the type parameter
29
+ * to avoid casting at the call site.
30
+ * @param path Path relative to `project_save_path`.
31
+ * @returns The loaded value, or `false` and the error that stopped it.
32
+ */
33
+ function read<T = unknown>(path: string): LuaMultiReturn<[T | false, string | undefined]>;
34
+
35
+ /**
36
+ * Saves a value, creating any missing directories along the path first. A path
37
+ * ending in `.json` is encoded with `json.encode` and written as text and flushed
38
+ * immediately; anything else is written with `sys.save`. Creating the directories
39
+ * goes through `lfs`, so the project needs `britzl/defold-lfs` as a dependency;
40
+ * this corpus does not type it.
41
+ * @param path Path relative to `project_save_path`.
42
+ * @param data The value to save.
43
+ * @returns `true`, or `false` and the error that stopped it.
44
+ */
45
+ function write(path: string, data: unknown): LuaMultiReturn<[boolean, string | undefined]>;
46
+
47
+ /**
48
+ * Whether a saved file exists. Returns a real boolean rather than the underlying
49
+ * file attributes, so it reads directly as a condition. Goes through `lfs`, so the
50
+ * project needs `britzl/defold-lfs` as a dependency.
51
+ * @param path Path relative to `project_save_path`.
52
+ */
53
+ function exists(path: string): boolean;
54
+
55
+ /**
56
+ * Every saved file, found by walking the save directory breadth-first. Directories
57
+ * are descended into rather than listed. Goes through `lfs`, so the project needs
58
+ * `britzl/defold-lfs` as a dependency.
59
+ * @returns The file paths, relative to `project_save_path`.
60
+ */
61
+ function list(): string[];
62
+ }