Skip to content

Commit 49c2868

Browse files
committed
All default width/height values are now taken from the Scale Manager, not the Game Config
1 parent 7111800 commit 49c2868

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/cameras/2d/CameraManager.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ var CameraManager = new Class({
234234
{
235235
if (x === undefined) { x = 0; }
236236
if (y === undefined) { y = 0; }
237-
if (width === undefined) { width = this.scene.sys.game.config.width; }
238-
if (height === undefined) { height = this.scene.sys.game.config.height; }
237+
if (width === undefined) { width = this.scene.sys.scale.width; }
238+
if (height === undefined) { height = this.scene.sys.scale.height; }
239239
if (makeMain === undefined) { makeMain = false; }
240240
if (name === undefined) { name = ''; }
241241

@@ -403,8 +403,8 @@ var CameraManager = new Class({
403403
config = [ config ];
404404
}
405405

406-
var gameWidth = this.scene.sys.game.config.width;
407-
var gameHeight = this.scene.sys.game.config.height;
406+
var gameWidth = this.scene.sys.scale.width;
407+
var gameHeight = this.scene.sys.scale.height;
408408

409409
for (var i = 0; i < config.length; i++)
410410
{

src/gameobjects/components/Transform.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ var Transform = {
258258
{
259259
if (x === undefined) { x = 0; }
260260
if (y === undefined) { y = 0; }
261-
if (width === undefined) { width = this.scene.sys.game.config.width; }
262-
if (height === undefined) { height = this.scene.sys.game.config.height; }
261+
if (width === undefined) { width = this.scene.sys.scale.width; }
262+
if (height === undefined) { height = this.scene.sys.scale.height; }
263263

264264
this.x = x + (Math.random() * width);
265265
this.y = y + (Math.random() * height);

src/gameobjects/graphics/Graphics.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,8 +1486,8 @@ var Graphics = new Class({
14861486
var sys = this.scene.sys;
14871487
var renderer = sys.game.renderer;
14881488

1489-
if (width === undefined) { width = sys.game.config.width; }
1490-
if (height === undefined) { height = sys.game.config.height; }
1489+
if (width === undefined) { width = sys.scale.width; }
1490+
if (height === undefined) { height = sys.scale.height; }
14911491

14921492
Graphics.TargetCamera.setScene(this.scene);
14931493
Graphics.TargetCamera.setViewport(0, 0, width, height);

src/physics/arcade/World.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ var World = new Class({
249249
this.bounds = new Rectangle(
250250
GetValue(config, 'x', 0),
251251
GetValue(config, 'y', 0),
252-
GetValue(config, 'width', scene.sys.game.config.width),
253-
GetValue(config, 'height', scene.sys.game.config.height)
252+
GetValue(config, 'width', scene.sys.scale.width),
253+
GetValue(config, 'height', scene.sys.scale.height)
254254
);
255255

256256
/**

src/physics/impact/World.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ var World = new Class({
252252
{
253253
var x = GetFastValue(boundsConfig, 'x', 0);
254254
var y = GetFastValue(boundsConfig, 'y', 0);
255-
var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width);
256-
var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height);
255+
var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width);
256+
var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height);
257257
var thickness = GetFastValue(boundsConfig, 'thickness', 64);
258258
var left = GetFastValue(boundsConfig, 'left', true);
259259
var right = GetFastValue(boundsConfig, 'right', true);
@@ -425,8 +425,8 @@ var World = new Class({
425425
{
426426
if (x === undefined) { x = 0; }
427427
if (y === undefined) { y = 0; }
428-
if (width === undefined) { width = this.scene.sys.game.config.width; }
429-
if (height === undefined) { height = this.scene.sys.game.config.height; }
428+
if (width === undefined) { width = this.scene.sys.scale.width; }
429+
if (height === undefined) { height = this.scene.sys.scale.height; }
430430
if (thickness === undefined) { thickness = 64; }
431431
if (left === undefined) { left = true; }
432432
if (right === undefined) { right = true; }

src/physics/matter-js/World.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ var World = new Class({
9696
{
9797
var x = GetFastValue(boundsConfig, 'x', 0);
9898
var y = GetFastValue(boundsConfig, 'y', 0);
99-
var width = GetFastValue(boundsConfig, 'width', scene.sys.game.config.width);
100-
var height = GetFastValue(boundsConfig, 'height', scene.sys.game.config.height);
99+
var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width);
100+
var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height);
101101
var thickness = GetFastValue(boundsConfig, 'thickness', 64);
102102
var left = GetFastValue(boundsConfig, 'left', true);
103103
var right = GetFastValue(boundsConfig, 'right', true);
@@ -319,8 +319,8 @@ var World = new Class({
319319
{
320320
if (x === undefined) { x = 0; }
321321
if (y === undefined) { y = 0; }
322-
if (width === undefined) { width = this.scene.sys.game.config.width; }
323-
if (height === undefined) { height = this.scene.sys.game.config.height; }
322+
if (width === undefined) { width = this.scene.sys.scale.width; }
323+
if (height === undefined) { height = this.scene.sys.scale.height; }
324324
if (thickness === undefined) { thickness = 128; }
325325
if (left === undefined) { left = true; }
326326
if (right === undefined) { right = true; }

0 commit comments

Comments
 (0)