mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Add filters to jshint task.
This commit is contained in:
parent
d4beaeafb7
commit
7aec06910d
13 changed files with 88 additions and 34 deletions
|
@ -394,6 +394,11 @@ module.exports = function (grunt) {
|
||||||
options: { jshintrc: '.jshintrc' }
|
options: { jshintrc: '.jshintrc' }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filters: {
|
||||||
|
src: ['filters/**/*.js'],
|
||||||
|
options: { jshintrc: 'filters/.jshintrc', }
|
||||||
|
},
|
||||||
|
|
||||||
tooling: {
|
tooling: {
|
||||||
src: [
|
src: [
|
||||||
'Gruntfile.js',
|
'Gruntfile.js',
|
||||||
|
|
49
filters/.jshintrc
Normal file
49
filters/.jshintrc
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"globals" : { "Phaser": false, "PIXI": false, "p2": false },
|
||||||
|
// Ignore Environment Globals
|
||||||
|
"browser" : true, // Standard browser globals e.g. `window`, `document`.
|
||||||
|
|
||||||
|
// Development
|
||||||
|
"devel" : true, // Allow developments statements e.g. `console.log();`.
|
||||||
|
|
||||||
|
// ECMAScript Support
|
||||||
|
"es3" : true, // Support legacy browser and javascript environments.
|
||||||
|
"esnext" : false, // This option tells JSHint that your code uses ECMAScript 6 specific syntax.
|
||||||
|
"strict" : false, // Require `use strict` pragma in every file.
|
||||||
|
"globalstrict": false, // Allow global "use strict" (also enables 'strict').
|
||||||
|
|
||||||
|
// Functionality
|
||||||
|
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
|
||||||
|
"boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
||||||
|
"camelcase" : false, // Force all variable names to use either camelCase style or UPPER_CASE with underscores.
|
||||||
|
"curly" : true, // Require {} for every new block or scope.
|
||||||
|
"eqeqeq" : false, // Require triple equals i.e. `===`.
|
||||||
|
"eqnull" : true, // Tolerate use of `== null`.
|
||||||
|
"evil" : false, // Tolerate use of `eval`.
|
||||||
|
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
||||||
|
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
|
||||||
|
"freeze" : true, // Prohibits overwriting prototypes of native objects such as Array and Date.
|
||||||
|
"funcscope" : true, // This option suppresses warnings about declaring variables inside of control structures while accessing them later from the outside.
|
||||||
|
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
|
||||||
|
"latedef" : true, // Prohibit variable use before definition.
|
||||||
|
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
|
||||||
|
"laxcomma" : false, // This option suppresses warnings about comma-first coding style.
|
||||||
|
"loopfunc" : true, // Allow functions to be defined within loops.
|
||||||
|
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
|
||||||
|
"notypeof" : false, // This option suppresses warnings about invalid typeof operator values.
|
||||||
|
"shadow" : true, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
|
||||||
|
"smarttabs" : false, // This option suppresses warnings about mixed tabs and spaces when the latter are used for alignmnent only.
|
||||||
|
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
|
||||||
|
"undef" : true, // Require all non-global variables be declared before they are used.
|
||||||
|
"unused" : true, // This option warns when you define and never use your variables.
|
||||||
|
|
||||||
|
// Styling
|
||||||
|
"indent" : false, // Specify indentation spacing
|
||||||
|
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
|
||||||
|
"noempty" : true, // Prohibit use of empty blocks.
|
||||||
|
"nonew" : true, // Prohibit use of constructors for side-effects.
|
||||||
|
"plusplus" : false, // Prohibit use of `++` & `--`.
|
||||||
|
"quotmark" : false, // This option enforces the consistency of quotation marks used throughout your code.
|
||||||
|
"sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
|
||||||
|
"trailing" : true // Prohibit trailing whitespaces.
|
||||||
|
}
|
|
@ -81,7 +81,7 @@ Phaser.Filter.BinarySerpents.prototype.init = function (width, height, march, ma
|
||||||
this.uniforms.march.value = march;
|
this.uniforms.march.value = march;
|
||||||
this.uniforms.maxDistance.value = maxDistance;
|
this.uniforms.maxDistance.value = maxDistance;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.BinarySerpents.prototype, 'fog', {
|
Object.defineProperty(Phaser.Filter.BinarySerpents.prototype, 'fog', {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Phaser.Filter.SampleFilter = function (game) {
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.divisor = { type: '1f', value: 0.5 };
|
this.uniforms.divisor = { type: '1f', value: 0.5 };
|
||||||
|
|
||||||
// The fragment shader source
|
// The fragment shader source
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter;
|
||||||
|
|
||||||
Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) {
|
Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) {
|
||||||
|
|
||||||
if (typeof divisor == 'undefined') { divisor = 0.5 };
|
if (typeof divisor == 'undefined') { divisor = 0.5; }
|
||||||
|
|
||||||
this.setResolution(width, height);
|
this.setResolution(width, height);
|
||||||
this.uniforms.divisor.value = divisor;
|
this.uniforms.divisor.value = divisor;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
|
@ -91,7 +91,7 @@ Phaser.Filter.CheckerWave = function (game) {
|
||||||
"gl_FragColor=color;",
|
"gl_FragColor=color;",
|
||||||
"}",
|
"}",
|
||||||
"else gl_FragColor=vec4(0,0,0.1,alpha); //background color",
|
"else gl_FragColor=vec4(0,0,0.1,alpha); //background color",
|
||||||
"}",
|
"}"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ Phaser.Filter.CheckerWave.prototype.init = function (width, height) {
|
||||||
|
|
||||||
this.setResolution(width, height);
|
this.setResolution(width, height);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Phaser.Filter.CheckerWave.prototype.setColor1 = function (red, green, blue) {
|
Phaser.Filter.CheckerWave.prototype.setColor1 = function (red, green, blue) {
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ Phaser.Filter.CheckerWave.prototype.setColor1 = function (red, green, blue) {
|
||||||
this.uniforms.color1.value.y = green;
|
this.uniforms.color1.value.y = green;
|
||||||
this.uniforms.color1.value.z = blue;
|
this.uniforms.color1.value.z = blue;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Phaser.Filter.CheckerWave.prototype.setColor2 = function (red, green, blue) {
|
Phaser.Filter.CheckerWave.prototype.setColor2 = function (red, green, blue) {
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ Phaser.Filter.CheckerWave.prototype.setColor2 = function (red, green, blue) {
|
||||||
this.uniforms.color2.value.y = green;
|
this.uniforms.color2.value.y = green;
|
||||||
this.uniforms.color2.value.z = blue;
|
this.uniforms.color2.value.z = blue;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.CheckerWave.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.CheckerWave.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Phaser.Filter.ColorBars = function (game) {
|
||||||
|
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1 }
|
this.uniforms.alpha = { type: '1f', value: 1 };
|
||||||
// this.uniforms.origin = { type: '1f', value: 2.0 }
|
// this.uniforms.origin = { type: '1f', value: 2.0 }
|
||||||
|
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
@ -70,7 +70,7 @@ Phaser.Filter.ColorBars.prototype.init = function (width, height) {
|
||||||
|
|
||||||
this.setResolution(width, height);
|
this.setResolution(width, height);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.ColorBars.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.ColorBars.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ Phaser.Filter.Fire = function (game) {
|
||||||
|
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1.0 }
|
this.uniforms.alpha = { type: '1f', value: 1.0 };
|
||||||
this.uniforms.shift = { type: '1f', value: 1.6 }
|
this.uniforms.shift = { type: '1f', value: 1.6 };
|
||||||
this.uniforms.speed = { type: '2f', value: { x: 0.7, y: 0.4 } };
|
this.uniforms.speed = { type: '2f', value: { x: 0.7, y: 0.4 } };
|
||||||
|
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
@ -73,7 +73,7 @@ Phaser.Filter.Fire.prototype.init = function (width, height, alpha, shift) {
|
||||||
this.uniforms.shift.value = shift;
|
this.uniforms.shift.value = shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.Fire.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.Fire.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ Phaser.Filter.HueRotate = function (game) {
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1.0 };
|
this.uniforms.alpha = { type: '1f', value: 1.0 };
|
||||||
this.uniforms.size = { type: '1f', value: 0.03 };
|
this.uniforms.size = { type: '1f', value: 0.03 };
|
||||||
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } }
|
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } };
|
||||||
|
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ Phaser.Filter.HueRotate.prototype.init = function (width, height, texture) {
|
||||||
|
|
||||||
this.uniforms.iChannel0.value = texture;
|
this.uniforms.iChannel0.value = texture;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.HueRotate.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.HueRotate.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@ Phaser.Filter.LightBeam = function (game) {
|
||||||
|
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1 }
|
this.uniforms.alpha = { type: '1f', value: 1 };
|
||||||
this.uniforms.thickness = { type: '1f', value: 70.0 }
|
this.uniforms.thickness = { type: '1f', value: 70.0 };
|
||||||
this.uniforms.speed = { type: '1f', value: 1.0 }
|
this.uniforms.speed = { type: '1f', value: 1.0 };
|
||||||
this.uniforms.red = { type: '1f', value: 2.0 }
|
this.uniforms.red = { type: '1f', value: 2.0 };
|
||||||
this.uniforms.green = { type: '1f', value: 1.0 }
|
this.uniforms.green = { type: '1f', value: 1.0 };
|
||||||
this.uniforms.blue = { type: '1f', value: 1.0 }
|
this.uniforms.blue = { type: '1f', value: 1.0 };
|
||||||
|
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ Phaser.Filter.LightBeam.prototype.init = function (width, height) {
|
||||||
|
|
||||||
this.setResolution(width, height);
|
this.setResolution(width, height);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.LightBeam.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.LightBeam.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@ Phaser.Filter.Marble = function (game) {
|
||||||
|
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1.0 }
|
this.uniforms.alpha = { type: '1f', value: 1.0 };
|
||||||
|
|
||||||
// Drives speed, higher number will make it slower.
|
// Drives speed, higher number will make it slower.
|
||||||
this.uniforms.fluid_speed = { type: '1f', value: 10.0 }
|
this.uniforms.fluid_speed = { type: '1f', value: 10.0 };
|
||||||
|
|
||||||
this.uniforms.color_intensity = { type: '1f', value: 0.30 }
|
this.uniforms.color_intensity = { type: '1f', value: 0.30 };
|
||||||
|
|
||||||
// The fragment shader source
|
// The fragment shader source
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
@ -69,7 +69,7 @@ Phaser.Filter.Marble.prototype.init = function (width, height, speed, intensity)
|
||||||
this.uniforms.fluid_speed.value = speed;
|
this.uniforms.fluid_speed.value = speed;
|
||||||
this.uniforms.color_intensity.value = intensity;
|
this.uniforms.color_intensity.value = intensity;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.Marble.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.Marble.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ Phaser.Filter.Plasma.prototype.init = function (width, height, alpha, size) {
|
||||||
this.uniforms.size.value = size;
|
this.uniforms.size.value = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.Plasma.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.Plasma.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Phaser.Filter.SampleFilter = function (game) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.uniforms.divisor = { type: '1f', value: 0.5 };
|
this.uniforms.divisor = { type: '1f', value: 0.5 };
|
||||||
|
|
||||||
// The fragment shader source
|
// The fragment shader source
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter;
|
||||||
|
|
||||||
Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) {
|
Phaser.Filter.SampleFilter.prototype.init = function (width, height, divisor) {
|
||||||
|
|
||||||
if (typeof divisor == 'undefined') { divisor = 0.5 };
|
if (typeof divisor == 'undefined') { divisor = 0.5; }
|
||||||
|
|
||||||
this.setResolution(width, height);
|
this.setResolution(width, height);
|
||||||
this.uniforms.divisor.value = divisor;
|
this.uniforms.divisor.value = divisor;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
|
@ -6,9 +6,9 @@ Phaser.Filter.Tunnel = function (game) {
|
||||||
|
|
||||||
Phaser.Filter.call(this, game);
|
Phaser.Filter.call(this, game);
|
||||||
|
|
||||||
this.uniforms.alpha = { type: '1f', value: 1 }
|
this.uniforms.alpha = { type: '1f', value: 1 };
|
||||||
this.uniforms.origin = { type: '1f', value: 2.0 }
|
this.uniforms.origin = { type: '1f', value: 2.0 };
|
||||||
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } }
|
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } };
|
||||||
|
|
||||||
this.fragmentSrc = [
|
this.fragmentSrc = [
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ Phaser.Filter.Tunnel.prototype.init = function (width, height, texture) {
|
||||||
|
|
||||||
texture.baseTexture._powerOf2 = true;
|
texture.baseTexture._powerOf2 = true;
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
Object.defineProperty(Phaser.Filter.Tunnel.prototype, 'alpha', {
|
Object.defineProperty(Phaser.Filter.Tunnel.prototype, 'alpha', {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue