fix preloadThenStart, fix clicky events
@@ -17,14 +17,15 @@ class Game
17
17
GameInput.g_init();
18
18
}
19
19
20
preloadImagesThenStart(imageData)
20
preloadImagesThenStart(imageData, onComplete)
21
21
{
22
22
const cont = async () => {
23
await game.preloadImages(
23
await this.preloadImages(
24
24
imageData
25
25
);
26
26
27
game.startGame();
27
this.startGame();
28
onComplete && onComplete();
28
29
}
29
30
30
31
cont.apply();
@@ -17,14 +17,15 @@ class Game17
GameInput.g_init();17
GameInput.g_init();18
}18
}19
19
20
preloadImagesThenStart(imageData)20
preloadImagesThenStart(imageData, onComplete)21
{21
{22
const cont = async () => {22
const cont = async () => {23
await game.preloadImages(23
await this.preloadImages(24
imageData24
imageData25
);25
);26
26
27
game.startGame();27
this.startGame();28
onComplete && onComplete();28
}29
}29
30
30
cont.apply();31
cont.apply();@@ -77,7 +77,7 @@ var GameInput =
77
77
GameInput.trueMousePosition.y = e.y;
78
78
}
79
79
80
var el = document.getElementsByTagName("canvas")[0];
80
var el = document.getElementsByTagName("body")[0];
81
81
el.addEventListener("touchstart", function(){GameInput.g_mouseDownThisFrame = true;}, false);
82
82
el.addEventListener("touchend", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);
83
83
el.addEventListener("touchcancel", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);
@@ -77,7 +77,7 @@ var GameInput =77
GameInput.trueMousePosition.y = e.y;77
GameInput.trueMousePosition.y = e.y;78
}78
}79
79
80
var el = document.getElementsByTagName("canvas")[0];80
var el = document.getElementsByTagName("body")[0];81
el.addEventListener("touchstart", function(){GameInput.g_mouseDownThisFrame = true;}, false);81
el.addEventListener("touchstart", function(){GameInput.g_mouseDownThisFrame = true;}, false);82
el.addEventListener("touchend", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);82
el.addEventListener("touchend", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);83
el.addEventListener("touchcancel", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);83
el.addEventListener("touchcancel", function(){GameInput.g_mouseDownThisFrame = false;GameInput.g_mouseDown = false;}, false);