litecanvas 0.79.2 → 0.79.4
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/dist/dist.dev.js +2 -2
- package/package.json +3 -3
- package/src/index.js +2 -2
- package/types/index.d.ts +6 -38
- package/types/types.d.ts +8 -40
package/dist/dist.dev.js
CHANGED
|
@@ -555,7 +555,7 @@
|
|
|
555
555
|
textalign(align, baseline) {
|
|
556
556
|
DEV: assert(
|
|
557
557
|
null == align || ["left", "right", "center", "start", "end"].includes(align),
|
|
558
|
-
"textalign: 1st param must be
|
|
558
|
+
"textalign: 1st param must be null or one of the following values: center, left, right, start or end."
|
|
559
559
|
);
|
|
560
560
|
DEV: assert(
|
|
561
561
|
null == baseline || [
|
|
@@ -566,7 +566,7 @@
|
|
|
566
566
|
"alphabetic",
|
|
567
567
|
"ideographic"
|
|
568
568
|
].includes(baseline),
|
|
569
|
-
"textalign: 2nd param must be
|
|
569
|
+
"textalign: 2nd param must be null or one of the following values: middle, top, bottom, hanging, alphabetic or ideographic."
|
|
570
570
|
);
|
|
571
571
|
if (align) _ctx.textAlign = align;
|
|
572
572
|
if (baseline) _ctx.textBaseline = baseline;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litecanvas",
|
|
3
|
-
"version": "0.79.
|
|
4
|
-
"description": "Lightweight HTML5 canvas game engine suitable for small projects and creative coding. Inspired by PICO-8 and P5/Processing.",
|
|
3
|
+
"version": "0.79.4",
|
|
4
|
+
"description": "Lightweight HTML5 canvas 2D game engine suitable for small projects and creative coding. Inspired by PICO-8 and P5/Processing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Luiz Bills <luizbills@pm.me>",
|
|
7
7
|
"contributors": [],
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@swc/core": "^1.11.13",
|
|
10
10
|
"ava": "^6.2.0",
|
|
11
|
-
"esbuild": "^0.25.
|
|
11
|
+
"esbuild": "^0.25.2",
|
|
12
12
|
"gzip-size": "^7.0.0",
|
|
13
13
|
"prettier": "^3.5.3"
|
|
14
14
|
},
|
package/src/index.js
CHANGED
|
@@ -657,7 +657,7 @@ export default function litecanvas(settings = {}) {
|
|
|
657
657
|
DEV: assert(
|
|
658
658
|
null == align ||
|
|
659
659
|
['left', 'right', 'center', 'start', 'end'].includes(align),
|
|
660
|
-
'textalign: 1st param must be
|
|
660
|
+
'textalign: 1st param must be null or one of the following values: center, left, right, start or end.'
|
|
661
661
|
)
|
|
662
662
|
DEV: assert(
|
|
663
663
|
null == baseline ||
|
|
@@ -669,7 +669,7 @@ export default function litecanvas(settings = {}) {
|
|
|
669
669
|
'alphabetic',
|
|
670
670
|
'ideographic',
|
|
671
671
|
].includes(baseline),
|
|
672
|
-
'textalign: 2nd param must be
|
|
672
|
+
'textalign: 2nd param must be null or one of the following values: middle, top, bottom, hanging, alphabetic or ideographic.'
|
|
673
673
|
)
|
|
674
674
|
|
|
675
675
|
if (align) _ctx.textAlign = align
|
package/types/index.d.ts
CHANGED
|
@@ -496,52 +496,20 @@ declare global {
|
|
|
496
496
|
/** UTILS API */
|
|
497
497
|
/**
|
|
498
498
|
* Checks if a which key is pressed on the keyboard.
|
|
499
|
-
* Note: use `iskeydown(
|
|
499
|
+
* Note: use `iskeydown()` to check for any key pressed.
|
|
500
500
|
*
|
|
501
501
|
* @param key
|
|
502
502
|
* @returns `true` if the which key is down
|
|
503
503
|
*/
|
|
504
504
|
function iskeydown(key: string): boolean
|
|
505
505
|
/**
|
|
506
|
-
*
|
|
506
|
+
* Checks if a which key just got pressed on the keyboard.
|
|
507
|
+
* Note: use `iskeypressed()` to check for any key.
|
|
507
508
|
*
|
|
508
|
-
* @param
|
|
509
|
-
* @
|
|
510
|
-
* @param w1 first rectangle width
|
|
511
|
-
* @param h1 first rectangle height
|
|
512
|
-
* @param x2 second rectangle position X
|
|
513
|
-
* @param y2 second rectangle position Y
|
|
514
|
-
* @param w2 second rectangle width
|
|
515
|
-
* @param h2 second rectangle height
|
|
509
|
+
* @param [key]
|
|
510
|
+
* @returns `true` if the which key was pressed
|
|
516
511
|
*/
|
|
517
|
-
function
|
|
518
|
-
x1: number,
|
|
519
|
-
y1: number,
|
|
520
|
-
w1: number,
|
|
521
|
-
h1: number,
|
|
522
|
-
x2: number,
|
|
523
|
-
y2: number,
|
|
524
|
-
w2: number,
|
|
525
|
-
h2: number
|
|
526
|
-
): boolean
|
|
527
|
-
/**
|
|
528
|
-
* Check a collision between two circles
|
|
529
|
-
*
|
|
530
|
-
* @param x1 first circle position X
|
|
531
|
-
* @param y1 first circle position Y
|
|
532
|
-
* @param r1 first circle position radius
|
|
533
|
-
* @param x2 second circle position X
|
|
534
|
-
* @param y2 second circle position Y
|
|
535
|
-
* @param r2 second circle position radius
|
|
536
|
-
*/
|
|
537
|
-
function colcirc(
|
|
538
|
-
x1: number,
|
|
539
|
-
y1: number,
|
|
540
|
-
r1: number,
|
|
541
|
-
x2: number,
|
|
542
|
-
y2: number,
|
|
543
|
-
r2: number
|
|
544
|
-
): boolean
|
|
512
|
+
function iskeypressed(key: string): boolean
|
|
545
513
|
|
|
546
514
|
/** PLUGINS API */
|
|
547
515
|
/**
|
package/types/types.d.ts
CHANGED
|
@@ -474,52 +474,20 @@ type LitecanvasInstance = {
|
|
|
474
474
|
/** UTILS API */
|
|
475
475
|
/**
|
|
476
476
|
* Checks if a which key is pressed on the keyboard.
|
|
477
|
-
* Note: use `iskeydown(
|
|
477
|
+
* Note: use `iskeydown()` to check for any key pressed.
|
|
478
478
|
*
|
|
479
479
|
* @param key
|
|
480
480
|
* @returns `true` if the which key is down
|
|
481
481
|
*/
|
|
482
482
|
iskeydown(key: string): boolean
|
|
483
483
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* @param
|
|
488
|
-
* @
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
* @param y2 second rectangle position Y
|
|
492
|
-
* @param w2 second rectangle width
|
|
493
|
-
* @param h2 second rectangle height
|
|
494
|
-
*/
|
|
495
|
-
colrect(
|
|
496
|
-
x1: number,
|
|
497
|
-
y1: number,
|
|
498
|
-
w1: number,
|
|
499
|
-
h1: number,
|
|
500
|
-
x2: number,
|
|
501
|
-
y2: number,
|
|
502
|
-
w2: number,
|
|
503
|
-
h2: number
|
|
504
|
-
): boolean
|
|
505
|
-
/**
|
|
506
|
-
* Check a collision between two circles
|
|
507
|
-
*
|
|
508
|
-
* @param x1 first circle position X
|
|
509
|
-
* @param y1 first circle position Y
|
|
510
|
-
* @param r1 first circle position radius
|
|
511
|
-
* @param x2 second circle position X
|
|
512
|
-
* @param y2 second circle position Y
|
|
513
|
-
* @param r2 second circle position radius
|
|
514
|
-
*/
|
|
515
|
-
colcirc(
|
|
516
|
-
x1: number,
|
|
517
|
-
y1: number,
|
|
518
|
-
r1: number,
|
|
519
|
-
x2: number,
|
|
520
|
-
y2: number,
|
|
521
|
-
r2: number
|
|
522
|
-
): boolean
|
|
484
|
+
* Checks if a which key just got pressed on the keyboard.
|
|
485
|
+
* Note: use `iskeypressed()` to check for any key.
|
|
486
|
+
*
|
|
487
|
+
* @param [key]
|
|
488
|
+
* @returns `true` if the which key was pressed
|
|
489
|
+
*/
|
|
490
|
+
iskeypressed(key: string): boolean
|
|
523
491
|
|
|
524
492
|
/** PLUGINS API */
|
|
525
493
|
/**
|