phaser/src/scene/Settings.js

76 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-01-16 19:49:13 +00:00
var CONST = require('./const');
var ScaleModes = require('../renderer/ScaleModes');
var GetValue = require('../utils/object/GetValue');
var InjectionMap = require('./InjectionMap');
2016-11-29 13:01:16 +00:00
2017-02-06 23:59:15 +00:00
var Settings = {
create: function (config)
2016-11-29 13:01:16 +00:00
{
2017-02-06 23:59:15 +00:00
if (typeof config === 'string')
{
config = { key: config };
}
else if (config === undefined)
{
// Pass the 'hasOwnProperty' checks
config = {};
}
2016-11-29 13:01:16 +00:00
2017-02-06 23:59:15 +00:00
return {
2016-11-29 13:01:16 +00:00
2017-02-06 23:59:15 +00:00
status: CONST.PENDING,
2016-11-29 13:01:16 +00:00
2017-02-06 23:59:15 +00:00
op: CONST.BOOT,
2016-11-29 13:01:16 +00:00
key: GetValue(config, 'key', ''),
active: GetValue(config, 'active', false),
visible: GetValue(config, 'visible', true),
isBooted: false,
// Loader payload array
2017-02-17 02:07:56 +00:00
data: {},
files: GetValue(config, 'files', false),
2016-11-29 13:01:16 +00:00
// Cameras
cameras: GetValue(config, 'cameras', null),
// Scene Property Injection Map
map: GetValue(config, 'map', InjectionMap),
// Physics
physics: GetValue(config, 'physics', {}),
// Loader
loader: GetValue(config, 'loader', {}),
// Plugins
plugins: GetValue(config, 'plugins', false),
// Scene Render Settings (applies only to this Scene)
2017-01-20 02:28:55 +00:00
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)
2017-02-06 23:59:15 +00:00
};
}
2017-02-06 23:59:15 +00:00
2016-11-29 13:01:16 +00:00
};
module.exports = Settings;