Fixed Scale Mode references.

This commit is contained in:
Richard Davey 2017-01-18 14:48:02 +00:00
parent 26ac8f5c58
commit 270504923d
7 changed files with 14 additions and 23 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: '746a1440-dd75-11e6-9565-df50d68fb751'
build: 'b42592a0-dd8c-11e6-9836-0f8afa574dfa'
};
module.exports = CHECKSUM;

View file

@ -6,6 +6,7 @@
var CONST = require('../const');
var MATH_CONST = require('../math/const');
var ScaleModes = require('../renderer/ScaleModes');
var Component = require('../components');
var WrapAngle = require('../math/angle/Wrap');
@ -51,7 +52,7 @@ var GameObject = function (state, x, y, texture, frame, parent)
// ----------------------------------------------------------------
// ----------------------------------------------------------------
this.scaleMode = CONST.scaleModes.DEFAULT;
this.scaleMode = ScaleModes.DEFAULT;
// Allows you to turn off a GameObject from rendering, but still render its children (if it has any)
// Maybe this should move?

View file

@ -13,7 +13,7 @@ var CanvasRenderer = function (game)
// Needed?
this.type = CONST.CANVAS;
// Read all the following from game config
// Read all the following from game config (or State config?)
this.clearBeforeRender = true;
this.transparent = false;
@ -50,10 +50,6 @@ var CanvasRenderer = function (game)
this.currentBlendMode = 0;
this.currentScaleMode = 0;
this.startTime = 0;
this.endTime = 0;
this.drawCount = 0;
// this.tintMethod = this.tintWithPerPixel;
this.init();
@ -86,7 +82,7 @@ CanvasRenderer.prototype = {
// if (this.smoothProperty)
// {
// this.context[this.smoothProperty] = (this.scaleMode === Phaser.scaleModes.LINEAR);
// this.context[this.smoothProperty] = (this.scaleMode === ScaleModes.LINEAR);
// }
},
@ -109,8 +105,6 @@ CanvasRenderer.prototype = {
// TODO: A State should have the option of having its own canvas to draw to
this.startTime = Date.now();
ctx.setTransform(1, 0, 0, 1, 0, 0);
// If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops)
@ -118,29 +112,25 @@ CanvasRenderer.prototype = {
if (this.currentAlpha !== 1)
{
ctx.globalAlpha = 1;
this.currentAlpha = 1;
}
if (this.currentBlendMode !== 0)
{
ctx.globalCompositeOperation = 'source-over';
this.currentBlendMode = 0;
}
this.currentBlendMode = 0;
this.currentScaleMode = 0;
this.currentAlpha = 1;
if (this.clearBeforeRender)
{
ctx.clearRect(0, 0, this.width, this.height);
}
this.drawCount = 0;
// Could move to the State Systems or MainLoop
this.game.state.renderChildren(this, state, interpolationPercentage);
this.endTime = Date.now();
// console.log('%c render end ', 'color: #ffffff; background: #ff0000;');
// Add Post-render hook

View file

@ -25,7 +25,7 @@ var DrawImage = function (frame, blendMode, transform, alpha, tint, bg)
if (this.currentScaleMode !== frame.source.scaleMode)
{
// this.currentScaleMode = source.scaleMode;
// ctx[this.smoothProperty] = (source.scaleMode === Phaser.scaleModes.LINEAR);
// ctx[this.smoothProperty] = (source.scaleMode === ScaleModes.LINEAR);
}
ctx.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty);

View file

@ -1,9 +1,9 @@
var CONST = require('../../../const');
var ScaleModes = require('../../ScaleModes');
var CreateEmptyTexture = function (gl, width, height, scaleMode, textureIndex)
{
var texture = gl.createTexture();
var glScaleMode = (scaleMode === CONST.scaleModes.LINEAR) ? gl.LINEAR : gl.NEAREST;
var glScaleMode = (scaleMode === ScaleModes.LINEAR) ? gl.LINEAR : gl.NEAREST;
gl.activeTexture(gl.TEXTURE0 + textureIndex);
gl.bindTexture(gl.TEXTURE_2D, texture);

View file

@ -1,4 +1,5 @@
var CONST = require('../const');
var ScaleModes = require('../renderer/ScaleModes');
var GetObjectValue = require('../utils/GetObjectValue');
var Settings = function (state, config)
@ -24,7 +25,7 @@ var Settings = function (state, config)
this.key = GetObjectValue(config, 'key', '');
this.active = GetObjectValue(config, 'active', false);
this.visible = GetObjectValue(config, 'visible', true);
this.scaleMode = GetObjectValue(config, 'scaleMode', CONST.scaleModes.DEFAULT);
this.scaleMode = GetObjectValue(config, 'scaleMode', ScaleModes.DEFAULT);
this.fps = GetObjectValue(config, 'fps', 60);
this.x = GetObjectValue(config, 'x', 0);
this.y = GetObjectValue(config, 'y', 0);

View file

@ -4,7 +4,7 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var CONST = require('../const');
var ScaleModes = require('../renderer/ScaleModes');
var IsSizePowerOfTwo = require('../math/pow2/IsSizePowerOfTwo');
/**
@ -56,8 +56,7 @@ var TextureSource = function (texture, source)
* @type {Number}
* @default Phaser.scaleModes.DEFAULT;
*/
this.scaleMode = CONST.scaleModes.DEFAULT;
// this.scaleMode = CONST.scaleModes.NEAREST;
this.scaleMode = ScaleModes.DEFAULT;
/**
* Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)