Skip to content

Commit a814b58

Browse files
committed
Tidying up the State classes.
1 parent 4ac4d40 commit a814b58

4 files changed

Lines changed: 31 additions & 24 deletions

File tree

v3/src/const.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,7 @@ var CONST = {
66
CANVAS: 1,
77
WEBGL: 2,
88

9-
IMAGE: 20,
10-
11-
state: {
12-
13-
PENDING: 0,
14-
INSTALLED: 1,
15-
16-
BOOT: 0,
17-
INIT: 1,
18-
PRELOAD: 2,
19-
CREATE: 3,
20-
UPDATE: 4,
21-
RENDER: 5,
22-
SHUTDOWN: 6
23-
24-
}
9+
IMAGE: 20
2510

2611
};
2712

v3/src/renderer/canvas/CanvasRenderer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ var CanvasRenderer = function (game)
2020

2121
this.autoResize = false;
2222

23-
this.preserveDrawingBuffer = false;
23+
// this.smoothProperty = Phaser.Canvas.getSmoothingPrefix(this.context);
24+
25+
this.roundPixels = false;
2426

2527
this.width = game.config.width * game.config.resolution;
2628

@@ -37,10 +39,6 @@ var CanvasRenderer = function (game)
3739
*/
3840
this.context = this.view.getContext('2d', { alpha: true });
3941

40-
// this.smoothProperty = Phaser.Canvas.getSmoothingPrefix(this.context);
41-
42-
this.roundPixels = false;
43-
4442
// Map to the required function
4543
this.drawImage = DrawImage;
4644

v3/src/state/Settings.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var CONST = require('../const');
1+
var CONST = require('./const');
22
var ScaleModes = require('../renderer/ScaleModes');
33
var GetObjectValue = require('../utils/GetObjectValue');
44

@@ -16,11 +16,11 @@ var Settings = function (state, config)
1616

1717
this.state = state; // Do we actually need this reference? This could just be a property bucket
1818

19-
this.status = CONST.state.PENDING;
19+
this.status = CONST.PENDING;
2020

2121
// Which part of this State is currently being processed?
2222
// preload, create, update, shutdown, etc
23-
this.op = CONST.state.BOOT;
23+
this.op = CONST.BOOT;
2424

2525
this.key = GetObjectValue(config, 'key', '');
2626
this.active = GetObjectValue(config, 'active', false);
@@ -33,6 +33,15 @@ var Settings = function (state, config)
3333
// -1 means the State Manager will set it to be the Game dimensions
3434
this.width = GetObjectValue(config, 'width', -1);
3535
this.height = GetObjectValue(config, 'height', -1);
36+
37+
// Renderer Settings
38+
39+
this.clearBeforeRender = GetObjectValue(config, 'clearBeforeRender', true);
40+
this.transparent = GetObjectValue(config, 'transparent', false);
41+
this.autoResize = GetObjectValue(config, 'autoResize', false);
42+
this.roundPixels = GetObjectValue(config, 'roundPixels', false);
43+
this.drawToPrimaryCanvas = GetObjectValue(config, 'drawToPrimaryCanvas', false);
44+
3645
};
3746

3847
// Unless we add some actual functions in here, we'll make this just return an Object instead of an instance

v3/src/state/const.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
module.exports = {
3+
4+
PENDING: 0,
5+
INSTALLED: 1,
6+
7+
BOOT: 0,
8+
INIT: 1,
9+
PRELOAD: 2,
10+
CREATE: 3,
11+
UPDATE: 4,
12+
RENDER: 5,
13+
SHUTDOWN: 6
14+
15+
};

0 commit comments

Comments
 (0)