q5play 4.0.4 → 4.0.6
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/package.json +1 -1
- package/q5play.d.ts +5 -1
- package/q5play.js +16 -12
package/package.json
CHANGED
package/q5play.d.ts
CHANGED
|
@@ -2902,7 +2902,11 @@ declare global {
|
|
|
2902
2902
|
function EmojiImage(emoji: string, textSize: number): Q5.Image;
|
|
2903
2903
|
function spriteArt(txt: string, scale: number, palette: number | any): Q5.Image;
|
|
2904
2904
|
function animation(ani: Ani, x: number, y: number, r: number, sX: number, sY: number): void;
|
|
2905
|
-
|
|
2905
|
+
/**
|
|
2906
|
+
* @param milliseconds if not specified, delays until the next frame draw
|
|
2907
|
+
* @returns resolves after the delay
|
|
2908
|
+
*/
|
|
2909
|
+
function delay(milliseconds?: number): Promise<void>;
|
|
2906
2910
|
|
|
2907
2911
|
let allSprites: Group;
|
|
2908
2912
|
let world: World;
|
package/q5play.js
CHANGED
|
@@ -1504,11 +1504,11 @@ async function q5playPreSetup(q) {
|
|
|
1504
1504
|
} else {
|
|
1505
1505
|
let hw = (w * 0.5) / meterSize;
|
|
1506
1506
|
let hh = (h * 0.5) / meterSize;
|
|
1507
|
-
rr
|
|
1507
|
+
let _rr = rr / meterSize;
|
|
1508
1508
|
|
|
1509
1509
|
if (rr) {
|
|
1510
|
-
hw = Math.max(hw -
|
|
1511
|
-
hh = Math.max(hh -
|
|
1510
|
+
hw = Math.max(hw - _rr, 0.001);
|
|
1511
|
+
hh = Math.max(hh - _rr, 0.001);
|
|
1512
1512
|
}
|
|
1513
1513
|
|
|
1514
1514
|
if (offsetX || offsetY) {
|
|
@@ -1516,26 +1516,29 @@ async function q5playPreSetup(q) {
|
|
|
1516
1516
|
|
|
1517
1517
|
if (!rr) geom = b2MakeOffsetBox(hw, hh, offset, ZERO_ROT);
|
|
1518
1518
|
else {
|
|
1519
|
-
geom = b2MakeOffsetRoundedBox(hw, hh, offset, ZERO_ROT,
|
|
1519
|
+
geom = b2MakeOffsetRoundedBox(hw, hh, offset, ZERO_ROT, _rr);
|
|
1520
1520
|
}
|
|
1521
1521
|
} else {
|
|
1522
1522
|
if (!rr) geom = b2MakeBox(hw, hh);
|
|
1523
|
-
else geom = b2MakeRoundedBox(hw, hh,
|
|
1523
|
+
else geom = b2MakeRoundedBox(hw, hh, _rr);
|
|
1524
1524
|
}
|
|
1525
1525
|
|
|
1526
1526
|
geom._hw = hw;
|
|
1527
1527
|
geom._hh = hh;
|
|
1528
|
-
geom._rr =
|
|
1528
|
+
geom._rr = _rr;
|
|
1529
1529
|
|
|
1530
1530
|
id = b2CreatePolygonShape(bdID, shape.def, geom);
|
|
1531
1531
|
shape._init(id, 0, geom);
|
|
1532
1532
|
}
|
|
1533
1533
|
|
|
1534
1534
|
// TODO: use AABB to get extents
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1535
|
+
if (!shapes.length) {
|
|
1536
|
+
this._w = w;
|
|
1537
|
+
this._hw = w * 0.5;
|
|
1538
|
+
this._h = h;
|
|
1539
|
+
this._hh = h * 0.5;
|
|
1540
|
+
this._roundedRadius = rr;
|
|
1541
|
+
}
|
|
1539
1542
|
}
|
|
1540
1543
|
|
|
1541
1544
|
if (shape) {
|
|
@@ -3109,8 +3112,9 @@ async function q5playPreSetup(q) {
|
|
|
3109
3112
|
|
|
3110
3113
|
// exclude props that are inherited in a special way or not traits
|
|
3111
3114
|
const spriteStdInheritedProps = $.Sprite.propsAll.filter(
|
|
3115
|
+
// prettier-ignore
|
|
3112
3116
|
(p) =>
|
|
3113
|
-
!['ani', 'd', 'diameter', 'h', 'height', 'physics', 'scale', 'tile', 'w', 'width', 'vel', 'x', 'y'].includes(p)
|
|
3117
|
+
!['ani', 'd', 'diameter', 'h', 'height', 'physics', 'scale', 'tile', 'w', 'width', 'vel', 'x', 'y', 'roundedRadius'].includes(p)
|
|
3114
3118
|
);
|
|
3115
3119
|
|
|
3116
3120
|
let groupKeys = {};
|
|
@@ -7994,7 +7998,7 @@ async function q5playPreSetup(q) {
|
|
|
7994
7998
|
};
|
|
7995
7999
|
|
|
7996
8000
|
// prettier-ignore
|
|
7997
|
-
let q5playGlobals = ['q5play','Box2D','DYN','DYNAMIC','STA','STATIC','KIN','KINEMATIC','Sprite','Group','allSprites','Ani','Anis','Visual','Visuals','camera','Joint','GlueJoint','DistanceJoint','WheelJoint','HingeJoint','SliderJoint','GrabberJoint','world','kb','keyboard','mouse','contro','contros','controllers','pointer','pointers','spriteArt','EmojiImage','getFPS','animation','parseTextureAtlas'];
|
|
8001
|
+
let q5playGlobals = ['q5play','Box2D','DYN','DYNAMIC','STA','STATIC','KIN','KINEMATIC','Sprite','Group','allSprites','Ani','Anis','Visual','Visuals','camera','Joint','GlueJoint','DistanceJoint','WheelJoint','HingeJoint','SliderJoint','GrabberJoint','world','kb','keyboard','mouse','contro','contros','controllers','pointer','pointers','spriteArt','EmojiImage','getFPS','animation','parseTextureAtlas','delay'];
|
|
7998
8002
|
|
|
7999
8003
|
// manually propagate q5play stuff to the global window object
|
|
8000
8004
|
if ($._isGlobal) {
|