q5play 4.0.5 → 4.0.7
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 +13 -1
- package/q5play.js +7 -4
package/package.json
CHANGED
package/q5play.d.ts
CHANGED
|
@@ -70,6 +70,14 @@ declare global {
|
|
|
70
70
|
* @default false
|
|
71
71
|
*/
|
|
72
72
|
renderStats: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Runs automatically before each draw function call.
|
|
75
|
+
*/
|
|
76
|
+
update(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Runs automatically after each draw function call.
|
|
79
|
+
*/
|
|
80
|
+
postDraw(): void;
|
|
73
81
|
}
|
|
74
82
|
const q5play: Q5Play;
|
|
75
83
|
|
|
@@ -2902,7 +2910,11 @@ declare global {
|
|
|
2902
2910
|
function EmojiImage(emoji: string, textSize: number): Q5.Image;
|
|
2903
2911
|
function spriteArt(txt: string, scale: number, palette: number | any): Q5.Image;
|
|
2904
2912
|
function animation(ani: Ani, x: number, y: number, r: number, sX: number, sY: number): void;
|
|
2905
|
-
|
|
2913
|
+
/**
|
|
2914
|
+
* @param milliseconds if not specified, delays until the next frame draw
|
|
2915
|
+
* @returns resolves after the delay
|
|
2916
|
+
*/
|
|
2917
|
+
function delay(milliseconds?: number): Promise<void>;
|
|
2906
2918
|
|
|
2907
2919
|
let allSprites: Group;
|
|
2908
2920
|
let world: World;
|
package/q5play.js
CHANGED
|
@@ -248,6 +248,9 @@ async function q5playPreSetup(q) {
|
|
|
248
248
|
this.os = {};
|
|
249
249
|
this.context = 'web';
|
|
250
250
|
|
|
251
|
+
this.update = () => q5playUpdate.call($, q);
|
|
252
|
+
this.postdraw = () => q5playPostDraw.call($, q);
|
|
253
|
+
|
|
251
254
|
if (window.matchMedia) {
|
|
252
255
|
this.hasMouse = window.matchMedia('(any-hover: none)').matches ? false : true;
|
|
253
256
|
} else this.hasMouse = true;
|
|
@@ -7812,7 +7815,7 @@ async function q5playPreSetup(q) {
|
|
|
7812
7815
|
debugYellow = $.color(colorMax, colorMax, 0, colorMax * 0.9),
|
|
7813
7816
|
debugYellowFill = $.color(colorMax, colorMax, 0, colorMax * 0.1);
|
|
7814
7817
|
|
|
7815
|
-
if ($.
|
|
7818
|
+
if ($.canvas.c2d) {
|
|
7816
7819
|
// polyfill for q5 WebGPU high efficiency functions
|
|
7817
7820
|
$._getFillIdx = () => $._fill;
|
|
7818
7821
|
$._setFillIdx = (v) => ($._fill = v);
|
|
@@ -7998,7 +8001,7 @@ async function q5playPreSetup(q) {
|
|
|
7998
8001
|
};
|
|
7999
8002
|
|
|
8000
8003
|
// prettier-ignore
|
|
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'];
|
|
8004
|
+
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'];
|
|
8002
8005
|
|
|
8003
8006
|
// manually propagate q5play stuff to the global window object
|
|
8004
8007
|
if ($._isGlobal) {
|
|
@@ -8026,7 +8029,7 @@ function q5playPostSetup() {
|
|
|
8026
8029
|
}
|
|
8027
8030
|
|
|
8028
8031
|
// called before each draw function call
|
|
8029
|
-
function
|
|
8032
|
+
function q5playUpdate() {
|
|
8030
8033
|
const $ = this;
|
|
8031
8034
|
|
|
8032
8035
|
if (!$._q5) {
|
|
@@ -8382,6 +8385,6 @@ q5playClassLangs.Group += q5playClassLangs.Sprite;
|
|
|
8382
8385
|
|
|
8383
8386
|
Q5.addHook('presetup', q5playPreSetup);
|
|
8384
8387
|
Q5.addHook('postsetup', q5playPostSetup);
|
|
8385
|
-
Q5.addHook('predraw',
|
|
8388
|
+
Q5.addHook('predraw', q5playUpdate);
|
|
8386
8389
|
Q5.addHook('postdraw', q5playPostDraw);
|
|
8387
8390
|
Q5.addHook('remove', q5playRemove);
|