littlejsengine 1.5.0 → 1.5.1
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.
- package/engine/engine.all.js +179 -97
- package/engine/engine.all.min.js +1 -1
- package/engine/engine.all.module.js +362 -173
- package/engine/engine.all.module.min.js +1 -1
- package/engine/engine.all.release.js +173 -96
- package/engine/engine.js +47 -16
- package/engine/engineAudio.js +1 -1
- package/engine/engineDebug.js +6 -1
- package/engine/engineDraw.js +24 -26
- package/engine/engineExport.js +183 -76
- package/engine/engineInput.js +6 -1
- package/engine/engineMedals.js +1 -0
- package/engine/engineObject.js +6 -6
- package/engine/engineParticles.js +5 -5
- package/engine/engineSettings.js +46 -20
- package/engine/engineTileLayer.js +13 -12
- package/engine/engineUtilities.js +13 -7
- package/engine/engineWebGL.js +11 -2
- package/engine/index.d.ts +1788 -1615
- package/examples/breakout/game.js +3 -1
- package/examples/breakout/index.html +3 -3
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +1 -1
- package/examples/platformer/game.js +2 -0
- package/examples/platformer/gameObjects.js +3 -3
- package/examples/platformer/index.html +6 -6
- package/examples/puzzle/index.html +2 -2
- package/examples/stress/index.html +4 -4
- package/examples/typescript/game.js +89 -89
- package/examples/typescript/index.html +1 -1
- package/index.html +13 -13
- package/package.json +6 -6
package/engine/index.d.ts
CHANGED
|
@@ -1,1615 +1,1788 @@
|
|
|
1
|
-
declare module "engine.all.module" {
|
|
2
|
-
/**
|
|
3
|
-
* LittleJS Module Export
|
|
4
|
-
* <br> - Export engine as a module with extra functions where necessary
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @
|
|
52
|
-
* @memberof Settings */
|
|
53
|
-
export
|
|
54
|
-
/**
|
|
55
|
-
* @
|
|
56
|
-
* @memberof Settings */
|
|
57
|
-
export
|
|
58
|
-
/**
|
|
59
|
-
* @
|
|
60
|
-
* @memberof Settings */
|
|
61
|
-
export
|
|
62
|
-
/**
|
|
63
|
-
* @
|
|
64
|
-
* @
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* @
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* @
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* @
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
* @
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
* @
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* @
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
* @
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
*
|
|
144
|
-
* @
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
* @
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* @default
|
|
153
|
-
* @memberof Settings */
|
|
154
|
-
export let
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
157
|
-
* @
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
* @
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* @default
|
|
169
|
-
* @memberof Settings */
|
|
170
|
-
export let
|
|
171
|
-
/** Default
|
|
172
|
-
* @
|
|
173
|
-
* @
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* @
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
* @
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* @default
|
|
189
|
-
* @memberof Settings */
|
|
190
|
-
export let
|
|
191
|
-
/**
|
|
192
|
-
* @
|
|
193
|
-
* @
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
* @
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* @
|
|
209
|
-
* @
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
* @
|
|
213
|
-
* @
|
|
214
|
-
* @memberof
|
|
215
|
-
export
|
|
216
|
-
/**
|
|
217
|
-
* @
|
|
218
|
-
* @
|
|
219
|
-
* @
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
* @
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* @
|
|
228
|
-
* @
|
|
229
|
-
* @memberof
|
|
230
|
-
export
|
|
231
|
-
/**
|
|
232
|
-
* @
|
|
233
|
-
* @
|
|
234
|
-
* @
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
* @
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* @
|
|
243
|
-
* @
|
|
244
|
-
* @
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
* @
|
|
249
|
-
* @
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
* @
|
|
253
|
-
* @
|
|
254
|
-
* @
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* @
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
* @
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
* @
|
|
271
|
-
* @
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
* @
|
|
276
|
-
* @
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
* @
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
* @
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* @
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
* @
|
|
295
|
-
* @
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
* @
|
|
300
|
-
* @
|
|
301
|
-
* @
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
* @
|
|
306
|
-
* @
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
* @
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* @
|
|
315
|
-
* @
|
|
316
|
-
* @memberof
|
|
317
|
-
export
|
|
318
|
-
/**
|
|
319
|
-
* @
|
|
320
|
-
* @
|
|
321
|
-
* @memberof
|
|
322
|
-
export
|
|
323
|
-
/**
|
|
324
|
-
* @
|
|
325
|
-
* @
|
|
326
|
-
* @memberof
|
|
327
|
-
export
|
|
328
|
-
/**
|
|
329
|
-
* @
|
|
330
|
-
* @
|
|
331
|
-
* @
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
* @
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
* @
|
|
340
|
-
* @
|
|
341
|
-
* @memberof
|
|
342
|
-
export
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
* @
|
|
346
|
-
* @
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
* @
|
|
350
|
-
|
|
351
|
-
* @
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
* @
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
* @param {Number}
|
|
358
|
-
* @param {
|
|
359
|
-
* @
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
* @
|
|
364
|
-
* @
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
* @
|
|
370
|
-
* @
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
* @param {Number}
|
|
374
|
-
* @
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
* @param {
|
|
379
|
-
* @param {
|
|
380
|
-
* @param {
|
|
381
|
-
* @
|
|
382
|
-
* @memberof
|
|
383
|
-
export function
|
|
384
|
-
/**
|
|
385
|
-
* @
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
* @param {
|
|
389
|
-
* @
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
* @
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
* @memberof
|
|
396
|
-
export function
|
|
397
|
-
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*/
|
|
406
|
-
export
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
*
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
*
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
|
|
566
|
-
/** Returns this
|
|
567
|
-
*
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
|
|
574
|
-
/** Returns this
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* @
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
*
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
*
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
* @
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
*
|
|
648
|
-
* @
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
*/
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
/**
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
* @param {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
* @param {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
*
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
*
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
*
|
|
802
|
-
|
|
803
|
-
export
|
|
804
|
-
/**
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
*
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
* @param {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
*/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
* @
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
* @
|
|
955
|
-
* @
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
* @
|
|
961
|
-
* @
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
* @param {Number}
|
|
967
|
-
* @param {
|
|
968
|
-
* @
|
|
969
|
-
* @
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
* @
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
* @param {
|
|
977
|
-
* @
|
|
978
|
-
* @
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
* @
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
* @
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
* @param {
|
|
988
|
-
* @param {
|
|
989
|
-
* @
|
|
990
|
-
* @
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
* @
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
* @
|
|
998
|
-
* @
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
* @memberof
|
|
1002
|
-
export
|
|
1003
|
-
/**
|
|
1004
|
-
* @
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
* @
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
* @
|
|
1013
|
-
* @
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
* @param {
|
|
1017
|
-
* @param {
|
|
1018
|
-
* @
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
* @param {
|
|
1023
|
-
* @
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
* @param {
|
|
1029
|
-
* @param {Number}
|
|
1030
|
-
* @
|
|
1031
|
-
* @
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
*
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
* @
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
* @
|
|
1044
|
-
* @
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
* //
|
|
1055
|
-
*
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
* @
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
* @
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
*
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
*/
|
|
1116
|
-
export
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
* @
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
* @
|
|
1141
|
-
* @memberof
|
|
1142
|
-
export
|
|
1143
|
-
/**
|
|
1144
|
-
* @
|
|
1145
|
-
* @
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
* @
|
|
1149
|
-
* @
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
* @memberof
|
|
1154
|
-
export
|
|
1155
|
-
/**
|
|
1156
|
-
* @param {Number}
|
|
1157
|
-
* @param {Number} [
|
|
1158
|
-
* @return {
|
|
1159
|
-
* @memberof
|
|
1160
|
-
export function
|
|
1161
|
-
/**
|
|
1162
|
-
* @
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
* @
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
* @param {Number}
|
|
1169
|
-
* @param {
|
|
1170
|
-
* @return {
|
|
1171
|
-
* @memberof
|
|
1172
|
-
export function
|
|
1173
|
-
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
* @
|
|
1177
|
-
* @
|
|
1178
|
-
|
|
1179
|
-
export function
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
* @memberof
|
|
1190
|
-
export
|
|
1191
|
-
/**
|
|
1192
|
-
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1199
|
-
*
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
* @
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* @
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
/**
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
*
|
|
1331
|
-
*
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
*
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
* @param {
|
|
1461
|
-
* @param {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
* @param {Number}
|
|
1498
|
-
* @param {
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
*
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
/**
|
|
1524
|
-
|
|
1525
|
-
/**
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
*
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
/**
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
* @default
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1599
|
-
*
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
export
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1
|
+
declare module "engine.all.module" {
|
|
2
|
+
/**
|
|
3
|
+
* LittleJS Module Export
|
|
4
|
+
* <br> - Export engine as a module with extra functions where necessary
|
|
5
|
+
*/
|
|
6
|
+
/** Set position of camera in world space
|
|
7
|
+
* @param {Vector2} pos
|
|
8
|
+
* @memberof Settings */
|
|
9
|
+
export function setCameraPos(pos: Vector2): Vector2;
|
|
10
|
+
/** Set scale of camera in world space
|
|
11
|
+
* @param {Number} scale
|
|
12
|
+
* @memberof Settings */
|
|
13
|
+
export function setCameraScale(scale: number): number;
|
|
14
|
+
/** Set max size of the canvas
|
|
15
|
+
* @param {Vector2} size
|
|
16
|
+
* @memberof Settings */
|
|
17
|
+
export function setCanvasMaxSize(size: Vector2): Vector2;
|
|
18
|
+
/** Set fixed size of the canvas
|
|
19
|
+
* @param {Vector2} size
|
|
20
|
+
* @memberof Settings */
|
|
21
|
+
export function setCanvasFixedSize(size: Vector2): Vector2;
|
|
22
|
+
/** Disables anti aliasing for pixel art if true
|
|
23
|
+
* @param {Boolean} pixelated
|
|
24
|
+
* @memberof Settings */
|
|
25
|
+
export function setCavasPixelated(pixelated: boolean): boolean;
|
|
26
|
+
/** Set default font used for text rendering
|
|
27
|
+
* @param {String} font
|
|
28
|
+
* @memberof Settings */
|
|
29
|
+
export function setFontDefault(font: string): string;
|
|
30
|
+
/** Set if webgl rendering is enabled
|
|
31
|
+
* @param {Boolean} enable
|
|
32
|
+
* @memberof Settings */
|
|
33
|
+
export function setGlEnable(enable: boolean): boolean;
|
|
34
|
+
/** Set to not composite the WebGL canvas
|
|
35
|
+
* @param {Boolean} overlay
|
|
36
|
+
* @memberof Settings */
|
|
37
|
+
export function setGlOverlay(overlay: boolean): boolean;
|
|
38
|
+
/** Set default size of tiles in pixels
|
|
39
|
+
* @param {Vector2} size
|
|
40
|
+
* @memberof Settings */
|
|
41
|
+
export function setTileSizeDefault(size: Vector2): Vector2;
|
|
42
|
+
/** Set to prevent tile bleeding from neighbors in pixels
|
|
43
|
+
* @param {Number} scale
|
|
44
|
+
* @memberof Settings */
|
|
45
|
+
export function setTileFixBleedScale(scale: number): number;
|
|
46
|
+
/** Set if collisions between objects are enabled
|
|
47
|
+
* @param {Boolean} enable
|
|
48
|
+
* @memberof Settings */
|
|
49
|
+
export function setEnablePhysicsSolver(enable: boolean): boolean;
|
|
50
|
+
/** Set default object mass for collison calcuations
|
|
51
|
+
* @param {Number} mass
|
|
52
|
+
* @memberof Settings */
|
|
53
|
+
export function setObjectDefaultMass(mass: number): number;
|
|
54
|
+
/** Set how much to slow velocity by each frame
|
|
55
|
+
* @param {Number} damping
|
|
56
|
+
* @memberof Settings */
|
|
57
|
+
export function setObjectDefaultDamping(damp: any): any;
|
|
58
|
+
/** Set how much to slow angular velocity each frame
|
|
59
|
+
* @param {Number} damping
|
|
60
|
+
* @memberof Settings */
|
|
61
|
+
export function setObjectDefaultAngleDamping(damp: any): any;
|
|
62
|
+
/** Set how much to bounce when a collision occur
|
|
63
|
+
* @param {Number} elasticity
|
|
64
|
+
* @memberof Settings */
|
|
65
|
+
export function setObjectDefaultElasticity(elasticity: number): number;
|
|
66
|
+
/** Set how much to slow when touching
|
|
67
|
+
* @param {Number} friction
|
|
68
|
+
* @memberof Settings */
|
|
69
|
+
export function setObjectDefaultFriction(friction: number): number;
|
|
70
|
+
/** Set max speed to avoid fast objects missing collisions
|
|
71
|
+
* @param {Number} speed
|
|
72
|
+
* @memberof Settings */
|
|
73
|
+
export function setObjectMaxSpeed(speed: number): number;
|
|
74
|
+
/** Set how much gravity to apply to objects along the Y axis
|
|
75
|
+
* @param {Number} gravity
|
|
76
|
+
* @memberof Settings */
|
|
77
|
+
export function setGravity(g: any): any;
|
|
78
|
+
/** Set to scales emit rate of particles
|
|
79
|
+
* @param {Number} scale
|
|
80
|
+
* @memberof Settings */
|
|
81
|
+
export function setParticleEmitRateScale(scale: number): number;
|
|
82
|
+
/** Set if gamepads are enabled
|
|
83
|
+
* @param {Boolean} enable
|
|
84
|
+
* @memberof Settings */
|
|
85
|
+
export function setGamepadsEnable(enable: boolean): boolean;
|
|
86
|
+
/** Set if the dpad input is also routed to the left analog stick
|
|
87
|
+
* @param {Boolean} enable
|
|
88
|
+
* @memberof Settings */
|
|
89
|
+
export function setGamepadDirectionEmulateStick(enable: boolean): boolean;
|
|
90
|
+
/** Set if true the WASD keys are also routed to the direction keys
|
|
91
|
+
* @param {Boolean} enable
|
|
92
|
+
* @memberof Settings */
|
|
93
|
+
export function setInputWASDEmulateDirection(enable: boolean): boolean;
|
|
94
|
+
/** Set if touch gamepad should appear on mobile devices
|
|
95
|
+
* @param {Boolean} enable
|
|
96
|
+
* @memberof Settings */
|
|
97
|
+
export function setTouchGamepadEnable(enable: boolean): boolean;
|
|
98
|
+
/** Set if touch gamepad should be analog stick or 8 way dpad
|
|
99
|
+
* @param {Boolean} analog
|
|
100
|
+
* @memberof Settings */
|
|
101
|
+
export function setTouchGamepadAnalog(analog: boolean): boolean;
|
|
102
|
+
/** Set size of virutal gamepad for touch devices in pixels
|
|
103
|
+
* @param {Number} size
|
|
104
|
+
* @memberof Settings */
|
|
105
|
+
export function setTouchGamepadSize(size: number): number;
|
|
106
|
+
/** Set transparency of touch gamepad overlay
|
|
107
|
+
* @param {Number} alpha
|
|
108
|
+
* @memberof Settings */
|
|
109
|
+
export function setTouchGamepadAlpha(alpha: number): number;
|
|
110
|
+
/** Set to allow vibration hardware if it exists
|
|
111
|
+
* @param {Boolean} enable
|
|
112
|
+
* @memberof Settings */
|
|
113
|
+
export function setVibrateEnable(enable: boolean): boolean;
|
|
114
|
+
/** Set to disable all audio code
|
|
115
|
+
* @param {Boolean} enable
|
|
116
|
+
* @memberof Settings */
|
|
117
|
+
export function setSoundEnable(enable: boolean): boolean;
|
|
118
|
+
/** Set volume scale to apply to all sound, music and speech
|
|
119
|
+
* @param {Number} volume
|
|
120
|
+
* @memberof Settings */
|
|
121
|
+
export function setSoundVolume(volume: number): number;
|
|
122
|
+
/** Set default range where sound no longer plays
|
|
123
|
+
* @param {Number} range
|
|
124
|
+
* @memberof Settings */
|
|
125
|
+
export function setSoundDefaultRange(range: number): number;
|
|
126
|
+
/** Set default range percent to start tapering off sound
|
|
127
|
+
* @param {Number} taper
|
|
128
|
+
* @memberof Settings */
|
|
129
|
+
export function setSoundDefaultTaper(taper: number): number;
|
|
130
|
+
/** Set how long to show medals for in seconds
|
|
131
|
+
* @param {Number} time
|
|
132
|
+
* @memberof Settings */
|
|
133
|
+
export function setMedalDisplayTime(time: number): number;
|
|
134
|
+
/** Set how quickly to slide on/off medals in seconds
|
|
135
|
+
* @param {Number} time
|
|
136
|
+
* @memberof Settings */
|
|
137
|
+
export function setMedalDisplaySlideTime(time: number): number;
|
|
138
|
+
/** Set size of medal display
|
|
139
|
+
* @param {Vector2} size
|
|
140
|
+
* @memberof Settings */
|
|
141
|
+
export function setMedalDisplaySize(size: Vector2): Vector2;
|
|
142
|
+
/** Set size of icon in medal display
|
|
143
|
+
* @param {Number} size
|
|
144
|
+
* @memberof Settings */
|
|
145
|
+
export function setMedalDisplayIconSize(size: number): number;
|
|
146
|
+
/** Set to stop medals from being unlockable
|
|
147
|
+
* @param {Boolean} preventUnlock
|
|
148
|
+
* @memberof Settings */
|
|
149
|
+
export function setMedalsPreventUnlock(prevent: any): any;
|
|
150
|
+
/** The max size of the canvas, centered if window is larger
|
|
151
|
+
* @type {Vector2}
|
|
152
|
+
* @default Vector2(1920,1200)
|
|
153
|
+
* @memberof Settings */
|
|
154
|
+
export let canvasMaxSize: Vector2;
|
|
155
|
+
/** Fixed size of the canvas, if enabled canvas size never changes
|
|
156
|
+
* - you may also need to set mainCanvasSize if using screen space coords in startup
|
|
157
|
+
* @type {Vector2}
|
|
158
|
+
* @default Vector2()
|
|
159
|
+
* @memberof Settings */
|
|
160
|
+
export let canvasFixedSize: Vector2;
|
|
161
|
+
/** Disables anti aliasing for pixel art if true
|
|
162
|
+
* @type {Boolean}
|
|
163
|
+
* @default
|
|
164
|
+
* @memberof Settings */
|
|
165
|
+
export let cavasPixelated: boolean;
|
|
166
|
+
/** Default font used for text rendering
|
|
167
|
+
* @type {String}
|
|
168
|
+
* @default
|
|
169
|
+
* @memberof Settings */
|
|
170
|
+
export let fontDefault: string;
|
|
171
|
+
/** Default size of tiles in pixels
|
|
172
|
+
* @type {Vector2}
|
|
173
|
+
* @default Vector2(16,16)
|
|
174
|
+
* @memberof Settings */
|
|
175
|
+
export let tileSizeDefault: Vector2;
|
|
176
|
+
/** Prevent tile bleeding from neighbors in pixels
|
|
177
|
+
* @type {Number}
|
|
178
|
+
* @default
|
|
179
|
+
* @memberof Settings */
|
|
180
|
+
export let tileFixBleedScale: number;
|
|
181
|
+
/** Enable physics solver for collisions between objects
|
|
182
|
+
* @type {Boolean}
|
|
183
|
+
* @default
|
|
184
|
+
* @memberof Settings */
|
|
185
|
+
export let enablePhysicsSolver: boolean;
|
|
186
|
+
/** Default object mass for collison calcuations (how heavy objects are)
|
|
187
|
+
* @type {Number}
|
|
188
|
+
* @default
|
|
189
|
+
* @memberof Settings */
|
|
190
|
+
export let objectDefaultMass: number;
|
|
191
|
+
/** How much to slow velocity by each frame (0-1)
|
|
192
|
+
* @type {Number}
|
|
193
|
+
* @default
|
|
194
|
+
* @memberof Settings */
|
|
195
|
+
export let objectDefaultDamping: number;
|
|
196
|
+
/** How much to slow angular velocity each frame (0-1)
|
|
197
|
+
* @type {Number}
|
|
198
|
+
* @default
|
|
199
|
+
* @memberof Settings */
|
|
200
|
+
export let objectDefaultAngleDamping: number;
|
|
201
|
+
/** How much to bounce when a collision occurs (0-1)
|
|
202
|
+
* @type {Number}
|
|
203
|
+
* @default 0
|
|
204
|
+
* @memberof Settings */
|
|
205
|
+
export let objectDefaultElasticity: number;
|
|
206
|
+
/** How much to slow when touching (0-1)
|
|
207
|
+
* @type {Number}
|
|
208
|
+
* @default
|
|
209
|
+
* @memberof Settings */
|
|
210
|
+
export let objectDefaultFriction: number;
|
|
211
|
+
/** Clamp max speed to avoid fast objects missing collisions
|
|
212
|
+
* @type {Number}
|
|
213
|
+
* @default
|
|
214
|
+
* @memberof Settings */
|
|
215
|
+
export let objectMaxSpeed: number;
|
|
216
|
+
/** How much gravity to apply to objects along the Y axis, negative is down
|
|
217
|
+
* @type {Number}
|
|
218
|
+
* @default 0
|
|
219
|
+
* @memberof Settings */
|
|
220
|
+
export let gravity: number;
|
|
221
|
+
/** Scales emit rate of particles, useful for low graphics mode (0 disables particle emitters)
|
|
222
|
+
* @type {Number}
|
|
223
|
+
* @default
|
|
224
|
+
* @memberof Settings */
|
|
225
|
+
export let particleEmitRateScale: number;
|
|
226
|
+
/** Position of camera in world space
|
|
227
|
+
* @type {Vector2}
|
|
228
|
+
* @default Vector2()
|
|
229
|
+
* @memberof Settings */
|
|
230
|
+
export let cameraPos: Vector2;
|
|
231
|
+
/** Scale of camera in world space
|
|
232
|
+
* @type {Number}
|
|
233
|
+
* @default
|
|
234
|
+
* @memberof Settings */
|
|
235
|
+
export let cameraScale: number;
|
|
236
|
+
/** Enable webgl rendering, webgl can be disabled and removed from build (with some features disabled)
|
|
237
|
+
* @type {Boolean}
|
|
238
|
+
* @default
|
|
239
|
+
* @memberof Settings */
|
|
240
|
+
export let glEnable: boolean;
|
|
241
|
+
/** Fixes slow rendering in some browsers by not compositing the WebGL canvas
|
|
242
|
+
* @type {Boolean}
|
|
243
|
+
* @default
|
|
244
|
+
* @memberof Settings */
|
|
245
|
+
export let glOverlay: boolean;
|
|
246
|
+
/** Should gamepads be allowed
|
|
247
|
+
* @type {Boolean}
|
|
248
|
+
* @default
|
|
249
|
+
* @memberof Settings */
|
|
250
|
+
export let gamepadsEnable: boolean;
|
|
251
|
+
/** If true, the dpad input is also routed to the left analog stick (for better accessability)
|
|
252
|
+
* @type {Boolean}
|
|
253
|
+
* @default
|
|
254
|
+
* @memberof Settings */
|
|
255
|
+
export let gamepadDirectionEmulateStick: boolean;
|
|
256
|
+
/** If true the WASD keys are also routed to the direction keys (for better accessability)
|
|
257
|
+
* @type {Boolean}
|
|
258
|
+
* @default
|
|
259
|
+
* @memberof Settings */
|
|
260
|
+
export let inputWASDEmulateDirection: boolean;
|
|
261
|
+
/** True if touch gamepad should appear on mobile devices
|
|
262
|
+
* <br> - Supports left analog stick, 4 face buttons and start button (button 9)
|
|
263
|
+
* <br> - Must be set by end of gameInit to be activated
|
|
264
|
+
* @type {Boolean}
|
|
265
|
+
* @default 0
|
|
266
|
+
* @memberof Settings */
|
|
267
|
+
export let touchGamepadEnable: boolean;
|
|
268
|
+
/** True if touch gamepad should be analog stick or false to use if 8 way dpad
|
|
269
|
+
* @type {Boolean}
|
|
270
|
+
* @default
|
|
271
|
+
* @memberof Settings */
|
|
272
|
+
export let touchGamepadAnalog: boolean;
|
|
273
|
+
/** Size of virutal gamepad for touch devices in pixels
|
|
274
|
+
* @type {Number}
|
|
275
|
+
* @default
|
|
276
|
+
* @memberof Settings */
|
|
277
|
+
export let touchGamepadSize: number;
|
|
278
|
+
/** Transparency of touch gamepad overlay
|
|
279
|
+
* @type {Number}
|
|
280
|
+
* @default
|
|
281
|
+
* @memberof Settings */
|
|
282
|
+
export let touchGamepadAlpha: number;
|
|
283
|
+
/** Allow vibration hardware if it exists
|
|
284
|
+
* @type {Boolean}
|
|
285
|
+
* @default
|
|
286
|
+
* @memberof Settings */
|
|
287
|
+
export let vibrateEnable: boolean;
|
|
288
|
+
/** All audio code can be disabled and removed from build
|
|
289
|
+
* @type {Boolean}
|
|
290
|
+
* @default
|
|
291
|
+
* @memberof Settings */
|
|
292
|
+
export let soundEnable: boolean;
|
|
293
|
+
/** Volume scale to apply to all sound, music and speech
|
|
294
|
+
* @type {Number}
|
|
295
|
+
* @default
|
|
296
|
+
* @memberof Settings */
|
|
297
|
+
export let soundVolume: number;
|
|
298
|
+
/** Default range where sound no longer plays
|
|
299
|
+
* @type {Number}
|
|
300
|
+
* @default
|
|
301
|
+
* @memberof Settings */
|
|
302
|
+
export let soundDefaultRange: number;
|
|
303
|
+
/** Default range percent to start tapering off sound (0-1)
|
|
304
|
+
* @type {Number}
|
|
305
|
+
* @default
|
|
306
|
+
* @memberof Settings */
|
|
307
|
+
export let soundDefaultTaper: number;
|
|
308
|
+
/** How long to show medals for in seconds
|
|
309
|
+
* @type {Number}
|
|
310
|
+
* @default
|
|
311
|
+
* @memberof Settings */
|
|
312
|
+
export let medalDisplayTime: number;
|
|
313
|
+
/** How quickly to slide on/off medals in seconds
|
|
314
|
+
* @type {Number}
|
|
315
|
+
* @default
|
|
316
|
+
* @memberof Settings */
|
|
317
|
+
export let medalDisplaySlideTime: number;
|
|
318
|
+
/** Size of medal display
|
|
319
|
+
* @type {Vector2}
|
|
320
|
+
* @default Vector2(640,80)
|
|
321
|
+
* @memberof Settings */
|
|
322
|
+
export let medalDisplaySize: Vector2;
|
|
323
|
+
/** Size of icon in medal display
|
|
324
|
+
* @type {Number}
|
|
325
|
+
* @default
|
|
326
|
+
* @memberof Settings */
|
|
327
|
+
export let medalDisplayIconSize: number;
|
|
328
|
+
/** True if debug is enabled
|
|
329
|
+
* @type {Boolean}
|
|
330
|
+
* @default
|
|
331
|
+
* @memberof Debug */
|
|
332
|
+
export const debug: boolean;
|
|
333
|
+
/** True if watermark with FPS should be down, false in release builds
|
|
334
|
+
* @type {Boolean}
|
|
335
|
+
* @default
|
|
336
|
+
* @memberof Debug */
|
|
337
|
+
export let showWatermark: boolean;
|
|
338
|
+
/** True if god mode is enabled, handle this however you want
|
|
339
|
+
* @type {Boolean}
|
|
340
|
+
* @default
|
|
341
|
+
* @memberof Debug */
|
|
342
|
+
export let godMode: boolean;
|
|
343
|
+
export function ASSERT(...assert: any[]): void;
|
|
344
|
+
/** Draw a debug rectangle in world space
|
|
345
|
+
* @param {Vector2} pos
|
|
346
|
+
* @param {Vector2} [size=Vector2()]
|
|
347
|
+
* @param {String} [color='#fff']
|
|
348
|
+
* @param {Number} [time=0]
|
|
349
|
+
* @param {Number} [angle=0]
|
|
350
|
+
* @param {Boolean} [fill=false]
|
|
351
|
+
* @memberof Debug */
|
|
352
|
+
export function debugRect(pos: Vector2, size?: Vector2, color?: string, time?: number, angle?: number, fill?: boolean): void;
|
|
353
|
+
/** Draw a debug circle in world space
|
|
354
|
+
* @param {Vector2} pos
|
|
355
|
+
* @param {Number} [radius=0]
|
|
356
|
+
* @param {String} [color='#fff']
|
|
357
|
+
* @param {Number} [time=0]
|
|
358
|
+
* @param {Boolean} [fill=false]
|
|
359
|
+
* @memberof Debug */
|
|
360
|
+
export function debugCircle(pos: Vector2, radius?: number, color?: string, time?: number, fill?: boolean): void;
|
|
361
|
+
/** Draw a debug point in world space
|
|
362
|
+
* @param {Vector2} pos
|
|
363
|
+
* @param {String} [color='#fff']
|
|
364
|
+
* @param {Number} [time=0]
|
|
365
|
+
* @param {Number} [angle=0]
|
|
366
|
+
* @memberof Debug */
|
|
367
|
+
export function debugPoint(pos: Vector2, color?: string, time?: number, angle?: number): void;
|
|
368
|
+
/** Draw a debug line in world space
|
|
369
|
+
* @param {Vector2} posA
|
|
370
|
+
* @param {Vector2} posB
|
|
371
|
+
* @param {String} [color='#fff']
|
|
372
|
+
* @param {Number} [thickness=.1]
|
|
373
|
+
* @param {Number} [time=0]
|
|
374
|
+
* @memberof Debug */
|
|
375
|
+
export function debugLine(posA: Vector2, posB: Vector2, color?: string, thickness?: number, time?: number): void;
|
|
376
|
+
/** Draw a debug axis aligned bounding box in world space
|
|
377
|
+
* @param {Vector2} posA
|
|
378
|
+
* @param {Vector2} sizeA
|
|
379
|
+
* @param {Vector2} posB
|
|
380
|
+
* @param {Vector2} sizeB
|
|
381
|
+
* @param {String} [color='#fff']
|
|
382
|
+
* @memberof Debug */
|
|
383
|
+
export function debugAABB(pA: any, sA: any, pB: any, sB: any, color?: string): void;
|
|
384
|
+
/** Draw a debug axis aligned bounding box in world space
|
|
385
|
+
* @param {String} text
|
|
386
|
+
* @param {Vector2} pos
|
|
387
|
+
* @param {Number} [size=1]
|
|
388
|
+
* @param {String} [color='#fff']
|
|
389
|
+
* @param {Number} [time=0]
|
|
390
|
+
* @param {Number} [angle=0]
|
|
391
|
+
* @param {String} [font='monospace']
|
|
392
|
+
* @memberof Debug */
|
|
393
|
+
export function debugText(text: string, pos: Vector2, size?: number, color?: string, time?: number, angle?: number, font?: string): void;
|
|
394
|
+
/** Clear all debug primitives in the list
|
|
395
|
+
* @memberof Debug */
|
|
396
|
+
export function debugClear(): any[];
|
|
397
|
+
/** Save a canvas to disk
|
|
398
|
+
* @param {HTMLCanvasElement} canvas
|
|
399
|
+
* @param {String} [filename]
|
|
400
|
+
* @memberof Debug */
|
|
401
|
+
export function debugSaveCanvas(canvas: HTMLCanvasElement, filename?: string): void;
|
|
402
|
+
/** A shortcut to get Math.PI
|
|
403
|
+
* @type {Number}
|
|
404
|
+
* @default Math.PI
|
|
405
|
+
* @memberof Utilities */
|
|
406
|
+
export const PI: number;
|
|
407
|
+
/** Returns absoulte value of value passed in
|
|
408
|
+
* @param {Number} value
|
|
409
|
+
* @return {Number}
|
|
410
|
+
* @memberof Utilities */
|
|
411
|
+
export function abs(a: any): number;
|
|
412
|
+
/** Returns lowest of two values passed in
|
|
413
|
+
* @param {Number} valueA
|
|
414
|
+
* @param {Number} valueB
|
|
415
|
+
* @return {Number}
|
|
416
|
+
* @memberof Utilities */
|
|
417
|
+
export function min(a: any, b: any): number;
|
|
418
|
+
/** Returns highest of two values passed in
|
|
419
|
+
* @param {Number} valueA
|
|
420
|
+
* @param {Number} valueB
|
|
421
|
+
* @return {Number}
|
|
422
|
+
* @memberof Utilities */
|
|
423
|
+
export function max(a: any, b: any): number;
|
|
424
|
+
/** Returns the sign of value passed in (also returns 1 if 0)
|
|
425
|
+
* @param {Number} value
|
|
426
|
+
* @return {Number}
|
|
427
|
+
* @memberof Utilities */
|
|
428
|
+
export function sign(a: any): number;
|
|
429
|
+
/** Returns first parm modulo the second param, but adjusted so negative numbers work as expected
|
|
430
|
+
* @param {Number} dividend
|
|
431
|
+
* @param {Number} [divisor=1]
|
|
432
|
+
* @return {Number}
|
|
433
|
+
* @memberof Utilities */
|
|
434
|
+
export function mod(a: any, b?: number): number;
|
|
435
|
+
/** Clamps the value beween max and min
|
|
436
|
+
* @param {Number} value
|
|
437
|
+
* @param {Number} [min=0]
|
|
438
|
+
* @param {Number} [max=1]
|
|
439
|
+
* @return {Number}
|
|
440
|
+
* @memberof Utilities */
|
|
441
|
+
export function clamp(v: any, min?: number, max?: number): number;
|
|
442
|
+
/** Returns what percentage the value is between max and min
|
|
443
|
+
* @param {Number} value
|
|
444
|
+
* @param {Number} [min=0]
|
|
445
|
+
* @param {Number} [max=1]
|
|
446
|
+
* @return {Number}
|
|
447
|
+
* @memberof Utilities */
|
|
448
|
+
export function percent(v: any, min?: number, max?: number): number;
|
|
449
|
+
/** Linearly interpolates the percent value between max and min
|
|
450
|
+
* @param {Number} percent
|
|
451
|
+
* @param {Number} [min=0]
|
|
452
|
+
* @param {Number} [max=1]
|
|
453
|
+
* @return {Number}
|
|
454
|
+
* @memberof Utilities */
|
|
455
|
+
export function lerp(p: any, min?: number, max?: number): number;
|
|
456
|
+
/** Applies smoothstep function to the percentage value
|
|
457
|
+
* @param {Number} value
|
|
458
|
+
* @return {Number}
|
|
459
|
+
* @memberof Utilities */
|
|
460
|
+
export function smoothStep(p: any): number;
|
|
461
|
+
/** Returns the nearest power of two not less then the value
|
|
462
|
+
* @param {Number} value
|
|
463
|
+
* @return {Number}
|
|
464
|
+
* @memberof Utilities */
|
|
465
|
+
export function nearestPowerOfTwo(v: any): number;
|
|
466
|
+
/** Returns true if two axis aligned bounding boxes are overlapping
|
|
467
|
+
* @param {Vector2} pointA - Center of box A
|
|
468
|
+
* @param {Vector2} sizeA - Size of box A
|
|
469
|
+
* @param {Vector2} pointB - Center of box B
|
|
470
|
+
* @param {Vector2} [sizeB] - Size of box B
|
|
471
|
+
* @return {Boolean} - True if overlapping
|
|
472
|
+
* @memberof Utilities */
|
|
473
|
+
export function isOverlapping(pA: any, sA: any, pB: any, sB: any): boolean;
|
|
474
|
+
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
475
|
+
* @param {Number} [frequency=1] - Frequency of the wave in Hz
|
|
476
|
+
* @param {Number} [amplitude=1] - Amplitude (max height) of the wave
|
|
477
|
+
* @param {Number} [t=time] - Value to use for time of the wave
|
|
478
|
+
* @return {Number} - Value waving between 0 and amplitude
|
|
479
|
+
* @memberof Utilities */
|
|
480
|
+
export function wave(frequency?: number, amplitude?: number, t?: number): number;
|
|
481
|
+
/** Formats seconds to mm:ss style for display purposes
|
|
482
|
+
* @param {Number} t - time in seconds
|
|
483
|
+
* @return {String}
|
|
484
|
+
* @memberof Utilities */
|
|
485
|
+
export function formatTime(t: number): string;
|
|
486
|
+
/** Random global functions
|
|
487
|
+
* @namespace Random */
|
|
488
|
+
/** Returns a random value between the two values passed in
|
|
489
|
+
* @param {Number} [valueA=1]
|
|
490
|
+
* @param {Number} [valueB=0]
|
|
491
|
+
* @return {Number}
|
|
492
|
+
* @memberof Random */
|
|
493
|
+
export function rand(a?: number, b?: number): number;
|
|
494
|
+
/** Returns a floored random value the two values passed in
|
|
495
|
+
* @param {Number} [valueA=1]
|
|
496
|
+
* @param {Number} [valueB=0]
|
|
497
|
+
* @return {Number}
|
|
498
|
+
* @memberof Random */
|
|
499
|
+
export function randInt(a?: number, b?: number): number;
|
|
500
|
+
/** Randomly returns either -1 or 1
|
|
501
|
+
* @return {Number}
|
|
502
|
+
* @memberof Random */
|
|
503
|
+
export function randSign(): number;
|
|
504
|
+
/** Returns a random Vector2 within a circular shape
|
|
505
|
+
* @param {Number} [radius=1]
|
|
506
|
+
* @param {Number} [minRadius=0]
|
|
507
|
+
* @return {Vector2}
|
|
508
|
+
* @memberof Random */
|
|
509
|
+
export function randInCircle(radius?: number, minRadius?: number): Vector2;
|
|
510
|
+
/** Returns a random Vector2 with the passed in length
|
|
511
|
+
* @param {Number} [length=1]
|
|
512
|
+
* @return {Vector2}
|
|
513
|
+
* @memberof Random */
|
|
514
|
+
export function randVector(length?: number): Vector2;
|
|
515
|
+
/** Returns a random color between the two passed in colors, combine components if linear
|
|
516
|
+
* @param {Color} [colorA=Color()]
|
|
517
|
+
* @param {Color} [colorB=Color(0,0,0,1)]
|
|
518
|
+
* @param {Boolean} [linear]
|
|
519
|
+
* @return {Color}
|
|
520
|
+
* @memberof Random */
|
|
521
|
+
export function randColor(cA?: Color, cB?: Color, linear?: boolean): Color;
|
|
522
|
+
/** Seed used by the randSeeded function
|
|
523
|
+
* @type {Number}
|
|
524
|
+
* @default
|
|
525
|
+
* @memberof Random */
|
|
526
|
+
export let randSeed: number;
|
|
527
|
+
/** Set seed used by the randSeeded function, should not be 0
|
|
528
|
+
* @param {Number} seed
|
|
529
|
+
* @memberof Random */
|
|
530
|
+
export function setRandSeed(seed: number): number;
|
|
531
|
+
/** Returns a seeded random value between the two values passed in using randSeed
|
|
532
|
+
* @param {Number} [valueA=1]
|
|
533
|
+
* @param {Number} [valueB=0]
|
|
534
|
+
* @return {Number}
|
|
535
|
+
* @memberof Random */
|
|
536
|
+
export function randSeeded(a?: number, b?: number): number;
|
|
537
|
+
/**
|
|
538
|
+
* 2D Vector object with vector math library
|
|
539
|
+
* <br> - Functions do not change this so they can be chained together
|
|
540
|
+
* @example
|
|
541
|
+
* let a = new Vector2(2, 3); // vector with coordinates (2, 3)
|
|
542
|
+
* let b = new Vector2; // vector with coordinates (0, 0)
|
|
543
|
+
* let c = vec2(4, 2); // use the vec2 function to make a Vector2
|
|
544
|
+
* let d = a.add(b).scale(5); // operators can be chained
|
|
545
|
+
*/
|
|
546
|
+
export class Vector2 {
|
|
547
|
+
/** Create a 2D vector with the x and y passed in, can also be created with vec2()
|
|
548
|
+
* @param {Number} [x=0] - X axis location
|
|
549
|
+
* @param {Number} [y=0] - Y axis location */
|
|
550
|
+
constructor(x?: number, y?: number);
|
|
551
|
+
/** @property {Number} - X axis location */
|
|
552
|
+
x: number;
|
|
553
|
+
/** @property {Number} - Y axis location */
|
|
554
|
+
y: number;
|
|
555
|
+
/** Returns a new vector that is a copy of this
|
|
556
|
+
* @return {Vector2} */
|
|
557
|
+
copy(): Vector2;
|
|
558
|
+
/** Returns a copy of this vector plus the vector passed in
|
|
559
|
+
* @param {Vector2} vector
|
|
560
|
+
* @return {Vector2} */
|
|
561
|
+
add(v: any): Vector2;
|
|
562
|
+
/** Returns a copy of this vector minus the vector passed in
|
|
563
|
+
* @param {Vector2} vector
|
|
564
|
+
* @return {Vector2} */
|
|
565
|
+
subtract(v: any): Vector2;
|
|
566
|
+
/** Returns a copy of this vector times the vector passed in
|
|
567
|
+
* @param {Vector2} vector
|
|
568
|
+
* @return {Vector2} */
|
|
569
|
+
multiply(v: any): Vector2;
|
|
570
|
+
/** Returns a copy of this vector divided by the vector passed in
|
|
571
|
+
* @param {Vector2} vector
|
|
572
|
+
* @return {Vector2} */
|
|
573
|
+
divide(v: any): Vector2;
|
|
574
|
+
/** Returns a copy of this vector scaled by the vector passed in
|
|
575
|
+
* @param {Number} scale
|
|
576
|
+
* @return {Vector2} */
|
|
577
|
+
scale(s: any): Vector2;
|
|
578
|
+
/** Returns the length of this vector
|
|
579
|
+
* @return {Number} */
|
|
580
|
+
length(): number;
|
|
581
|
+
/** Returns the length of this vector squared
|
|
582
|
+
* @return {Number} */
|
|
583
|
+
lengthSquared(): number;
|
|
584
|
+
/** Returns the distance from this vector to vector passed in
|
|
585
|
+
* @param {Vector2} vector
|
|
586
|
+
* @return {Number} */
|
|
587
|
+
distance(v: any): number;
|
|
588
|
+
/** Returns the distance squared from this vector to vector passed in
|
|
589
|
+
* @param {Vector2} vector
|
|
590
|
+
* @return {Number} */
|
|
591
|
+
distanceSquared(v: any): number;
|
|
592
|
+
/** Returns a new vector in same direction as this one with the length passed in
|
|
593
|
+
* @param {Number} [length=1]
|
|
594
|
+
* @return {Vector2} */
|
|
595
|
+
normalize(length?: number): Vector2;
|
|
596
|
+
/** Returns a new vector clamped to length passed in
|
|
597
|
+
* @param {Number} [length=1]
|
|
598
|
+
* @return {Vector2} */
|
|
599
|
+
clampLength(length?: number): Vector2;
|
|
600
|
+
/** Returns the dot product of this and the vector passed in
|
|
601
|
+
* @param {Vector2} vector
|
|
602
|
+
* @return {Number} */
|
|
603
|
+
dot(v: any): number;
|
|
604
|
+
/** Returns the cross product of this and the vector passed in
|
|
605
|
+
* @param {Vector2} vector
|
|
606
|
+
* @return {Number} */
|
|
607
|
+
cross(v: any): number;
|
|
608
|
+
/** Returns the angle of this vector, up is angle 0
|
|
609
|
+
* @return {Number} */
|
|
610
|
+
angle(): number;
|
|
611
|
+
/** Sets this vector with angle and length passed in
|
|
612
|
+
* @param {Number} [angle=0]
|
|
613
|
+
* @param {Number} [length=1]
|
|
614
|
+
* @return {Vector2} */
|
|
615
|
+
setAngle(a?: number, length?: number): Vector2;
|
|
616
|
+
/** Returns copy of this vector rotated by the angle passed in
|
|
617
|
+
* @param {Number} angle
|
|
618
|
+
* @return {Vector2} */
|
|
619
|
+
rotate(a: any): Vector2;
|
|
620
|
+
/** Returns the integer direction of this vector, corrosponding to multiples of 90 degree rotation (0-3)
|
|
621
|
+
* @return {Number} */
|
|
622
|
+
direction(): number;
|
|
623
|
+
/** Returns a copy of this vector that has been inverted
|
|
624
|
+
* @return {Vector2} */
|
|
625
|
+
invert(): Vector2;
|
|
626
|
+
/** Returns a copy of this vector with each axis floored
|
|
627
|
+
* @return {Vector2} */
|
|
628
|
+
floor(): Vector2;
|
|
629
|
+
/** Returns the area this vector covers as a rectangle
|
|
630
|
+
* @return {Number} */
|
|
631
|
+
area(): number;
|
|
632
|
+
/** Returns a new vector that is p percent between this and the vector passed in
|
|
633
|
+
* @param {Vector2} vector
|
|
634
|
+
* @param {Number} percent
|
|
635
|
+
* @return {Vector2} */
|
|
636
|
+
lerp(v: any, p: any): Vector2;
|
|
637
|
+
/** Returns true if this vector is within the bounds of an array size passed in
|
|
638
|
+
* @param {Vector2} arraySize
|
|
639
|
+
* @return {Boolean} */
|
|
640
|
+
arrayCheck(arraySize: Vector2): boolean;
|
|
641
|
+
/** Returns this vector expressed as a string
|
|
642
|
+
* @param {float} digits - precision to display
|
|
643
|
+
* @return {String} */
|
|
644
|
+
toString(digits?: float): string;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Color object (red, green, blue, alpha) with some helpful functions
|
|
648
|
+
* @example
|
|
649
|
+
* let a = new Color; // white
|
|
650
|
+
* let b = new Color(1, 0, 0); // red
|
|
651
|
+
* let c = new Color(0, 0, 0, 0); // transparent black
|
|
652
|
+
* let d = colorRGBA(0, 0, 1); // blue using rgb color
|
|
653
|
+
* let e = colorHSLA(.3, 1, .5); // green using hsl color
|
|
654
|
+
*/
|
|
655
|
+
export class Color {
|
|
656
|
+
/** Create a color with the components passed in, white by default
|
|
657
|
+
* @param {Number} [red=1]
|
|
658
|
+
* @param {Number} [green=1]
|
|
659
|
+
* @param {Number} [blue=1]
|
|
660
|
+
* @param {Number} [alpha=1] */
|
|
661
|
+
constructor(r?: number, g?: number, b?: number, a?: number);
|
|
662
|
+
/** @property {Number} - Red */
|
|
663
|
+
r: number;
|
|
664
|
+
/** @property {Number} - Green */
|
|
665
|
+
g: number;
|
|
666
|
+
/** @property {Number} - Blue */
|
|
667
|
+
b: number;
|
|
668
|
+
/** @property {Number} - Alpha */
|
|
669
|
+
a: number;
|
|
670
|
+
/** Returns a new color that is a copy of this
|
|
671
|
+
* @return {Color} */
|
|
672
|
+
copy(): Color;
|
|
673
|
+
/** Returns a copy of this color plus the color passed in
|
|
674
|
+
* @param {Color} color
|
|
675
|
+
* @return {Color} */
|
|
676
|
+
add(c: any): Color;
|
|
677
|
+
/** Returns a copy of this color minus the color passed in
|
|
678
|
+
* @param {Color} color
|
|
679
|
+
* @return {Color} */
|
|
680
|
+
subtract(c: any): Color;
|
|
681
|
+
/** Returns a copy of this color times the color passed in
|
|
682
|
+
* @param {Color} color
|
|
683
|
+
* @return {Color} */
|
|
684
|
+
multiply(c: any): Color;
|
|
685
|
+
/** Returns a copy of this color divided by the color passed in
|
|
686
|
+
* @param {Color} color
|
|
687
|
+
* @return {Color} */
|
|
688
|
+
divide(c: any): Color;
|
|
689
|
+
/** Returns a copy of this color scaled by the value passed in, alpha can be scaled separately
|
|
690
|
+
* @param {Number} scale
|
|
691
|
+
* @param {Number} [alphaScale=scale]
|
|
692
|
+
* @return {Color} */
|
|
693
|
+
scale(s: any, a?: any): Color;
|
|
694
|
+
/** Returns a copy of this color clamped to the valid range between 0 and 1
|
|
695
|
+
* @return {Color} */
|
|
696
|
+
clamp(): Color;
|
|
697
|
+
/** Returns a new color that is p percent between this and the color passed in
|
|
698
|
+
* @param {Color} color
|
|
699
|
+
* @param {Number} percent
|
|
700
|
+
* @return {Color} */
|
|
701
|
+
lerp(c: any, p: any): Color;
|
|
702
|
+
/** Sets this color given a hue, saturation, lightness, and alpha
|
|
703
|
+
* @param {Number} [hue=0]
|
|
704
|
+
* @param {Number} [saturation=0]
|
|
705
|
+
* @param {Number} [lightness=1]
|
|
706
|
+
* @param {Number} [alpha=1]
|
|
707
|
+
* @return {Color} */
|
|
708
|
+
setHSLA(h?: number, s?: number, l?: number, a?: number): Color;
|
|
709
|
+
/** Returns this color expressed in hsla format
|
|
710
|
+
* @return {Array} */
|
|
711
|
+
getHSLA(): any[];
|
|
712
|
+
/** Returns a new color that has each component randomly adjusted
|
|
713
|
+
* @param {Number} [amount=.05]
|
|
714
|
+
* @param {Number} [alphaAmount=0]
|
|
715
|
+
* @return {Color} */
|
|
716
|
+
mutate(amount?: number, alphaAmount?: number): Color;
|
|
717
|
+
/** Returns this color expressed as a hex color code
|
|
718
|
+
* @param {Boolean} [useAlpha=1] - if alpha should be included in result
|
|
719
|
+
* @return {String} */
|
|
720
|
+
toString(useAlpha?: boolean): string;
|
|
721
|
+
/** Set this color from a hex code
|
|
722
|
+
* @param {String} hex - html hex code
|
|
723
|
+
* @return {Color} */
|
|
724
|
+
setHex(hex: string): Color;
|
|
725
|
+
/** Returns this color expressed as 32 bit RGBA value
|
|
726
|
+
* @return {Number} */
|
|
727
|
+
rgbaInt(): number;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Timer object tracks how long has passed since it was set
|
|
731
|
+
* @example
|
|
732
|
+
* let a = new Timer; // creates a timer that is not set
|
|
733
|
+
* a.set(3); // sets the timer to 3 seconds
|
|
734
|
+
*
|
|
735
|
+
* let b = new Timer(1); // creates a timer with 1 second left
|
|
736
|
+
* b.unset(); // unsets the timer
|
|
737
|
+
*/
|
|
738
|
+
export class Timer {
|
|
739
|
+
/** Create a timer object set time passed in
|
|
740
|
+
* @param {Number} [timeLeft] - How much time left before the timer elapses in seconds */
|
|
741
|
+
constructor(timeLeft?: number);
|
|
742
|
+
time: number;
|
|
743
|
+
setTime: number;
|
|
744
|
+
/** Set the timer with seconds passed in
|
|
745
|
+
* @param {Number} [timeLeft=0] - How much time left before the timer is elapsed in seconds */
|
|
746
|
+
set(timeLeft?: number): void;
|
|
747
|
+
/** Unset the timer */
|
|
748
|
+
unset(): void;
|
|
749
|
+
/** Returns true if set
|
|
750
|
+
* @return {Boolean} */
|
|
751
|
+
isSet(): boolean;
|
|
752
|
+
/** Returns true if set and has not elapsed
|
|
753
|
+
* @return {Boolean} */
|
|
754
|
+
active(): boolean;
|
|
755
|
+
/** Returns true if set and elapsed
|
|
756
|
+
* @return {Boolean} */
|
|
757
|
+
elapsed(): boolean;
|
|
758
|
+
/** Get how long since elapsed, returns 0 if not set (returns negative if currently active)
|
|
759
|
+
* @return {Number} */
|
|
760
|
+
get(): number;
|
|
761
|
+
/** Get percentage elapsed based on time it was set to, returns 0 if not set
|
|
762
|
+
* @return {Number} */
|
|
763
|
+
getPercent(): number;
|
|
764
|
+
/** Returns this timer expressed as a string
|
|
765
|
+
* @return {String} */
|
|
766
|
+
toString(): string;
|
|
767
|
+
/** Get how long since elapsed, returns 0 if not set (returns negative if currently active)
|
|
768
|
+
* @return {Number} */
|
|
769
|
+
valueOf(): number;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Create a 2d vector, can take another Vector2 to copy, 2 scalars, or 1 scalar
|
|
773
|
+
* @param {Number} [x=0]
|
|
774
|
+
* @param {Number} [y=0]
|
|
775
|
+
* @return {Vector2}
|
|
776
|
+
* @example
|
|
777
|
+
* let a = vec2(0, 1); // vector with coordinates (0, 1)
|
|
778
|
+
* let b = vec2(a); // copy a into b
|
|
779
|
+
* a = vec2(5); // set a to (5, 5)
|
|
780
|
+
* b = vec2(); // set b to (0, 0)
|
|
781
|
+
* @memberof Utilities
|
|
782
|
+
*/
|
|
783
|
+
export function vec2(x?: number, y?: number): Vector2;
|
|
784
|
+
/**
|
|
785
|
+
* Create a color object with RGBA values
|
|
786
|
+
* @param {Number} [r=1]
|
|
787
|
+
* @param {Number} [g=1]
|
|
788
|
+
* @param {Number} [b=1]
|
|
789
|
+
* @param {Number} [a=1]
|
|
790
|
+
* @return {Color}
|
|
791
|
+
* @memberof Utilities
|
|
792
|
+
*/
|
|
793
|
+
export function colorRGBA(r?: number, g?: number, b?: number, a?: number): Color;
|
|
794
|
+
/**
|
|
795
|
+
* Create a color object with HSLA values
|
|
796
|
+
* @param {Number} [h=0]
|
|
797
|
+
* @param {Number} [s=0]
|
|
798
|
+
* @param {Number} [l=1]
|
|
799
|
+
* @param {Number} [a=1]
|
|
800
|
+
* @return {Color}
|
|
801
|
+
* @memberof Utilities
|
|
802
|
+
*/
|
|
803
|
+
export function colorHSLA(h?: number, s?: number, l?: number, a?: number): Color;
|
|
804
|
+
/**
|
|
805
|
+
* LittleJS Object Base Object Class
|
|
806
|
+
* <br> - Base object class used by the engine
|
|
807
|
+
* <br> - Automatically adds self to object list
|
|
808
|
+
* <br> - Will be updated and rendered each frame
|
|
809
|
+
* <br> - Renders as a sprite from a tilesheet by default
|
|
810
|
+
* <br> - Can have color and addtive color applied
|
|
811
|
+
* <br> - 2d Physics and collision system
|
|
812
|
+
* <br> - Sorted by renderOrder
|
|
813
|
+
* <br> - Objects can have children attached
|
|
814
|
+
* <br> - Parents are updated before children, and set child transform
|
|
815
|
+
* <br> - Call destroy() to get rid of objects
|
|
816
|
+
* <br>
|
|
817
|
+
* <br>The physics system used by objects is simple and fast with some caveats...
|
|
818
|
+
* <br> - Collision uses the axis aligned size, the object's rotation angle is only for rendering
|
|
819
|
+
* <br> - Objects are guaranteed to not intersect tile collision from physics
|
|
820
|
+
* <br> - If an object starts or is moved inside tile collision, it will not collide with that tile
|
|
821
|
+
* <br> - Collision for objects can be set to be solid to block other objects
|
|
822
|
+
* <br> - Objects may get pushed into overlapping other solid objects, if so they will push away
|
|
823
|
+
* <br> - Solid objects are more performance intensive and should be used sparingly
|
|
824
|
+
* @example
|
|
825
|
+
* // create an engine object, normally you would first extend the class with your own
|
|
826
|
+
* const pos = vec2(2,3);
|
|
827
|
+
* const object = new EngineObject(pos);
|
|
828
|
+
*/
|
|
829
|
+
export class EngineObject {
|
|
830
|
+
/** Create an engine object and adds it to the list of objects
|
|
831
|
+
* @param {Vector2} [position=Vector2()] - World space position of the object
|
|
832
|
+
* @param {Vector2} [size=Vector2(1,1)] - World space size of the object
|
|
833
|
+
* @param {Number} [tileIndex=-1] - Tile to use to render object (-1 is untextured)
|
|
834
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Size of tile in source pixels
|
|
835
|
+
* @param {Number} [angle=0] - Angle the object is rotated by
|
|
836
|
+
* @param {Color} [color=Color()] - Color to apply to tile when rendered
|
|
837
|
+
* @param {Number} [renderOrder=0] - Objects sorted by renderOrder before being rendered
|
|
838
|
+
*/
|
|
839
|
+
constructor(pos?: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, angle?: number, color?: Color, renderOrder?: number);
|
|
840
|
+
/** @property {Vector2} - World space position of the object */
|
|
841
|
+
pos: Vector2;
|
|
842
|
+
/** @property {Vector2} - World space width and height of the object */
|
|
843
|
+
size: Vector2;
|
|
844
|
+
/** @property {Number} - Tile to use to render object (-1 is untextured) */
|
|
845
|
+
tileIndex: number;
|
|
846
|
+
/** @property {Vector2} - Size of tile in source pixels */
|
|
847
|
+
tileSize: Vector2;
|
|
848
|
+
/** @property {Number} - Angle to rotate the object */
|
|
849
|
+
angle: number;
|
|
850
|
+
/** @property {Color} - Color to apply when rendered */
|
|
851
|
+
color: Color;
|
|
852
|
+
/** @property {Number} [mass=objectDefaultMass] - How heavy the object is, static if 0 */
|
|
853
|
+
mass: number;
|
|
854
|
+
/** @property {Number} [damping=objectDefaultDamping] - How much to slow down velocity each frame (0-1) */
|
|
855
|
+
damping: number;
|
|
856
|
+
/** @property {Number} [angleDamping=objectDefaultAngleDamping] - How much to slow down rotation each frame (0-1) */
|
|
857
|
+
angleDamping: number;
|
|
858
|
+
/** @property {Number} [elasticity=objectDefaultElasticity] - How bouncy the object is when colliding (0-1) */
|
|
859
|
+
elasticity: number;
|
|
860
|
+
/** @property {Number} [friction=objectDefaultFriction] - How much friction to apply when sliding (0-1) */
|
|
861
|
+
friction: number;
|
|
862
|
+
/** @property {Number} [gravityScale=1] - How much to scale gravity by for this object */
|
|
863
|
+
gravityScale: number;
|
|
864
|
+
/** @property {Number} [renderOrder=0] - Objects are sorted by render order */
|
|
865
|
+
renderOrder: number;
|
|
866
|
+
/** @property {Vector2} [velocity=Vector2()] - Velocity of the object */
|
|
867
|
+
velocity: Vector2;
|
|
868
|
+
/** @property {Number} [angleVelocity=0] - Angular velocity of the object */
|
|
869
|
+
angleVelocity: number;
|
|
870
|
+
spawnTime: number;
|
|
871
|
+
children: any[];
|
|
872
|
+
collideTiles: number;
|
|
873
|
+
/** Update the object transform and physics, called automatically by engine once each frame */
|
|
874
|
+
update(): void;
|
|
875
|
+
groundObject: any;
|
|
876
|
+
/** Render the object, draws a tile by default, automatically called each frame, sorted by renderOrder */
|
|
877
|
+
render(): void;
|
|
878
|
+
/** Destroy this object, destroy it's children, detach it's parent, and mark it for removal */
|
|
879
|
+
destroy(): void;
|
|
880
|
+
destroyed: number;
|
|
881
|
+
/** Called to check if a tile collision should be resolved
|
|
882
|
+
* @param {Number} tileData - the value of the tile at the position
|
|
883
|
+
* @param {Vector2} pos - tile where the collision occured
|
|
884
|
+
* @return {Boolean} - true if the collision should be resolved */
|
|
885
|
+
collideWithTile(tileData: number, pos: Vector2): boolean;
|
|
886
|
+
/** Called to check if a tile raycast hit
|
|
887
|
+
* @param {Number} tileData - the value of the tile at the position
|
|
888
|
+
* @param {Vector2} pos - tile where the raycast is
|
|
889
|
+
* @return {Boolean} - true if the raycast should hit */
|
|
890
|
+
collideWithTileRaycast(tileData: number, pos: Vector2): boolean;
|
|
891
|
+
/** Called to check if a object collision should be resolved
|
|
892
|
+
* @param {EngineObject} object - the object to test against
|
|
893
|
+
* @return {Boolean} - true if the collision should be resolved
|
|
894
|
+
*/
|
|
895
|
+
collideWithObject(o: any): boolean;
|
|
896
|
+
/** How long since the object was created
|
|
897
|
+
* @return {Number} */
|
|
898
|
+
getAliveTime(): number;
|
|
899
|
+
/** Apply acceleration to this object (adjust velocity, not affected by mass)
|
|
900
|
+
* @param {Vector2} acceleration */
|
|
901
|
+
applyAcceleration(a: any): void;
|
|
902
|
+
/** Apply force to this object (adjust velocity, affected by mass)
|
|
903
|
+
* @param {Vector2} force */
|
|
904
|
+
applyForce(force: Vector2): void;
|
|
905
|
+
/** Get the direction of the mirror
|
|
906
|
+
* @return {Number} -1 if this.mirror is true, or 1 if not mirrored */
|
|
907
|
+
getMirrorSign(): number;
|
|
908
|
+
/** Attaches a child to this with a given local transform
|
|
909
|
+
* @param {EngineObject} child
|
|
910
|
+
* @param {Vector2} [localPos=Vector2()]
|
|
911
|
+
* @param {Number} [localAngle=0] */
|
|
912
|
+
addChild(child: EngineObject, localPos?: Vector2, localAngle?: number): void;
|
|
913
|
+
/** Removes a child from this one
|
|
914
|
+
* @param {EngineObject} child */
|
|
915
|
+
removeChild(child: EngineObject): void;
|
|
916
|
+
/** Set how this object collides
|
|
917
|
+
* @param {Boolean} [collideSolidObjects=1] - Does it collide with solid objects
|
|
918
|
+
* @param {Boolean} [isSolid=1] - Does it collide with and block other objects (expensive in large numbers)
|
|
919
|
+
* @param {Boolean} [collideTiles=1] - Does it collide with the tile collision */
|
|
920
|
+
setCollision(collideSolidObjects?: boolean, isSolid?: boolean, collideTiles?: boolean): void;
|
|
921
|
+
collideSolidObjects: boolean;
|
|
922
|
+
isSolid: boolean;
|
|
923
|
+
/** Returns string containg info about this object for debugging
|
|
924
|
+
* @return {String} */
|
|
925
|
+
toString(): string;
|
|
926
|
+
}
|
|
927
|
+
/** Tile sheet for batch rendering system
|
|
928
|
+
* @type {CanvasImageSource}
|
|
929
|
+
* @memberof Draw */
|
|
930
|
+
export const tileImage: CanvasImageSource;
|
|
931
|
+
/** The primary 2D canvas visible to the user
|
|
932
|
+
* @type {HTMLCanvasElement}
|
|
933
|
+
* @memberof Draw */
|
|
934
|
+
export let mainCanvas: HTMLCanvasElement;
|
|
935
|
+
/** 2d context for mainCanvas
|
|
936
|
+
* @type {CanvasRenderingContext2D}
|
|
937
|
+
* @memberof Draw */
|
|
938
|
+
export let mainContext: CanvasRenderingContext2D;
|
|
939
|
+
/** A canvas that appears on top of everything the same size as mainCanvas
|
|
940
|
+
* @type {HTMLCanvasElement}
|
|
941
|
+
* @memberof Draw */
|
|
942
|
+
export let overlayCanvas: HTMLCanvasElement;
|
|
943
|
+
/** 2d context for overlayCanvas
|
|
944
|
+
* @type {CanvasRenderingContext2D}
|
|
945
|
+
* @memberof Draw */
|
|
946
|
+
export let overlayContext: CanvasRenderingContext2D;
|
|
947
|
+
/** The size of the main canvas (and other secondary canvases)
|
|
948
|
+
* @type {Vector2}
|
|
949
|
+
* @memberof Draw */
|
|
950
|
+
export let mainCanvasSize: Vector2;
|
|
951
|
+
/** Convert from screen to world space coordinates
|
|
952
|
+
* - if calling outside of render, you may need to manually set mainCanvasSize
|
|
953
|
+
* @param {Vector2} screenPos
|
|
954
|
+
* @return {Vector2}
|
|
955
|
+
* @memberof Draw */
|
|
956
|
+
export function screenToWorld(screenPos: Vector2): Vector2;
|
|
957
|
+
/** Convert from world to screen space coordinates
|
|
958
|
+
* - if calling outside of render, you may need to manually set mainCanvasSize
|
|
959
|
+
* @param {Vector2} worldPos
|
|
960
|
+
* @return {Vector2}
|
|
961
|
+
* @memberof Draw */
|
|
962
|
+
export function worldToScreen(worldPos: Vector2): Vector2;
|
|
963
|
+
/** Draw textured tile centered in world space, with color applied if using WebGL
|
|
964
|
+
* @param {Vector2} pos - Center of the tile in world space
|
|
965
|
+
* @param {Vector2} [size=Vector2(1,1)] - Size of the tile in world space
|
|
966
|
+
* @param {Number} [tileIndex=-1] - Tile index to use, negative is untextured
|
|
967
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Tile size in source pixels
|
|
968
|
+
* @param {Color} [color=Color()] - Color to modulate with
|
|
969
|
+
* @param {Number} [angle=0] - Angle to rotate by
|
|
970
|
+
* @param {Boolean} [mirror=0] - If true image is flipped along the Y axis
|
|
971
|
+
* @param {Color} [additiveColor=Color(0,0,0,0)] - Additive color to be applied
|
|
972
|
+
* @param {Boolean} [useWebGL=glEnable] - Use accelerated WebGL rendering
|
|
973
|
+
* @memberof Draw */
|
|
974
|
+
export function drawTile(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean): void;
|
|
975
|
+
/** Draw colored rect centered on pos
|
|
976
|
+
* @param {Vector2} pos
|
|
977
|
+
* @param {Vector2} [size=Vector2(1,1)]
|
|
978
|
+
* @param {Color} [color=Color()]
|
|
979
|
+
* @param {Number} [angle=0]
|
|
980
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
981
|
+
* @memberof Draw */
|
|
982
|
+
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean): void;
|
|
983
|
+
/** Draw textured tile centered on pos in screen space
|
|
984
|
+
* @param {Vector2} pos - Center of the tile
|
|
985
|
+
* @param {Vector2} [size=Vector2(1,1)] - Size of the tile
|
|
986
|
+
* @param {Number} [tileIndex=-1] - Tile index to use, negative is untextured
|
|
987
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Tile size in source pixels
|
|
988
|
+
* @param {Color} [color=Color()]
|
|
989
|
+
* @param {Number} [angle=0]
|
|
990
|
+
* @param {Boolean} [mirror=0]
|
|
991
|
+
* @param {Color} [additiveColor=Color(0,0,0,0)]
|
|
992
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
993
|
+
* @memberof Draw */
|
|
994
|
+
export function drawTileScreenSpace(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean): void;
|
|
995
|
+
/** Draw colored rectangle in screen space
|
|
996
|
+
* @param {Vector2} pos
|
|
997
|
+
* @param {Vector2} [size=Vector2(1,1)]
|
|
998
|
+
* @param {Color} [color=Color()]
|
|
999
|
+
* @param {Number} [angle=0]
|
|
1000
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
1001
|
+
* @memberof Draw */
|
|
1002
|
+
export function drawRectScreenSpace(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean): void;
|
|
1003
|
+
/** Draw colored line between two points
|
|
1004
|
+
* @param {Vector2} posA
|
|
1005
|
+
* @param {Vector2} posB
|
|
1006
|
+
* @param {Number} [thickness=.1]
|
|
1007
|
+
* @param {Color} [color=Color()]
|
|
1008
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
1009
|
+
* @memberof Draw */
|
|
1010
|
+
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean): void;
|
|
1011
|
+
/** Draw directly to a 2d canvas context in world space
|
|
1012
|
+
* @param {Vector2} pos
|
|
1013
|
+
* @param {Vector2} size
|
|
1014
|
+
* @param {Number} angle
|
|
1015
|
+
* @param {Boolean} mirror
|
|
1016
|
+
* @param {Function} drawFunction
|
|
1017
|
+
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1018
|
+
* @memberof Draw */
|
|
1019
|
+
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, context?: CanvasRenderingContext2D): void;
|
|
1020
|
+
/** Enable normal or additive blend mode
|
|
1021
|
+
* @param {Boolean} [additive=0]
|
|
1022
|
+
* @param {Boolean} [useWebGL=glEnable]
|
|
1023
|
+
* @memberof Draw */
|
|
1024
|
+
export function setBlendMode(additive?: boolean, useWebGL?: boolean): void;
|
|
1025
|
+
/** Draw text on overlay canvas in screen space
|
|
1026
|
+
* Automatically splits new lines into rows
|
|
1027
|
+
* @param {String} text
|
|
1028
|
+
* @param {Vector2} pos
|
|
1029
|
+
* @param {Number} [size=1]
|
|
1030
|
+
* @param {Color} [color=Color()]
|
|
1031
|
+
* @param {Number} [lineWidth=0]
|
|
1032
|
+
* @param {Color} [lineColor=Color(0,0,0)]
|
|
1033
|
+
* @param {String} [textAlign='center']
|
|
1034
|
+
* @memberof Draw */
|
|
1035
|
+
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: string, font?: string, context?: CanvasRenderingContext2D): void;
|
|
1036
|
+
/** Draw text on overlay canvas in world space
|
|
1037
|
+
* Automatically splits new lines into rows
|
|
1038
|
+
* @param {String} text
|
|
1039
|
+
* @param {Vector2} pos
|
|
1040
|
+
* @param {Number} [size=1]
|
|
1041
|
+
* @param {Color} [color=Color()]
|
|
1042
|
+
* @param {Number} [lineWidth=0]
|
|
1043
|
+
* @param {Color} [lineColor=Color(0,0,0)]
|
|
1044
|
+
* @param {String} [textAlign='center']
|
|
1045
|
+
* @memberof Draw */
|
|
1046
|
+
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: string, font: any): void;
|
|
1047
|
+
export let engineFontImage: any;
|
|
1048
|
+
/**
|
|
1049
|
+
* Font Image Object - Draw text on a 2D canvas by using characters in an image
|
|
1050
|
+
* <br> - 96 characters (from space to tilde) are stored in an image
|
|
1051
|
+
* <br> - Uses a default 8x8 font if none is supplied
|
|
1052
|
+
* <br> - You can also use fonts from the main tile sheet
|
|
1053
|
+
* @example
|
|
1054
|
+
* // use built in font
|
|
1055
|
+
* const font = new ImageFont;
|
|
1056
|
+
*
|
|
1057
|
+
* // draw text
|
|
1058
|
+
* font.drawTextScreen("LittleJS\nHello World!", vec2(200, 50));
|
|
1059
|
+
*/
|
|
1060
|
+
export class FontImage {
|
|
1061
|
+
/** Create an image font
|
|
1062
|
+
* @param {HTMLImageElement} [image] - Image for the font, if undefined default font is used
|
|
1063
|
+
* @param {Vector2} [tileSize=vec2(8)] - Size of the font source tiles
|
|
1064
|
+
* @param {Vector2} [paddingSize=vec2(0,1)] - How much extra space to add between characters
|
|
1065
|
+
* @param {Number} [startTileIndex=0] - Tile index in image where font starts
|
|
1066
|
+
* @param {CanvasRenderingContext2D} [context=overlayContext] - context to draw to
|
|
1067
|
+
*/
|
|
1068
|
+
constructor(image?: HTMLImageElement, tileSize?: Vector2, paddingSize?: Vector2, startTileIndex?: number, context?: CanvasRenderingContext2D);
|
|
1069
|
+
image: any;
|
|
1070
|
+
tileSize: Vector2;
|
|
1071
|
+
paddingSize: Vector2;
|
|
1072
|
+
startTileIndex: number;
|
|
1073
|
+
context: CanvasRenderingContext2D;
|
|
1074
|
+
/** Draw text in screen space using the image font
|
|
1075
|
+
* @param {String} text
|
|
1076
|
+
* @param {Vector2} pos
|
|
1077
|
+
* @param {Number} [scale=4]
|
|
1078
|
+
* @param {Boolean} [center]
|
|
1079
|
+
*/
|
|
1080
|
+
drawTextScreen(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1081
|
+
/** Draw text in world space using the image font
|
|
1082
|
+
* @param {String} text
|
|
1083
|
+
* @param {Vector2} pos
|
|
1084
|
+
* @param {Number} [scale=.25]
|
|
1085
|
+
* @param {Boolean} [center]
|
|
1086
|
+
*/
|
|
1087
|
+
drawText(text: string, pos: Vector2, scale?: number, center?: boolean): void;
|
|
1088
|
+
}
|
|
1089
|
+
/** Returns true if fullscreen mode is active
|
|
1090
|
+
* @return {Boolean}
|
|
1091
|
+
* @memberof Draw */
|
|
1092
|
+
export function isFullscreen(): boolean;
|
|
1093
|
+
/** Toggle fullsceen mode
|
|
1094
|
+
* @memberof Draw */
|
|
1095
|
+
export function toggleFullscreen(): void;
|
|
1096
|
+
/** Returns true if device key is down
|
|
1097
|
+
* @param {Number} key
|
|
1098
|
+
* @param {Number} [device=0]
|
|
1099
|
+
* @return {Boolean}
|
|
1100
|
+
* @memberof Input */
|
|
1101
|
+
export function keyIsDown(key: number, device?: number): boolean;
|
|
1102
|
+
/** Returns true if device key was pressed this frame
|
|
1103
|
+
* @param {Number} key
|
|
1104
|
+
* @param {Number} [device=0]
|
|
1105
|
+
* @return {Boolean}
|
|
1106
|
+
* @memberof Input */
|
|
1107
|
+
export function keyWasPressed(key: number, device?: number): boolean;
|
|
1108
|
+
/** Returns true if device key was released this frame
|
|
1109
|
+
* @param {Number} key
|
|
1110
|
+
* @param {Number} [device=0]
|
|
1111
|
+
* @return {Boolean}
|
|
1112
|
+
* @memberof Input */
|
|
1113
|
+
export function keyWasReleased(key: number, device?: number): boolean;
|
|
1114
|
+
/** Clears all input
|
|
1115
|
+
* @memberof Input */
|
|
1116
|
+
export function clearInput(): any[][];
|
|
1117
|
+
/** Returns true if device key is down
|
|
1118
|
+
* @param {Number} key
|
|
1119
|
+
* @param {Number} [device=0]
|
|
1120
|
+
* @return {Boolean}
|
|
1121
|
+
* @memberof Input */
|
|
1122
|
+
export function mouseIsDown(key: number, device?: number): boolean;
|
|
1123
|
+
/** Returns true if device key was pressed this frame
|
|
1124
|
+
* @param {Number} key
|
|
1125
|
+
* @param {Number} [device=0]
|
|
1126
|
+
* @return {Boolean}
|
|
1127
|
+
* @memberof Input */
|
|
1128
|
+
export function mouseWasPressed(key: number, device?: number): boolean;
|
|
1129
|
+
/** Returns true if device key was released this frame
|
|
1130
|
+
* @param {Number} key
|
|
1131
|
+
* @param {Number} [device=0]
|
|
1132
|
+
* @return {Boolean}
|
|
1133
|
+
* @memberof Input */
|
|
1134
|
+
export function mouseWasReleased(key: number, device?: number): boolean;
|
|
1135
|
+
/** Mouse pos in world space
|
|
1136
|
+
* @type {Vector2}
|
|
1137
|
+
* @memberof Input */
|
|
1138
|
+
export let mousePos: Vector2;
|
|
1139
|
+
/** Mouse pos in screen space
|
|
1140
|
+
* @type {Vector2}
|
|
1141
|
+
* @memberof Input */
|
|
1142
|
+
export let mousePosScreen: Vector2;
|
|
1143
|
+
/** Mouse wheel delta this frame
|
|
1144
|
+
* @type {Number}
|
|
1145
|
+
* @memberof Input */
|
|
1146
|
+
export let mouseWheel: number;
|
|
1147
|
+
/** Returns true if user is using gamepad (has more recently pressed a gamepad button)
|
|
1148
|
+
* @type {Boolean}
|
|
1149
|
+
* @memberof Input */
|
|
1150
|
+
export let isUsingGamepad: boolean;
|
|
1151
|
+
/** Prevents input continuing to the default browser handling (false by default)
|
|
1152
|
+
* @type {Boolean}
|
|
1153
|
+
* @memberof Input */
|
|
1154
|
+
export let preventDefaultInput: boolean;
|
|
1155
|
+
/** Returns true if gamepad button is down
|
|
1156
|
+
* @param {Number} button
|
|
1157
|
+
* @param {Number} [gamepad=0]
|
|
1158
|
+
* @return {Boolean}
|
|
1159
|
+
* @memberof Input */
|
|
1160
|
+
export function gamepadIsDown(button: number, gamepad?: number): boolean;
|
|
1161
|
+
/** Returns true if gamepad button was pressed
|
|
1162
|
+
* @param {Number} button
|
|
1163
|
+
* @param {Number} [gamepad=0]
|
|
1164
|
+
* @return {Boolean}
|
|
1165
|
+
* @memberof Input */
|
|
1166
|
+
export function gamepadWasPressed(button: number, gamepad?: number): boolean;
|
|
1167
|
+
/** Returns true if gamepad button was released
|
|
1168
|
+
* @param {Number} button
|
|
1169
|
+
* @param {Number} [gamepad=0]
|
|
1170
|
+
* @return {Boolean}
|
|
1171
|
+
* @memberof Input */
|
|
1172
|
+
export function gamepadWasReleased(button: number, gamepad?: number): boolean;
|
|
1173
|
+
/** Returns gamepad stick value
|
|
1174
|
+
* @param {Number} stick
|
|
1175
|
+
* @param {Number} [gamepad=0]
|
|
1176
|
+
* @return {Vector2}
|
|
1177
|
+
* @memberof Input */
|
|
1178
|
+
export function gamepadStick(stick: number, gamepad?: number): Vector2;
|
|
1179
|
+
export function mouseToScreen(mousePos: any): Vector2;
|
|
1180
|
+
export function gamepadsUpdate(): void;
|
|
1181
|
+
/** Pulse the vibration hardware if it exists
|
|
1182
|
+
* @param {Number} [pattern=100] - a single value in miliseconds or vibration interval array
|
|
1183
|
+
* @memberof Input */
|
|
1184
|
+
export function vibrate(pattern?: number): boolean;
|
|
1185
|
+
/** Cancel any ongoing vibration
|
|
1186
|
+
* @memberof Input */
|
|
1187
|
+
export function vibrateStop(): boolean;
|
|
1188
|
+
/** True if a touch device has been detected
|
|
1189
|
+
* @memberof Input */
|
|
1190
|
+
export const isTouchDevice: boolean;
|
|
1191
|
+
/**
|
|
1192
|
+
* Sound Object - Stores a zzfx sound for later use and can be played positionally
|
|
1193
|
+
* <br>
|
|
1194
|
+
* <br><b><a href=https://killedbyapixel.github.io/ZzFX/>Create sounds using the ZzFX Sound Designer.</a></b>
|
|
1195
|
+
* @example
|
|
1196
|
+
* // create a sound
|
|
1197
|
+
* const sound_example = new Sound([.5,.5]);
|
|
1198
|
+
*
|
|
1199
|
+
* // play the sound
|
|
1200
|
+
* sound_example.play();
|
|
1201
|
+
*/
|
|
1202
|
+
export class Sound {
|
|
1203
|
+
/** Create a sound object and cache the zzfx samples for later use
|
|
1204
|
+
* @param {Array} zzfxSound - Array of zzfx parameters, ex. [.5,.5]
|
|
1205
|
+
* @param {Number} [range=soundDefaultRange] - World space max range of sound, will not play if camera is farther away
|
|
1206
|
+
* @param {Number} [taper=soundDefaultTaper] - At what percentage of range should it start tapering off
|
|
1207
|
+
*/
|
|
1208
|
+
constructor(zzfxSound: any[], range?: number, taper?: number);
|
|
1209
|
+
/** @property {Number} - World space max range of sound, will not play if camera is farther away */
|
|
1210
|
+
range: number;
|
|
1211
|
+
/** @property {Number} - At what percentage of range should it start tapering off */
|
|
1212
|
+
taper: number;
|
|
1213
|
+
randomness: any;
|
|
1214
|
+
cachedSamples: number[];
|
|
1215
|
+
/** Play the sound
|
|
1216
|
+
* @param {Vector2} [pos] - World space position to play the sound, sound is not attenuated if null
|
|
1217
|
+
* @param {Number} [volume=1] - How much to scale volume by (in addition to range fade)
|
|
1218
|
+
* @param {Number} [pitch=1] - How much to scale pitch by (also adjusted by this.randomness)
|
|
1219
|
+
* @param {Number} [randomnessScale=1] - How much to scale randomness
|
|
1220
|
+
* @return {AudioBufferSourceNode} - The audio, can be used to stop sound later
|
|
1221
|
+
*/
|
|
1222
|
+
play(pos?: Vector2, volume?: number, pitch?: number, randomnessScale?: number): AudioBufferSourceNode;
|
|
1223
|
+
/** Play the sound as a note with a semitone offset
|
|
1224
|
+
* @param {Number} semitoneOffset - How many semitones to offset pitch
|
|
1225
|
+
* @param {Vector2} [pos] - World space position to play the sound, sound is not attenuated if null
|
|
1226
|
+
* @param {Number} [volume=1] - How much to scale volume by (in addition to range fade)
|
|
1227
|
+
* @return {AudioBufferSourceNode} - The audio, can be used to stop sound later
|
|
1228
|
+
*/
|
|
1229
|
+
playNote(semitoneOffset: number, pos?: Vector2, volume?: number): AudioBufferSourceNode;
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Music Object - Stores a zzfx music track for later use
|
|
1233
|
+
* <br>
|
|
1234
|
+
* <br><b><a href=https://keithclark.github.io/ZzFXM/>Create music with the ZzFXM tracker.</a></b>
|
|
1235
|
+
* @example
|
|
1236
|
+
* // create some music
|
|
1237
|
+
* const music_example = new Music(
|
|
1238
|
+
* [
|
|
1239
|
+
* [ // instruments
|
|
1240
|
+
* [,0,400] // simple note
|
|
1241
|
+
* ],
|
|
1242
|
+
* [ // patterns
|
|
1243
|
+
* [ // pattern 1
|
|
1244
|
+
* [ // channel 0
|
|
1245
|
+
* 0, -1, // instrument 0, left speaker
|
|
1246
|
+
* 1, 0, 9, 1 // channel notes
|
|
1247
|
+
* ],
|
|
1248
|
+
* [ // channel 1
|
|
1249
|
+
* 0, 1, // instrument 1, right speaker
|
|
1250
|
+
* 0, 12, 17, -1 // channel notes
|
|
1251
|
+
* ]
|
|
1252
|
+
* ],
|
|
1253
|
+
* ],
|
|
1254
|
+
* [0, 0, 0, 0], // sequence, play pattern 0 four times
|
|
1255
|
+
* 90 // BPM
|
|
1256
|
+
* ]);
|
|
1257
|
+
*
|
|
1258
|
+
* // play the music
|
|
1259
|
+
* music_example.play();
|
|
1260
|
+
*/
|
|
1261
|
+
export class Music {
|
|
1262
|
+
/** Create a music object and cache the zzfx music samples for later use
|
|
1263
|
+
* @param {Array} zzfxMusic - Array of zzfx music parameters
|
|
1264
|
+
*/
|
|
1265
|
+
constructor(zzfxMusic: any[]);
|
|
1266
|
+
cachedSamples: any[];
|
|
1267
|
+
/** Play the music
|
|
1268
|
+
* @param {Number} [volume=1] - How much to scale volume by
|
|
1269
|
+
* @param {Boolean} [loop=1] - True if the music should loop when it reaches the end
|
|
1270
|
+
* @return {AudioBufferSourceNode} - The audio node, can be used to stop sound later
|
|
1271
|
+
*/
|
|
1272
|
+
play(volume?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1273
|
+
source: number | AudioBufferSourceNode;
|
|
1274
|
+
/** Stop the music */
|
|
1275
|
+
stop(): void;
|
|
1276
|
+
/** Check if music is playing
|
|
1277
|
+
* @return {Boolean}
|
|
1278
|
+
*/
|
|
1279
|
+
isPlaying(): boolean;
|
|
1280
|
+
}
|
|
1281
|
+
/** Play an mp3 or wav audio from a local file or url
|
|
1282
|
+
* @param {String} url - Location of sound file to play
|
|
1283
|
+
* @param {Number} [volume=1] - How much to scale volume by
|
|
1284
|
+
* @param {Boolean} [loop=1] - True if the music should loop when it reaches the end
|
|
1285
|
+
* @return {HTMLAudioElement} - The audio element for this sound
|
|
1286
|
+
* @memberof Audio */
|
|
1287
|
+
export function playAudioFile(url: string, volume?: number, loop?: boolean): HTMLAudioElement;
|
|
1288
|
+
/** Speak text with passed in settings
|
|
1289
|
+
* @param {String} text - The text to speak
|
|
1290
|
+
* @param {String} [language] - The language/accent to use (examples: en, it, ru, ja, zh)
|
|
1291
|
+
* @param {Number} [volume=1] - How much to scale volume by
|
|
1292
|
+
* @param {Number} [rate=1] - How quickly to speak
|
|
1293
|
+
* @param {Number} [pitch=1] - How much to change the pitch by
|
|
1294
|
+
* @return {SpeechSynthesisUtterance} - The utterance that was spoken
|
|
1295
|
+
* @memberof Audio */
|
|
1296
|
+
export function speak(text: string, language?: string, volume?: number, rate?: number, pitch?: number): SpeechSynthesisUtterance;
|
|
1297
|
+
/** Stop all queued speech
|
|
1298
|
+
* @memberof Audio */
|
|
1299
|
+
export function speakStop(): void;
|
|
1300
|
+
/** Get frequency of a note on a musical scale
|
|
1301
|
+
* @param {Number} semitoneOffset - How many semitones away from the root note
|
|
1302
|
+
* @param {Number} [rootNoteFrequency=220] - Frequency at semitone offset 0
|
|
1303
|
+
* @return {Number} - The frequency of the note
|
|
1304
|
+
* @memberof Audio */
|
|
1305
|
+
export function getNoteFrequency(semitoneOffset: number, rootFrequency?: number): number;
|
|
1306
|
+
/** Audio context used by the engine
|
|
1307
|
+
* @memberof Audio */
|
|
1308
|
+
export let audioContext: any;
|
|
1309
|
+
/** Play cached audio samples with given settings
|
|
1310
|
+
* @param {Array} sampleChannels - Array of arrays of samples to play (for stereo playback)
|
|
1311
|
+
* @param {Number} [volume=1] - How much to scale volume by
|
|
1312
|
+
* @param {Number} [rate=1] - The playback rate to use
|
|
1313
|
+
* @param {Number} [pan=0] - How much to apply stereo panning
|
|
1314
|
+
* @param {Boolean} [loop=0] - True if the sound should loop when it reaches the end
|
|
1315
|
+
* @return {AudioBufferSourceNode} - The audio node of the sound played
|
|
1316
|
+
* @memberof Audio */
|
|
1317
|
+
export function playSamples(sampleChannels: any[], volume?: number, rate?: number, pan?: number, loop?: boolean): AudioBufferSourceNode;
|
|
1318
|
+
/** Generate and play a ZzFX sound
|
|
1319
|
+
* <br>
|
|
1320
|
+
* <br><b><a href=https://killedbyapixel.github.io/ZzFX/>Create sounds using the ZzFX Sound Designer.</a></b>
|
|
1321
|
+
* @param {Array} zzfxSound - Array of ZzFX parameters, ex. [.5,.5]
|
|
1322
|
+
* @return {Array} - Array of audio samples
|
|
1323
|
+
* @memberof Audio */
|
|
1324
|
+
export function zzfx(...zzfxSound: any[]): any[];
|
|
1325
|
+
/** The tile collision layer array, use setTileCollisionData and getTileCollisionData to access
|
|
1326
|
+
* @type {Array}
|
|
1327
|
+
* @memberof TileCollision */
|
|
1328
|
+
export let tileCollision: any[];
|
|
1329
|
+
/** Size of the tile collision layer
|
|
1330
|
+
* @type {Vector2}
|
|
1331
|
+
* @memberof TileCollision */
|
|
1332
|
+
export let tileCollisionSize: Vector2;
|
|
1333
|
+
/** Clear and initialize tile collision
|
|
1334
|
+
* @param {Vector2} size
|
|
1335
|
+
* @memberof TileCollision */
|
|
1336
|
+
export function initTileCollision(size: Vector2): void;
|
|
1337
|
+
/** Set tile collision data
|
|
1338
|
+
* @param {Vector2} pos
|
|
1339
|
+
* @param {Number} [data=0]
|
|
1340
|
+
* @memberof TileCollision */
|
|
1341
|
+
export function setTileCollisionData(pos: Vector2, data?: number): number;
|
|
1342
|
+
/** Get tile collision data
|
|
1343
|
+
* @param {Vector2} pos
|
|
1344
|
+
* @return {Number}
|
|
1345
|
+
* @memberof TileCollision */
|
|
1346
|
+
export function getTileCollisionData(pos: Vector2): number;
|
|
1347
|
+
/** Check if collision with another object should occur
|
|
1348
|
+
* @param {Vector2} pos
|
|
1349
|
+
* @param {Vector2} [size=Vector2(1,1)]
|
|
1350
|
+
* @param {EngineObject} [object]
|
|
1351
|
+
* @return {Boolean}
|
|
1352
|
+
* @memberof TileCollision */
|
|
1353
|
+
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
|
|
1354
|
+
/** Return the center of tile if any that is hit (this does not return the exact hit point)
|
|
1355
|
+
* @param {Vector2} posStart
|
|
1356
|
+
* @param {Vector2} posEnd
|
|
1357
|
+
* @param {EngineObject} [object]
|
|
1358
|
+
* @return {Vector2}
|
|
1359
|
+
* @memberof TileCollision */
|
|
1360
|
+
export function tileCollisionRaycast(posStart: Vector2, posEnd: Vector2, object?: EngineObject): Vector2;
|
|
1361
|
+
/**
|
|
1362
|
+
* Tile layer data object stores info about how to render a tile
|
|
1363
|
+
* @example
|
|
1364
|
+
* // create tile layer data with tile index 0 and random orientation and color
|
|
1365
|
+
* const tileIndex = 0;
|
|
1366
|
+
* const direction = randInt(4)
|
|
1367
|
+
* const mirror = randInt(2);
|
|
1368
|
+
* const color = randColor();
|
|
1369
|
+
* const data = new TileLayerData(tileIndex, direction, mirror, color);
|
|
1370
|
+
*/
|
|
1371
|
+
export class TileLayerData {
|
|
1372
|
+
/** Create a tile layer data object, one for each tile in a TileLayer
|
|
1373
|
+
* @param {Number} [tile] - The tile to use, untextured if undefined
|
|
1374
|
+
* @param {Number} [direction=0] - Integer direction of tile, in 90 degree increments
|
|
1375
|
+
* @param {Boolean} [mirror=0] - If the tile should be mirrored along the x axis
|
|
1376
|
+
* @param {Color} [color=Color()] - Color of the tile */
|
|
1377
|
+
constructor(tile?: number, direction?: number, mirror?: boolean, color?: Color);
|
|
1378
|
+
/** @property {Number} - The tile to use, untextured if undefined */
|
|
1379
|
+
tile: number;
|
|
1380
|
+
/** @property {Number} - Integer direction of tile, in 90 degree increments */
|
|
1381
|
+
direction: number;
|
|
1382
|
+
/** @property {Boolean} - If the tile should be mirrored along the x axis */
|
|
1383
|
+
mirror: boolean;
|
|
1384
|
+
/** @property {Color} - Color of the tile */
|
|
1385
|
+
color: Color;
|
|
1386
|
+
/** Set this tile to clear, it will not be rendered */
|
|
1387
|
+
clear(): void;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Tile layer object - cached rendering system for tile layers
|
|
1391
|
+
* <br> - Each Tile layer is rendered to an off screen canvas
|
|
1392
|
+
* <br> - To allow dynamic modifications, layers are rendered using canvas 2d
|
|
1393
|
+
* <br> - Some devices like mobile phones are limited to 4k texture resolution
|
|
1394
|
+
* <br> - So with 16x16 tiles this limits layers to 256x256 on mobile devices
|
|
1395
|
+
* @extends EngineObject
|
|
1396
|
+
* @example
|
|
1397
|
+
* // create tile collision and visible tile layer
|
|
1398
|
+
* initTileCollision(vec2(200,100));
|
|
1399
|
+
* const tileLayer = new TileLayer();
|
|
1400
|
+
*/
|
|
1401
|
+
export class TileLayer extends EngineObject {
|
|
1402
|
+
/** Create a tile layer object
|
|
1403
|
+
* @param {Vector2} [position=Vector2()] - World space position
|
|
1404
|
+
* @param {Vector2} [size=tileCollisionSize] - World space size
|
|
1405
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Size of tiles in source pixels
|
|
1406
|
+
* @param {Vector2} [scale=Vector2(1,1)] - How much to scale this layer when rendered
|
|
1407
|
+
* @param {Number} [renderOrder=0] - Objects sorted by renderOrder before being rendered
|
|
1408
|
+
*/
|
|
1409
|
+
constructor(pos: any, size?: Vector2, tileSize?: Vector2, scale?: Vector2, renderOrder?: number);
|
|
1410
|
+
/** @property {HTMLCanvasElement} - The canvas used by this tile layer */
|
|
1411
|
+
canvas: HTMLCanvasElement;
|
|
1412
|
+
/** @property {CanvasRenderingContext2D} - The 2D canvas context used by this tile layer */
|
|
1413
|
+
context: CanvasRenderingContext2D;
|
|
1414
|
+
/** @property {Vector2} - How much to scale this layer when rendered */
|
|
1415
|
+
scale: Vector2;
|
|
1416
|
+
data: TileLayerData[];
|
|
1417
|
+
/** Set data at a given position in the array
|
|
1418
|
+
* @param {Vector2} position - Local position in array
|
|
1419
|
+
* @param {TileLayerData} data - Data to set
|
|
1420
|
+
* @param {Boolean} [redraw=0] - Force the tile to redraw if true */
|
|
1421
|
+
setData(layerPos: any, data: TileLayerData, redraw?: boolean): void;
|
|
1422
|
+
/** Get data at a given position in the array
|
|
1423
|
+
* @param {Vector2} layerPos - Local position in array
|
|
1424
|
+
* @return {TileLayerData} */
|
|
1425
|
+
getData(layerPos: Vector2): TileLayerData;
|
|
1426
|
+
/** Draw all the tile data to an offscreen canvas
|
|
1427
|
+
* - This may be slow in some browsers
|
|
1428
|
+
*/
|
|
1429
|
+
redraw(): void;
|
|
1430
|
+
/** Call to start the redraw process
|
|
1431
|
+
* @param {Boolean} [clear=0] - Should it clear the canvas before drawing */
|
|
1432
|
+
redrawStart(clear?: boolean): void;
|
|
1433
|
+
savedRenderSettings: (number | HTMLCanvasElement | CanvasRenderingContext2D | Vector2)[];
|
|
1434
|
+
/** Call to end the redraw process */
|
|
1435
|
+
redrawEnd(): void;
|
|
1436
|
+
/** Draw the tile at a given position
|
|
1437
|
+
* @param {Vector2} layerPos */
|
|
1438
|
+
drawTileData(layerPos: Vector2): void;
|
|
1439
|
+
/** Draw all the tiles in this layer */
|
|
1440
|
+
drawAllTileData(): void;
|
|
1441
|
+
/** Draw directly to the 2D canvas in world space (bipass webgl)
|
|
1442
|
+
* @param {Vector2} pos
|
|
1443
|
+
* @param {Vector2} size
|
|
1444
|
+
* @param {Number} [angle=0]
|
|
1445
|
+
* @param {Boolean} [mirror=0]
|
|
1446
|
+
* @param {Function} drawFunction */
|
|
1447
|
+
drawCanvas2D(pos: Vector2, size: Vector2, angle?: number, mirror?: boolean, drawFunction: Function): void;
|
|
1448
|
+
/** Draw a tile directly onto the layer canvas
|
|
1449
|
+
* @param {Vector2} pos
|
|
1450
|
+
* @param {Vector2} [size=Vector2(1,1)]
|
|
1451
|
+
* @param {Number} [tileIndex=-1]
|
|
1452
|
+
* @param {Vector2} [tileSize=tileSizeDefault]
|
|
1453
|
+
* @param {Color} [color=Color()]
|
|
1454
|
+
* @param {Number} [angle=0]
|
|
1455
|
+
* @param {Boolean} [mirror=0] */
|
|
1456
|
+
drawTile(pos: Vector2, size?: Vector2, tileIndex?: number, tileSize?: Vector2, color?: Color, angle?: number, mirror?: boolean): void;
|
|
1457
|
+
/** Draw a rectangle directly onto the layer canvas
|
|
1458
|
+
* @param {Vector2} pos
|
|
1459
|
+
* @param {Vector2} [size=Vector2(1,1)]
|
|
1460
|
+
* @param {Color} [color=Color()]
|
|
1461
|
+
* @param {Number} [angle=0] */
|
|
1462
|
+
drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number): void;
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Particle Emitter - Spawns particles with the given settings
|
|
1466
|
+
* @extends EngineObject
|
|
1467
|
+
* @example
|
|
1468
|
+
* // create a particle emitter
|
|
1469
|
+
* let pos = vec2(2,3);
|
|
1470
|
+
* let particleEmiter = new ParticleEmitter
|
|
1471
|
+
* (
|
|
1472
|
+
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
|
|
1473
|
+
* 0, vec2(16), // tileIndex, tileSize
|
|
1474
|
+
* new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
|
|
1475
|
+
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
|
|
1476
|
+
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
|
|
1477
|
+
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
|
|
1478
|
+
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
|
|
1479
|
+
* );
|
|
1480
|
+
*/
|
|
1481
|
+
export class ParticleEmitter extends EngineObject {
|
|
1482
|
+
/** Create a particle system with the given settings
|
|
1483
|
+
* @param {Vector2} position - World space position of the emitter
|
|
1484
|
+
* @param {Number} [angle=0] - Angle to emit the particles
|
|
1485
|
+
* @param {Number} [emitSize=0] - World space size of the emitter (float for circle diameter, vec2 for rect)
|
|
1486
|
+
* @param {Number} [emitTime=0] - How long to stay alive (0 is forever)
|
|
1487
|
+
* @param {Number} [emitRate=100] - How many particles per second to spawn, does not emit if 0
|
|
1488
|
+
* @param {Number} [emitConeAngle=PI] - Local angle to apply velocity to particles from emitter
|
|
1489
|
+
* @param {Number} [tileIndex=-1] - Index into tile sheet, if <0 no texture is applied
|
|
1490
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Tile size for particles
|
|
1491
|
+
* @param {Color} [colorStartA=Color()] - Color at start of life 1, randomized between start colors
|
|
1492
|
+
* @param {Color} [colorStartB=Color()] - Color at start of life 2, randomized between start colors
|
|
1493
|
+
* @param {Color} [colorEndA=Color(1,1,1,0)] - Color at end of life 1, randomized between end colors
|
|
1494
|
+
* @param {Color} [colorEndB=Color(1,1,1,0)] - Color at end of life 2, randomized between end colors
|
|
1495
|
+
* @param {Number} [particleTime=.5] - How long particles live
|
|
1496
|
+
* @param {Number} [sizeStart=.1] - How big are particles at start
|
|
1497
|
+
* @param {Number} [sizeEnd=1] - How big are particles at end
|
|
1498
|
+
* @param {Number} [speed=.1] - How fast are particles when spawned
|
|
1499
|
+
* @param {Number} [angleSpeed=.05] - How fast are particles rotating
|
|
1500
|
+
* @param {Number} [damping=1] - How much to dampen particle speed
|
|
1501
|
+
* @param {Number} [angleDamping=1] - How much to dampen particle angular speed
|
|
1502
|
+
* @param {Number} [gravityScale=0] - How much does gravity effect particles
|
|
1503
|
+
* @param {Number} [particleConeAngle=PI] - Cone for start particle angle
|
|
1504
|
+
* @param {Number} [fadeRate=.1] - How quick to fade in particles at start/end in percent of life
|
|
1505
|
+
* @param {Number} [randomness=.2] - Apply extra randomness percent
|
|
1506
|
+
* @param {Boolean} [collideTiles=0] - Do particles collide against tiles
|
|
1507
|
+
* @param {Boolean} [additive=0] - Should particles use addtive blend
|
|
1508
|
+
* @param {Boolean} [randomColorLinear=1] - Should color be randomized linearly or across each component
|
|
1509
|
+
* @param {Number} [renderOrder=0] - Render order for particles (additive is above other stuff by default)
|
|
1510
|
+
* @param {Boolean} [localSpace=0] - Should it be in local space of emitter (world space is default)
|
|
1511
|
+
*/
|
|
1512
|
+
constructor(pos: any, angle?: number, emitSize?: number, emitTime?: number, emitRate?: number, emitConeAngle?: number, tileIndex?: number, tileSize?: Vector2, colorStartA?: Color, colorStartB?: Color, colorEndA?: Color, colorEndB?: Color, particleTime?: number, sizeStart?: number, sizeEnd?: number, speed?: number, angleSpeed?: number, damping?: number, angleDamping?: number, gravityScale?: number, particleConeAngle?: number, fadeRate?: number, randomness?: number, collideTiles?: boolean, additive?: boolean, randomColorLinear?: boolean, renderOrder?: number, localSpace?: boolean);
|
|
1513
|
+
/** @property {Number} - World space size of the emitter (float for circle diameter, vec2 for rect) */
|
|
1514
|
+
emitSize: number;
|
|
1515
|
+
/** @property {Number} - How long to stay alive (0 is forever) */
|
|
1516
|
+
emitTime: number;
|
|
1517
|
+
/** @property {Number} - How many particles per second to spawn, does not emit if 0 */
|
|
1518
|
+
emitRate: number;
|
|
1519
|
+
/** @property {Number} - Local angle to apply velocity to particles from emitter */
|
|
1520
|
+
emitConeAngle: number;
|
|
1521
|
+
/** @property {Color} - Color at start of life 1, randomized between start colors */
|
|
1522
|
+
colorStartA: Color;
|
|
1523
|
+
/** @property {Color} - Color at start of life 2, randomized between start colors */
|
|
1524
|
+
colorStartB: Color;
|
|
1525
|
+
/** @property {Color} - Color at end of life 1, randomized between end colors */
|
|
1526
|
+
colorEndA: Color;
|
|
1527
|
+
/** @property {Color} - Color at end of life 2, randomized between end colors */
|
|
1528
|
+
colorEndB: Color;
|
|
1529
|
+
/** @property {Boolean} - Should color be randomized linearly or across each component */
|
|
1530
|
+
randomColorLinear: boolean;
|
|
1531
|
+
/** @property {Number} - How long particles live */
|
|
1532
|
+
particleTime: number;
|
|
1533
|
+
/** @property {Number} - How big are particles at start */
|
|
1534
|
+
sizeStart: number;
|
|
1535
|
+
/** @property {Number} - How big are particles at end */
|
|
1536
|
+
sizeEnd: number;
|
|
1537
|
+
/** @property {Number} - How fast are particles when spawned */
|
|
1538
|
+
speed: number;
|
|
1539
|
+
/** @property {Number} - How fast are particles rotating */
|
|
1540
|
+
angleSpeed: number;
|
|
1541
|
+
/** @property {Number} - Cone for start particle angle */
|
|
1542
|
+
particleConeAngle: number;
|
|
1543
|
+
/** @property {Number} - How quick to fade in particles at start/end in percent of life */
|
|
1544
|
+
fadeRate: number;
|
|
1545
|
+
/** @property {Number} - Apply extra randomness percent */
|
|
1546
|
+
randomness: number;
|
|
1547
|
+
/** @property {Number} - Do particles collide against tiles */
|
|
1548
|
+
collideTiles: boolean;
|
|
1549
|
+
/** @property {Number} - Should particles use addtive blend */
|
|
1550
|
+
additive: boolean;
|
|
1551
|
+
/** @property {Boolean} - Should it be in local space of emitter */
|
|
1552
|
+
localSpace: boolean;
|
|
1553
|
+
/** @property {Number} - If set the partile is drawn as a trail, stretched in the drection of velocity */
|
|
1554
|
+
trailScale: number;
|
|
1555
|
+
emitTimeBuffer: number;
|
|
1556
|
+
/** Spawn one particle
|
|
1557
|
+
* @return {Particle} */
|
|
1558
|
+
emitParticle(): Particle;
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Particle Object - Created automatically by Particle Emitters
|
|
1562
|
+
* @extends EngineObject
|
|
1563
|
+
*/
|
|
1564
|
+
export class Particle extends EngineObject {
|
|
1565
|
+
/**
|
|
1566
|
+
* Create a particle with the given settings
|
|
1567
|
+
* @param {Vector2} position - World space position of the particle
|
|
1568
|
+
* @param {Number} [tileIndex=-1] - Tile to use to render, untextured if -1
|
|
1569
|
+
* @param {Vector2} [tileSize=tileSizeDefault] - Size of tile in source pixels
|
|
1570
|
+
* @param {Number} [angle=0] - Angle to rotate the particle
|
|
1571
|
+
*/
|
|
1572
|
+
constructor(pos: any, tileIndex?: number, tileSize?: Vector2, angle?: number);
|
|
1573
|
+
}
|
|
1574
|
+
/** List of all medals
|
|
1575
|
+
* @type {Array}
|
|
1576
|
+
* @memberof Medals */
|
|
1577
|
+
export const medals: any[];
|
|
1578
|
+
/** Set to stop medals from being unlockable (like if cheats are enabled)
|
|
1579
|
+
* @type {Boolean}
|
|
1580
|
+
* @default 0
|
|
1581
|
+
* @memberof Settings */
|
|
1582
|
+
export let medalsPreventUnlock: boolean;
|
|
1583
|
+
/** Initialize medals with a save name used for storage
|
|
1584
|
+
* <br> - Call this after creating all medals
|
|
1585
|
+
* <br> - Checks if medals are unlocked
|
|
1586
|
+
* @param {String} saveName
|
|
1587
|
+
* @memberof Medals */
|
|
1588
|
+
export function medalsInit(saveName: string): void;
|
|
1589
|
+
/** This can used to enable Newgrounds functionality
|
|
1590
|
+
* @param {Number} app_id - The newgrounds App ID
|
|
1591
|
+
* @param {String} [cipher] - The encryption Key (AES-128/Base64)
|
|
1592
|
+
* @memberof Medals */
|
|
1593
|
+
export function newgroundsInit(app_id: number, cipher?: string): void;
|
|
1594
|
+
/**
|
|
1595
|
+
* Medal Object - Tracks an unlockable medal
|
|
1596
|
+
* @example
|
|
1597
|
+
* // create a medal
|
|
1598
|
+
* const medal_example = new Medal(0, 'Example Medal', 'More info about the medal goes here.', '🎖️');
|
|
1599
|
+
*
|
|
1600
|
+
* // initialize medals
|
|
1601
|
+
* medalsInit('Example Game');
|
|
1602
|
+
*
|
|
1603
|
+
* // unlock the medal
|
|
1604
|
+
* medal_example.unlock();
|
|
1605
|
+
*/
|
|
1606
|
+
export class Medal {
|
|
1607
|
+
/** Create an medal object and adds it to the list of medals
|
|
1608
|
+
* @param {Number} id - The unique identifier of the medal
|
|
1609
|
+
* @param {String} name - Name of the medal
|
|
1610
|
+
* @param {String} [description] - Description of the medal
|
|
1611
|
+
* @param {String} [icon='🏆'] - Icon for the medal
|
|
1612
|
+
* @param {String} [src] - Image location for the medal
|
|
1613
|
+
*/
|
|
1614
|
+
constructor(id: number, name: string, description?: string, icon?: string, src?: string);
|
|
1615
|
+
id: number;
|
|
1616
|
+
name: string;
|
|
1617
|
+
description: string;
|
|
1618
|
+
icon: string;
|
|
1619
|
+
image: HTMLImageElement;
|
|
1620
|
+
/** Unlocks a medal if not already unlocked */
|
|
1621
|
+
unlock(): void;
|
|
1622
|
+
unlocked: number;
|
|
1623
|
+
/** Render a medal
|
|
1624
|
+
* @param {Number} [hidePercent=0] - How much to slide the medal off screen
|
|
1625
|
+
*/
|
|
1626
|
+
render(hidePercent?: number): void;
|
|
1627
|
+
/** Render the icon for a medal
|
|
1628
|
+
* @param {Number} x - Screen space X position
|
|
1629
|
+
* @param {Number} y - Screen space Y position
|
|
1630
|
+
* @param {Number} [size=medalDisplayIconSize] - Screen space size
|
|
1631
|
+
*/
|
|
1632
|
+
renderIcon(pos: any, size?: number): void;
|
|
1633
|
+
storageKey(): string;
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Newgrounds API wrapper object
|
|
1637
|
+
* @example
|
|
1638
|
+
* // create a newgrounds object, replace the app id and cipher with your own
|
|
1639
|
+
* const app_id = '53123:1ZuSTQ9l';
|
|
1640
|
+
* const cipher = 'enF0vGH@Mj/FRASKL23Q==';
|
|
1641
|
+
* newgrounds = new Newgrounds(app_id, cipher);
|
|
1642
|
+
*/
|
|
1643
|
+
export class Newgrounds {
|
|
1644
|
+
/** Create a newgrounds object
|
|
1645
|
+
* @param {Number} app_id - The newgrounds App ID
|
|
1646
|
+
* @param {String} [cipher] - The encryption Key (AES-128/Base64) */
|
|
1647
|
+
constructor(app_id: number, cipher?: string);
|
|
1648
|
+
app_id: number;
|
|
1649
|
+
cipher: string;
|
|
1650
|
+
host: string;
|
|
1651
|
+
cryptoJS: any;
|
|
1652
|
+
session_id: string;
|
|
1653
|
+
medals: any;
|
|
1654
|
+
scoreboards: any;
|
|
1655
|
+
/** Send message to unlock a medal by id
|
|
1656
|
+
* @param {Number} id - The medal id */
|
|
1657
|
+
unlockMedal(id: number): any;
|
|
1658
|
+
/** Send message to post score
|
|
1659
|
+
* @param {Number} id - The scoreboard id
|
|
1660
|
+
* @param {Number} value - The score value */
|
|
1661
|
+
postScore(id: number, value: number): any;
|
|
1662
|
+
/** Get scores from a scoreboard
|
|
1663
|
+
* @param {Number} id - The scoreboard id
|
|
1664
|
+
* @param {String} [user=0] - A user's id or name
|
|
1665
|
+
* @param {Number} [social=0] - If true, only social scores will be loaded
|
|
1666
|
+
* @param {Number} [skip=0] - Number of scores to skip before start
|
|
1667
|
+
* @param {Number} [limit=10] - Number of scores to include in the list
|
|
1668
|
+
* @return {Object} - The response JSON object
|
|
1669
|
+
*/
|
|
1670
|
+
getScores(id: number, user?: string, social?: number, skip?: number, limit?: number): any;
|
|
1671
|
+
/** Send message to log a view */
|
|
1672
|
+
logView(): any;
|
|
1673
|
+
/** Send a message to call a component of the Newgrounds API
|
|
1674
|
+
* @param {String} component - Name of the component
|
|
1675
|
+
* @param {Object} [parameters=0] - Parameters to use for call
|
|
1676
|
+
* @param {Boolean} [async=0] - If true, don't wait for response before continuing (avoid stall)
|
|
1677
|
+
* @return {Object} - The response JSON object
|
|
1678
|
+
*/
|
|
1679
|
+
call(component: string, parameters?: any, async?: boolean): any;
|
|
1680
|
+
CryptoJS(): any;
|
|
1681
|
+
}
|
|
1682
|
+
/** The WebGL canvas which appears above the main canvas and below the overlay canvas
|
|
1683
|
+
* @type {HTMLCanvasElement}
|
|
1684
|
+
* @memberof WebGL */
|
|
1685
|
+
export let glCanvas: HTMLCanvasElement;
|
|
1686
|
+
/** 2d context for glCanvas
|
|
1687
|
+
* @type {WebGLRenderingContext}
|
|
1688
|
+
* @memberof WebGL */
|
|
1689
|
+
export let glContext: WebGLRenderingContext;
|
|
1690
|
+
/** Set the WebGl blend mode, normally you should call setBlendMode instead
|
|
1691
|
+
* @param {Boolean} [additive=0]
|
|
1692
|
+
* @memberof WebGL */
|
|
1693
|
+
export function glSetBlendMode(additive?: boolean): void;
|
|
1694
|
+
/** Set the WebGl texture, not normally necessary unless multiple tile sheets are used
|
|
1695
|
+
* <br> - This may also flush the gl buffer resulting in more draw calls and worse performance
|
|
1696
|
+
* @param {WebGLTexture} [texture=glTileTexture]
|
|
1697
|
+
* @memberof WebGL */
|
|
1698
|
+
export function glSetTexture(texture?: WebGLTexture): void;
|
|
1699
|
+
/** Compile WebGL shader of the given type, will throw errors if in debug mode
|
|
1700
|
+
* @param {String} source
|
|
1701
|
+
* @param type
|
|
1702
|
+
* @return {WebGLShader}
|
|
1703
|
+
* @memberof WebGL */
|
|
1704
|
+
export function glCompileShader(source: string, type: any): WebGLShader;
|
|
1705
|
+
/** Create WebGL program with given shaders
|
|
1706
|
+
* @param {WebGLShader} vsSource
|
|
1707
|
+
* @param {WebGLShader} fsSource
|
|
1708
|
+
* @return {WebGLProgram}
|
|
1709
|
+
* @memberof WebGL */
|
|
1710
|
+
export function glCreateProgram(vsSource: WebGLShader, fsSource: WebGLShader): WebGLProgram;
|
|
1711
|
+
/** Create WebGL texture from an image and set the texture settings
|
|
1712
|
+
* @param {Image} image
|
|
1713
|
+
* @return {WebGLTexture}
|
|
1714
|
+
* @memberof WebGL */
|
|
1715
|
+
export function glCreateTexture(image: new (width?: number, height?: number) => HTMLImageElement): WebGLTexture;
|
|
1716
|
+
/** Set up a post processing shader
|
|
1717
|
+
* @param {String} shaderCode
|
|
1718
|
+
* @param {Boolean} includeOverlay
|
|
1719
|
+
* @memberof WebGL */
|
|
1720
|
+
export function glInitPostProcess(shaderCode: string, includeOverlay: boolean): void;
|
|
1721
|
+
/** Name of engine
|
|
1722
|
+
* @type {String}
|
|
1723
|
+
* @default
|
|
1724
|
+
* @memberof Engine */
|
|
1725
|
+
export const engineName: string;
|
|
1726
|
+
/** Version of engine
|
|
1727
|
+
* @type {String}
|
|
1728
|
+
* @default
|
|
1729
|
+
* @memberof Engine */
|
|
1730
|
+
export const engineVersion: string;
|
|
1731
|
+
/** Frames per second to update objects
|
|
1732
|
+
* @type {Number}
|
|
1733
|
+
* @default
|
|
1734
|
+
* @memberof Engine */
|
|
1735
|
+
export const frameRate: number;
|
|
1736
|
+
/** How many seconds each frame lasts, engine uses a fixed time step
|
|
1737
|
+
* @type {Number}
|
|
1738
|
+
* @default 1/60
|
|
1739
|
+
* @memberof Engine */
|
|
1740
|
+
export const timeDelta: number;
|
|
1741
|
+
/** Array containing all engine objects
|
|
1742
|
+
* @type {Array}
|
|
1743
|
+
* @memberof Engine */
|
|
1744
|
+
export let engineObjects: any[];
|
|
1745
|
+
/** Current update frame, used to calculate time
|
|
1746
|
+
* @type {Number}
|
|
1747
|
+
* @memberof Engine */
|
|
1748
|
+
export let frame: number;
|
|
1749
|
+
/** Current engine time since start in seconds, derived from frame
|
|
1750
|
+
* @type {Number}
|
|
1751
|
+
* @memberof Engine */
|
|
1752
|
+
export let time: number;
|
|
1753
|
+
/** Actual clock time since start in seconds (not affected by pause or frame rate clamping)
|
|
1754
|
+
* @type {Number}
|
|
1755
|
+
* @memberof Engine */
|
|
1756
|
+
export let timeReal: number;
|
|
1757
|
+
/** Is the game paused? Causes time and objects to not be updated
|
|
1758
|
+
* @type {Boolean}
|
|
1759
|
+
* @default 0
|
|
1760
|
+
* @memberof Engine */
|
|
1761
|
+
export let paused: boolean;
|
|
1762
|
+
/** Set if game is paused
|
|
1763
|
+
* @param {Boolean} paused
|
|
1764
|
+
* @memberof Engine */
|
|
1765
|
+
export function setPaused(_paused: any): void;
|
|
1766
|
+
/** Start up LittleJS engine with your callback functions
|
|
1767
|
+
* @param {Function} gameInit - Called once after the engine starts up, setup the game
|
|
1768
|
+
* @param {Function} gameUpdate - Called every frame at 60 frames per second, handle input and update the game state
|
|
1769
|
+
* @param {Function} gameUpdatePost - Called after physics and objects are updated, setup camera and prepare for render
|
|
1770
|
+
* @param {Function} gameRender - Called before objects are rendered, draw any background effects that appear behind objects
|
|
1771
|
+
* @param {Function} gameRenderPost - Called after objects are rendered, draw effects or hud that appear above all objects
|
|
1772
|
+
* @param {String} [tileImageSource] - Tile image to use, everything starts when the image is finished loading
|
|
1773
|
+
* @memberof Engine */
|
|
1774
|
+
export function engineInit(gameInit: Function, gameUpdate: Function, gameUpdatePost: Function, gameRender: Function, gameRenderPost: Function, tileImageSource?: string): void;
|
|
1775
|
+
/** Update each engine object, remove destroyed objects, and update time
|
|
1776
|
+
* @memberof Engine */
|
|
1777
|
+
export function engineObjectsUpdate(): void;
|
|
1778
|
+
/** Destroy and remove all objects
|
|
1779
|
+
* @memberof Engine */
|
|
1780
|
+
export function engineObjectsDestroy(): void;
|
|
1781
|
+
/** Triggers a callback for each object within a given area
|
|
1782
|
+
* @param {Vector2} [pos] - Center of test area
|
|
1783
|
+
* @param {Number} [size] - Radius of circle if float, rectangle size if Vector2
|
|
1784
|
+
* @param {Function} [callbackFunction] - Calls this function on every object that passes the test
|
|
1785
|
+
* @param {Array} [objects=engineObjects] - List of objects to check
|
|
1786
|
+
* @memberof Engine */
|
|
1787
|
+
export function engineObjectsCallback(pos?: Vector2, size?: number, callbackFunction?: Function, objects?: any[]): void;
|
|
1788
|
+
}
|