forked from pshenok/server-survival
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (34 loc) · 947 Bytes
/
main.js
File metadata and controls
38 lines (34 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class GameScene extends Phaser.Scene {
create() {
initThreeWorld();
initInputHandlers();
// Keep Phaser's canvas from intercepting input meant for Three.js/DOM
const canvas = this.game.canvas;
if (canvas) {
canvas.style.position = "absolute";
canvas.style.top = "0";
canvas.style.left = "0";
canvas.style.width = "100%";
canvas.style.height = "100%";
canvas.style.pointerEvents = "none";
}
}
update(time, delta) {
const deltaSeconds = delta / 1000;
tick(deltaSeconds);
}
}
const phaserConfig = {
type: Phaser.WEBGL,
parent: "canvas-container",
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: "rgba(0,0,0,0)",
transparent: true,
fps: {
min: 10,
target: 60,
},
scene: [GameScene],
};
window.PHASER_GAME = new Phaser.Game(phaserConfig);