Skip to content

Commit 2705049

Browse files
committed
Fixed Scale Mode references.
1 parent 26ac8f5 commit 2705049

7 files changed

Lines changed: 14 additions & 23 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '746a1440-dd75-11e6-9565-df50d68fb751'
2+
build: 'b42592a0-dd8c-11e6-9836-0f8afa574dfa'
33
};
44
module.exports = CHECKSUM;

v3/src/gameobjects/GameObject.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
var CONST = require('../const');
88
var MATH_CONST = require('../math/const');
9+
var ScaleModes = require('../renderer/ScaleModes');
910
var Component = require('../components');
1011
var WrapAngle = require('../math/angle/Wrap');
1112

@@ -51,7 +52,7 @@ var GameObject = function (state, x, y, texture, frame, parent)
5152
// ----------------------------------------------------------------
5253
// ----------------------------------------------------------------
5354

54-
this.scaleMode = CONST.scaleModes.DEFAULT;
55+
this.scaleMode = ScaleModes.DEFAULT;
5556

5657
// Allows you to turn off a GameObject from rendering, but still render its children (if it has any)
5758
// Maybe this should move?

v3/src/renderer/canvas/CanvasRenderer.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var CanvasRenderer = function (game)
1313
// Needed?
1414
this.type = CONST.CANVAS;
1515

16-
// Read all the following from game config
16+
// Read all the following from game config (or State config?)
1717
this.clearBeforeRender = true;
1818

1919
this.transparent = false;
@@ -50,10 +50,6 @@ var CanvasRenderer = function (game)
5050
this.currentBlendMode = 0;
5151
this.currentScaleMode = 0;
5252

53-
this.startTime = 0;
54-
this.endTime = 0;
55-
this.drawCount = 0;
56-
5753
// this.tintMethod = this.tintWithPerPixel;
5854

5955
this.init();
@@ -86,7 +82,7 @@ CanvasRenderer.prototype = {
8682

8783
// if (this.smoothProperty)
8884
// {
89-
// this.context[this.smoothProperty] = (this.scaleMode === Phaser.scaleModes.LINEAR);
85+
// this.context[this.smoothProperty] = (this.scaleMode === ScaleModes.LINEAR);
9086
// }
9187
},
9288

@@ -109,38 +105,32 @@ CanvasRenderer.prototype = {
109105

110106
// TODO: A State should have the option of having its own canvas to draw to
111107

112-
this.startTime = Date.now();
113-
114108
ctx.setTransform(1, 0, 0, 1, 0, 0);
115109

116110
// If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops)
117111

118112
if (this.currentAlpha !== 1)
119113
{
120114
ctx.globalAlpha = 1;
115+
this.currentAlpha = 1;
121116
}
122117

123118
if (this.currentBlendMode !== 0)
124119
{
125120
ctx.globalCompositeOperation = 'source-over';
121+
this.currentBlendMode = 0;
126122
}
127123

128-
this.currentBlendMode = 0;
129124
this.currentScaleMode = 0;
130-
this.currentAlpha = 1;
131125

132126
if (this.clearBeforeRender)
133127
{
134128
ctx.clearRect(0, 0, this.width, this.height);
135129
}
136130

137-
this.drawCount = 0;
138-
139131
// Could move to the State Systems or MainLoop
140132
this.game.state.renderChildren(this, state, interpolationPercentage);
141133

142-
this.endTime = Date.now();
143-
144134
// console.log('%c render end ', 'color: #ffffff; background: #ff0000;');
145135

146136
// Add Post-render hook

v3/src/renderer/canvas/utils/DrawImage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var DrawImage = function (frame, blendMode, transform, alpha, tint, bg)
2525
if (this.currentScaleMode !== frame.source.scaleMode)
2626
{
2727
// this.currentScaleMode = source.scaleMode;
28-
// ctx[this.smoothProperty] = (source.scaleMode === Phaser.scaleModes.LINEAR);
28+
// ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR);
2929
}
3030

3131
ctx.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty);

v3/src/renderer/webgl/utils/CreateEmptyTexture.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var CONST = require('../../../const');
1+
var ScaleModes = require('../../ScaleModes');
22

33
var CreateEmptyTexture = function (gl, width, height, scaleMode, textureIndex)
44
{
55
var texture = gl.createTexture();
6-
var glScaleMode = (scaleMode === CONST.scaleModes.LINEAR) ? gl.LINEAR : gl.NEAREST;
6+
var glScaleMode = (scaleMode === ScaleModes.LINEAR) ? gl.LINEAR : gl.NEAREST;
77

88
gl.activeTexture(gl.TEXTURE0 + textureIndex);
99
gl.bindTexture(gl.TEXTURE_2D, texture);

v3/src/state/Settings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var CONST = require('../const');
2+
var ScaleModes = require('../renderer/ScaleModes');
23
var GetObjectValue = require('../utils/GetObjectValue');
34

45
var Settings = function (state, config)
@@ -24,7 +25,7 @@ var Settings = function (state, config)
2425
this.key = GetObjectValue(config, 'key', '');
2526
this.active = GetObjectValue(config, 'active', false);
2627
this.visible = GetObjectValue(config, 'visible', true);
27-
this.scaleMode = GetObjectValue(config, 'scaleMode', CONST.scaleModes.DEFAULT);
28+
this.scaleMode = GetObjectValue(config, 'scaleMode', ScaleModes.DEFAULT);
2829
this.fps = GetObjectValue(config, 'fps', 60);
2930
this.x = GetObjectValue(config, 'x', 0);
3031
this.y = GetObjectValue(config, 'y', 0);

v3/src/textures/TextureSource.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7-
var CONST = require('../const');
7+
var ScaleModes = require('../renderer/ScaleModes');
88
var IsSizePowerOfTwo = require('../math/pow2/IsSizePowerOfTwo');
99

1010
/**
@@ -56,8 +56,7 @@ var TextureSource = function (texture, source)
5656
* @type {Number}
5757
* @default Phaser.scaleModes.DEFAULT;
5858
*/
59-
this.scaleMode = CONST.scaleModes.DEFAULT;
60-
// this.scaleMode = CONST.scaleModes.NEAREST;
59+
this.scaleMode = ScaleModes.DEFAULT;
6160

6261
/**
6362
* Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)

0 commit comments

Comments
 (0)