phaser/v3/src/state/Settings.js

46 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-01-20 02:28:55 +00:00
var CONST = require('./const');
2017-01-18 14:48:02 +00:00
var ScaleModes = require('../renderer/ScaleModes');
2016-11-29 13:01:16 +00:00
var GetObjectValue = require('../utils/GetObjectValue');
var Settings = function (config)
2016-11-29 13:01:16 +00:00
{
if (typeof config === 'string')
{
config = { key: config };
}
else if (config === undefined)
{
// Pass the 'hasOwnProperty' checks
config = {};
}
return {
2016-11-29 13:01:16 +00:00
status: CONST.PENDING,
2016-11-29 13:01:16 +00:00
op: CONST.BOOT,
2016-11-29 13:01:16 +00:00
key: GetObjectValue(config, 'key', ''),
active: GetObjectValue(config, 'active', false),
visible: GetObjectValue(config, 'visible', true),
scaleMode: GetObjectValue(config, 'scaleMode', ScaleModes.DEFAULT),
x: GetObjectValue(config, 'x', 0),
y: GetObjectValue(config, 'y', 0),
2016-11-29 13:01:16 +00:00
// -1 means the State Manager will set it to be the Game dimensions
width: GetObjectValue(config, 'width', -1),
height: GetObjectValue(config, 'height', -1),
2017-01-20 02:28:55 +00:00
// Renderer Settings
2017-01-20 02:28:55 +00:00
clearBeforeRender: GetObjectValue(config, 'clearBeforeRender', true),
transparent: GetObjectValue(config, 'transparent', false),
autoResize: GetObjectValue(config, 'autoResize', false),
roundPixels: GetObjectValue(config, 'roundPixels', false),
drawToPrimaryCanvas: GetObjectValue(config, 'drawToPrimaryCanvas', false),
2017-01-20 02:28:55 +00:00
};
2016-11-29 13:01:16 +00:00
};
module.exports = Settings;