forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.js
More file actions
76 lines (55 loc) · 2.05 KB
/
Copy pathSettings.js
File metadata and controls
76 lines (55 loc) · 2.05 KB
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
66
67
68
69
70
71
72
73
74
75
76
var CONST = require('./const');
var ScaleModes = require('../renderer/ScaleModes');
var GetValue = require('../utils/object/GetValue');
var Settings = {
create: function (config)
{
if (typeof config === 'string')
{
config = { key: config };
}
else if (config === undefined)
{
// Pass the 'hasOwnProperty' checks
config = {};
}
return {
status: CONST.PENDING,
op: CONST.BOOT,
key: GetValue(config, 'key', ''),
active: GetValue(config, 'active', false),
visible: GetValue(config, 'visible', true),
// Loader payload array
data: {},
files: GetValue(config, 'files', false),
// -1 means the State Manager will set it to be the Game dimensions
x: GetValue(config, 'x', 0),
y: GetValue(config, 'y', 0),
rotation: GetValue(config, 'rotation', 0),
width: GetValue(config, 'width', -1),
height: GetValue(config, 'height', -1),
// State Render Settings (applies only to this State)
scaleMode: GetValue(config, 'scaleMode', ScaleModes.DEFAULT),
roundPixels: GetValue(config, 'roundPixels', false),
dirtyRender: GetValue(config, 'dirtyRender', false),
renderToTexture: GetValue(config, 'renderToTexture', false),
// The following only apply if renderToTexture is true
autoResize: GetValue(config, 'autoResize', false),
transparent: GetValue(config, 'transparent', false),
clearBeforeRender: GetValue(config, 'clearBeforeRender', true),
backgroundColor: GetValue(config, 'backgroundColor', false)
};
},
init: function (config, gameConfig)
{
if (config.width === -1)
{
config.width = gameConfig.width;
}
if (config.height === -1)
{
config.height = gameConfig.height;
}
}
};
module.exports = Settings;