-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBoot.js
executable file
·65 lines (50 loc) · 2.18 KB
/
Boot.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var BasicGame = {};
BasicGame.Boot = function (game) {
};
BasicGame.Boot.prototype = {
init: function () {
// Unless you specifically know your game needs to support multi-touch I would recommend setting this to 1
this.input.maxPointers = 1;
// Phaser will automatically pause if the browser tab the game is in loses focus. You can disable that here:
this.stage.disableVisibilityChange = true;
if (this.game.device.desktop)
{
// If you have any desktop specific settings, they can go in here
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.minWidth = 640;
this.scale.minHeight = 380;
this.scale.maxWidth = 1920;
this.scale.maxHeight = 1200;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
this.scale.setScreenSize(true);
this.scale.refresh();
}
else
{
// Same goes for mobile settings.
// In this case we're saying "scale the game, no lower than 480x260 and no higher than 1024x768"
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.minWidth = 640;
this.scale.minHeight = 380;
this.scale.maxWidth = 1920;
this.scale.maxHeight = 1200;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
this.scale.forceOrientation(true, false);
this.scale.setResizeCallback(this.gameResized, this);
this.scale.setScreenSize(true);
this.scale.refresh();
}
},
preload: function () {
// Here we load the assets required for our preloader (in this case a background and a loading bar)
this.load.image('preloaderBackground', 'images/title_background.jpg');
this.load.image('preloaderBar', 'images/preloadr_bar.png');
},
create: function () {
// By this point the preloader assets have loaded to the cache, we've set the game settings
// So now let's start the real preloader going
this.state.start('Preloader');
}
};