Added backgroundColor to Camera config.

This commit is contained in:
photonstorm 2017-06-29 16:55:55 +01:00
parent 8ab8a59704
commit b6e9d42f11
4 changed files with 14 additions and 48 deletions

View file

@ -309,6 +309,7 @@ Camera.prototype = {
roundPixels: bool
scrollX: float
scrollY: float
backgroundColor: string
bounds: {
x: int
y: int
@ -329,7 +330,8 @@ Camera.prototype = {
rotation: this.rotation,
roundPixels: this.roundPixels,
scrollX: this.scrollX,
scrollY: this.scrollY
scrollY: this.scrollY,
backgroundColor: this.backgroundColor.rgba
};
if (this.useBounds)

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '86cb31f0-5ce1-11e7-a901-dbab721a365f'
build: '0a9c3370-5ce3-11e7-886b-43134c9cdc6e'
};
module.exports = CHECKSUM;

View file

@ -4,30 +4,6 @@ var GetValue = require('../utils/object/GetValue');
var Settings = {
/*
{
cameras: [
{
x: int
y: int
width: int
height: int
zoom: float
rotation: float
roundPixels: bool
scrollX: float
scrollY: float
bounds: {
x: int
y: int
width: int
height: int
}
}
]
}
*/
create: function (config)
{
if (typeof config === 'string')
@ -60,13 +36,6 @@ var Settings = {
cameras: GetValue(config, 'cameras', null),
// -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),
@ -82,21 +51,6 @@ var Settings = {
};
}
/*
init: function (config, gameConfig)
{
if (config.width === -1)
{
config.width = gameConfig.width;
}
if (config.height === -1)
{
config.height = gameConfig.height;
}
}
*/
};
module.exports = Settings;

View file

@ -43,6 +43,7 @@ CameraManager.prototype = {
roundPixels: bool
scrollX: float
scrollY: float
backgroundColor: string
bounds: {
x: int
y: int
@ -82,6 +83,15 @@ CameraManager.prototype = {
camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0);
camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false);
// Background Color
var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false);
if (backgroundColor)
{
camera.setBackgroundColor(backgroundColor);
}
// Bounds
var boundsConfig = GetFastValue(cameraConfig, 'bounds', null);