Merge pull request #647 from xtian/grunt-jshint

Run jshint as part of build process and fix jshint errors
This commit is contained in:
Richard Davey 2014-03-26 15:46:35 +00:00
commit 06c953a293
165 changed files with 2156 additions and 2070 deletions

View file

@ -2,21 +2,8 @@
"globals" : { "Phaser": false, "PIXI": false, "p2": false },
// Ignore Environment Globals
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"couch" : false,
"dojo" : false,
"jquery" : true,
"mootools" : false,
"node" : false,
"nonstandard" : false,
"phantom" : false,
"prototypejs" : false,
"rhino" : false,
"worker" : false,
"wsh" : true, // Windows Scripting Host.
"yui" : false,
// Development
"debug" : true, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.
// ECMAScript Support
@ -26,7 +13,6 @@
"globalstrict": false, // Allow global "use strict" (also enables 'strict').
// Functionality
"asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons).
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"camelcase" : true, // Force all variable names to use either camelCase style or UPPER_CASE with underscores.
@ -38,30 +24,18 @@
"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" : false, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"iterator" : true, // This option suppresses warnings about the __iterator__ property.
"lastsemic" : true, // This option suppresses warnings about missing semicolons, but only when the semicolon is omitted for the last statement in a one-line block.
"latedef" : false, // Prohipit variable use before definition.
"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.
// "maxcomplexity" : 10, // This option lets you control cyclomatic complexity throughout your code.
// "maxdepth" : 2, // This option lets you control how nested do you want your blocks to be.
// "maxlen" : 80, // This option lets you set the maximum length of a line.
// "maxparams" : 5, // This option lets you set the max number of formal parameters allowed per function.
// "maxstatements" : 25, // This option lets you set the max number of statements allowed per function.This option lets you set the max number of formal parameters allowed per function.
"moz" : false, // This options tells JSHint that your code uses Mozilla JavaScript extensions.
"multistr" : true, // This option suppresses warnings about multi-line strings.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"notypeof" : false, // This option suppresses warnings about invalid typeof operator values.
"proto" : true, // This option suppresses warnings about the __proto__ property.
"scripturl" : true, // Tolerate script-targeted URLs.
"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.
"validthis" : true, // This option suppresses warnings about possible strict violations when the code is running in strict mode and you use this in a non-constructor function.
// Styling
"indent" : 4, // Specify indentation spacing

View file

@ -4,6 +4,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadTasks('./tasks');
@ -379,12 +380,43 @@ module.exports = function (grunt) {
hostname: '*'
}
}
}
},
jshint: {
src: {
src: [
'plugins/**/*.js',
'src/**/*.js',
'!src/Intro.js',
'!src/Outro.js',
'!src/pixi/**/*',
'!src/physics/p2/p2.js'
],
options: { jshintrc: '.jshintrc' }
},
filters: {
src: ['filters/**/*.js'],
options: { jshintrc: 'filters/.jshintrc', }
},
tooling: {
src: [
'Gruntfile.js',
'tasks/**/*.js'
],
options: { jshintrc: 'tasks/.jshintrc' }
},
options: {
force: true
}
}
});
grunt.registerTask('default', ['build']);
grunt.registerTask('build', ['clean', 'concat', 'uglify']);
grunt.registerTask('dist', ['clean', 'concat', 'uglify', 'copy']);
grunt.registerTask('build', ['clean', 'jshint', 'concat', 'uglify']);
grunt.registerTask('dist', ['build', 'copy']);
};

View file

@ -282,7 +282,7 @@ We now have a full [Contributors Guide][contribute] which goes into the process
- If you issue a Pull Request for Phaser, please only do so againt the `dev` branch and *not* against the `master` branch.
- Before submitting a Pull Request please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a strict requirement and we are happy to receive Pull Requests that haven't been JSHinted, so don't let it put you off contributing, but do know that we'll reformat your source before going live with it.
- Before submitting a Pull Request please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, run `grunt jshint`. This isn't a strict requirement and we are happy to receive Pull Requests that haven't been JSHinted, so don't let it put you off contributing, but do know that we'll reformat your source before going live with it.
Bugs?

49
filters/.jshintrc Normal file
View 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.
}

View file

@ -81,7 +81,7 @@ Phaser.Filter.BinarySerpents.prototype.init = function (width, height, march, ma
this.uniforms.march.value = march;
this.uniforms.maxDistance.value = maxDistance;
}
};
Object.defineProperty(Phaser.Filter.BinarySerpents.prototype, 'fog', {

View file

@ -53,9 +53,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter;
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.uniforms.divisor.value = divisor;
}
};

View file

@ -91,7 +91,7 @@ Phaser.Filter.CheckerWave = function (game) {
"gl_FragColor=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);
}
};
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.z = 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.z = blue;
}
};
Object.defineProperty(Phaser.Filter.CheckerWave.prototype, 'alpha', {

View file

@ -6,7 +6,7 @@ Phaser.Filter.ColorBars = function (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.fragmentSrc = [
@ -70,7 +70,7 @@ Phaser.Filter.ColorBars.prototype.init = function (width, height) {
this.setResolution(width, height);
}
};
Object.defineProperty(Phaser.Filter.ColorBars.prototype, 'alpha', {

View file

@ -6,8 +6,8 @@ Phaser.Filter.Fire = function (game) {
Phaser.Filter.call(this, game);
this.uniforms.alpha = { type: '1f', value: 1.0 }
this.uniforms.shift = { type: '1f', value: 1.6 }
this.uniforms.alpha = { type: '1f', value: 1.0 };
this.uniforms.shift = { type: '1f', value: 1.6 };
this.uniforms.speed = { type: '2f', value: { x: 0.7, y: 0.4 } };
this.fragmentSrc = [
@ -73,7 +73,7 @@ Phaser.Filter.Fire.prototype.init = function (width, height, alpha, shift) {
this.uniforms.shift.value = shift;
}
}
};
Object.defineProperty(Phaser.Filter.Fire.prototype, 'alpha', {

View file

@ -8,7 +8,7 @@ Phaser.Filter.HueRotate = function (game) {
this.uniforms.alpha = { type: '1f', value: 1.0 };
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 = [
@ -64,7 +64,7 @@ Phaser.Filter.HueRotate.prototype.init = function (width, height, texture) {
this.uniforms.iChannel0.value = texture;
}
};
Object.defineProperty(Phaser.Filter.HueRotate.prototype, 'alpha', {

View file

@ -6,12 +6,12 @@ Phaser.Filter.LightBeam = function (game) {
Phaser.Filter.call(this, game);
this.uniforms.alpha = { type: '1f', value: 1 }
this.uniforms.thickness = { type: '1f', value: 70.0 }
this.uniforms.speed = { type: '1f', value: 1.0 }
this.uniforms.red = { type: '1f', value: 2.0 }
this.uniforms.green = { type: '1f', value: 1.0 }
this.uniforms.blue = { type: '1f', value: 1.0 }
this.uniforms.alpha = { type: '1f', value: 1 };
this.uniforms.thickness = { type: '1f', value: 70.0 };
this.uniforms.speed = { type: '1f', value: 1.0 };
this.uniforms.red = { type: '1f', value: 2.0 };
this.uniforms.green = { type: '1f', value: 1.0 };
this.uniforms.blue = { type: '1f', value: 1.0 };
this.fragmentSrc = [
@ -55,7 +55,7 @@ Phaser.Filter.LightBeam.prototype.init = function (width, height) {
this.setResolution(width, height);
}
};
Object.defineProperty(Phaser.Filter.LightBeam.prototype, 'alpha', {

View file

@ -6,12 +6,12 @@ Phaser.Filter.Marble = function (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.
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
this.fragmentSrc = [
@ -69,7 +69,7 @@ Phaser.Filter.Marble.prototype.init = function (width, height, speed, intensity)
this.uniforms.fluid_speed.value = speed;
this.uniforms.color_intensity.value = intensity;
}
};
Object.defineProperty(Phaser.Filter.Marble.prototype, 'alpha', {

View file

@ -60,7 +60,7 @@ Phaser.Filter.Plasma.prototype.init = function (width, height, alpha, size) {
this.uniforms.size.value = size;
}
}
};
Object.defineProperty(Phaser.Filter.Plasma.prototype, 'alpha', {

View file

@ -43,9 +43,9 @@ Phaser.Filter.SampleFilter.prototype.constructor = Phaser.Filter.SampleFilter;
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.uniforms.divisor.value = divisor;
}
};

View file

@ -6,9 +6,9 @@ Phaser.Filter.Tunnel = function (game) {
Phaser.Filter.call(this, game);
this.uniforms.alpha = { type: '1f', value: 1 }
this.uniforms.origin = { type: '1f', value: 2.0 }
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } }
this.uniforms.alpha = { type: '1f', value: 1 };
this.uniforms.origin = { type: '1f', value: 2.0 };
this.uniforms.iChannel0 = { type: 'sampler2D', value: null, textureData: { repeat: true } };
this.fragmentSrc = [
@ -44,7 +44,7 @@ Phaser.Filter.Tunnel.prototype.init = function (width, height, texture) {
texture.baseTexture._powerOf2 = true;
}
};
Object.defineProperty(Phaser.Filter.Tunnel.prototype, 'alpha', {

View file

@ -31,6 +31,7 @@
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-uglify": "~0.3.3",
"lodash": "~2.2.1",
"grunt-text-replace": "~0.3.11"

View file

@ -1,3 +1,4 @@
/* jshint camelcase:false */
/**
* A collection of methods useful for manipulating and comparing colors.
*
@ -41,7 +42,7 @@ Phaser.Plugins.ColorHarmony.prototype = {
if (typeof threshold === "undefined") { threshold = 30; }
var hsv = Phaser.Color.RGBtoHSV(color);
if(threshold > 359 || threshold < 0) {
throw Error("Color Warning: Invalid threshold given to getAnalogousHarmony()");
throw new Error("Color Warning: Invalid threshold given to getAnalogousHarmony()");
}
var warmer = Phaser.Color.game.math.wrapValue(hsv.hue, 359 - threshold, 359);
var colder = Phaser.Color.game.math.wrapValue(hsv.hue, threshold, 359);
@ -69,7 +70,7 @@ Phaser.Plugins.ColorHarmony.prototype = {
if (typeof threshold === "undefined") { threshold = 30; }
var hsv = Phaser.Color.RGBtoHSV(color);
if(threshold >= 359 || threshold <= 0) {
throw Error("Phaser.Color Warning: Invalid threshold given to getSplitComplementHarmony()");
throw new Error("Phaser.Color Warning: Invalid threshold given to getSplitComplementHarmony()");
}
var opposite = Phaser.Color.game.math.wrapValue(hsv.hue, 180, 359);
var warmer = Phaser.Color.game.math.wrapValue(hsv.hue, opposite - threshold, 359);
@ -138,7 +139,7 @@ Phaser.Plugins.ColorHarmony.prototype = {
HSVtoRGB: function (h, s, v, alpha) {
if (typeof alpha === "undefined") { alpha = 255; }
var result;
if(s == 0.0) {
if(s === 0.0) {
result = Phaser.Color.getColor32(alpha, v * 255, v * 255, v * 255);
} else {
h = h / 60.0;
@ -191,7 +192,7 @@ Phaser.Plugins.ColorHarmony.prototype = {
var hue;
var saturation;
// Grey color, no chroma
if(delta == 0) {
if(delta === 0) {
hue = 0;
saturation = 0;
} else {
@ -228,4 +229,4 @@ Phaser.Plugins.ColorHarmony.prototype = {
};
}
}
};

View file

@ -1,3 +1,4 @@
/* jshint asi:true,camelcase:false,curly:false,indent:2,unused:false */
/*
amiga protracker module player for web audio api
(c) 2012-2013 firehawk/tda (firehawk@haxor.fi)
@ -69,14 +70,14 @@ function Protracker()
214,202,190,180,170,160,151,143,135,127,120,113);
// finetune multipliers
this.finetunetable=new Array();
this.finetunetable=[];
for(t=0;t<16;t++) this.finetunetable[t]=Math.pow(2, (t-8)/12/8);
// calc tables for vibrato waveforms
this.vibratotable=new Array();
this.vibratotable=[];
for(t=0;t<4;t++) {
this.vibratotable[t]=new Array();
for(i=0;i<64;i++) {
this.vibratotable[t]=[];
for(var i=0;i<64;i++) {
switch(t) {
case 0:
this.vibratotable[t][i]=127*Math.sin(Math.PI*2*(i/64));
@ -118,6 +119,8 @@ function Protracker()
// create the web audio context
Protracker.prototype.createContext = function()
{
/* global webkitAudioContext:false */
/* jshint newcap:false */
this.context = new webkitAudioContext();
this.samplerate=this.context.sampleRate;
this.bufferlen=(this.samplerate > 44100) ? 4096 : 2048;
@ -241,14 +244,14 @@ Protracker.prototype.clearsong = function()
this.songlen=1;
this.repeatpos=0;
this.patterntable=new ArrayBuffer(128);
for(i=0;i<128;i++) this.patterntable[i]=0;
for(var i=0;i<128;i++) this.patterntable[i]=0;
this.channels=4;
this.sample=new Array();
this.sample=[];
this.samples=31;
for(i=0;i<31;i++) {
this.sample[i]=new Object();
for(var i=0;i<31;i++) {
this.sample[i]={};
this.sample[i].name="";
this.sample[i].length=0;
this.sample[i].finetune=0;
@ -259,8 +262,8 @@ Protracker.prototype.clearsong = function()
}
this.patterns=0;
this.pattern=new Array();
this.note=new Array();
this.pattern=[];
this.note=[];
this.looprow=0;
this.loopstart=0;
@ -287,9 +290,9 @@ Protracker.prototype.initialize = function()
this.patterndelay=0;
this.patternwait=0;
this.channel=new Array();
for(i=0;i<this.channels;i++) {
this.channel[i]=new Object();
this.channel=[];
for(var i=0;i<this.channels;i++) {
this.channel[i]={};
this.channel[i].sample=0;
this.channel[i].period=214;
this.channel[i].voiceperiod=214;
@ -312,7 +315,7 @@ Protracker.prototype.initialize = function()
this.channel[i].vibratopos=0;
this.channel[i].vibratowave=0;
}
this.vu=new Array();
this.vu=[];
}
@ -346,7 +349,7 @@ Protracker.prototype.parse = function()
if (!this.buffer) return false;
for(i=0;i<4;i++) this.signature+=String.fromCharCode(this.buffer[1080+i]);
for(var i=0;i<4;i++) this.signature+=String.fromCharCode(this.buffer[1080+i]);
switch (this.signature) {
case "M.K.":
case "M!K!":
@ -370,14 +373,14 @@ Protracker.prototype.parse = function()
default:
return false;
}
this.vu=new Array();
for(i=0;i<this.channels;i++) this.vu[i]=0.0;
this.vu=[];
for(var i=0;i<this.channels;i++) this.vu[i]=0.0;
i=0;
while(this.buffer[i] && i<20)
this.title=this.title+String.fromCharCode(this.buffer[i++]);
for(i=0;i<this.samples;i++) {
for(var i=0;i<this.samples;i++) {
var st=20+i*30;
j=0;
while(this.buffer[st+j] && j<22) {
@ -402,29 +405,32 @@ Protracker.prototype.parse = function()
this.songlen=this.buffer[950];
if (this.buffer[951] != 127) this.repeatpos=this.buffer[951];
for(i=0;i<128;i++) {
for(var i=0;i<128;i++) {
this.patterntable[i]=this.buffer[952+i];
if (this.patterntable[i] > this.patterns) this.patterns=this.patterntable[i];
}
this.patterns+=1;
var patlen=4*64*this.channels;
this.pattern=new Array();
this.note=new Array();
for(i=0;i<this.patterns;i++) {
this.pattern=[];
this.note=[];
for(var i=0;i<this.patterns;i++) {
this.pattern[i]=new Uint8Array(patlen);
this.note[i]=new Uint8Array(this.channels*64);
for(j=0;j<patlen;j++) this.pattern[i][j]=this.buffer[1084+i*patlen+j];
for(j=0;j<64;j++) for(c=0;c<this.channels;c++) {
for(j=0;j<64;j++) {
for(c=0;c<this.channels;c++) {
this.note[i][j*this.channels+c]=0;
var n=(this.pattern[i][j*4*this.channels+c*4]&0x0f)<<8 | this.pattern[i][j*4*this.channels+c*4+1];
for(var np=0; np<this.baseperiodtable.length; np++)
for(var np=0; np<this.baseperiodtable.length; np++) {
if (n==this.baseperiodtable[np]) this.note[i][j*this.channels+c]=np;
}
}
}
}
var sst=1084+this.patterns*patlen;
for(i=0;i<this.samples;i++) {
for(var i=0;i<this.samples;i++) {
this.sample[i].data=new Float32Array(this.sample[i].length);
for(j=0;j<this.sample[i].length;j++) {
var q=this.buffer[sst+j];
@ -462,8 +468,10 @@ Protracker.prototype.advance=function(mod) {
if (mod.tick < ((mod.patternwait+1)*mod.speed)) {
mod.patternwait++;
} else {
mod.row++; mod.tick=0; mod.flags|=2; mod.patterndelay=0;
mod.row++;
mod.tick=0;
mod.flags|=2;
mod.patterndelay=0;
}
}
else {
@ -487,12 +495,18 @@ Protracker.prototype.advance=function(mod) {
}
mod.tick=0;
} else {
mod.row++; mod.tick=0; mod.flags|=2;
mod.row++;
mod.tick=0;
mod.flags|=2;
}
}
}
if (mod.row>=64) { mod.position++; mod.row=0; mod.flags|=4; }
if (mod.row>=64) {
mod.position++;
mod.row=0;
mod.flags|=4;
}
if (mod.position>=mod.songlen) {
if (mod.repeat) {
mod.position=0;
@ -510,7 +524,7 @@ Protracker.prototype.mix = function(ape) {
var f;
var p, pp, n, nn;
var mod=ape.srcElement.module;
outp=new Array();
var outp=[];
var bufs=new Array(ape.outputBuffer.getChannelData(0), ape.outputBuffer.getChannelData(1));
var buflen=ape.outputBuffer.length;
@ -530,7 +544,6 @@ Protracker.prototype.mix = function(ape) {
p=mod.patterntable[mod.position];
pp=mod.row*4*mod.channels + ch*4;
if (mod.flags&2) { // new row
modrow = mod.row; // here
mod.channel[ch].command=mod.pattern[p][pp+2]&0x0f;
mod.channel[ch].data=mod.pattern[p][pp+3];
@ -560,7 +573,7 @@ Protracker.prototype.mix = function(ape) {
}
}
mod.channel[ch].voiceperiod=mod.channel[ch].period;
if (mod.channel[ch].samplepos==0) modsample[ch]=mod.channel[ch].sample;
if (mod.channel[ch].samplepos===0) mod.sample[ch]=mod.channel[ch].sample;
// kill empty samples
@ -606,7 +619,7 @@ Protracker.prototype.mix = function(ape) {
outp[och]+=f;
mod.channel[ch].samplepos+=mod.channel[ch].samplespeed;
}
if (s==0) mod.vu[ch]=Math.abs(f);
if (s===0) mod.vu[ch]=Math.abs(f);
// loop or end samples
if (mod.channel[ch].noteon) {
@ -630,7 +643,7 @@ Protracker.prototype.mix = function(ape) {
// a more headphone-friendly stereo separation (aka. betterpaula)
if (mod.separation) {
t=outp[0];
var t=outp[0];
outp[0]=outp[0]*0.6 + outp[1]*0.4;
outp[1]=outp[1]*0.6 + t*0.4;
}
@ -764,7 +777,7 @@ Protracker.prototype.effect_t0_ed=function(mod, ch) { // ed delay sample
// start note
var p=mod.patterntable[mod.position];
var pp=mod.row*4*mod.channels + ch*4;
n=(mod.pattern[p][pp]&0x0f)<<8 | mod.pattern[p][pp+1];
var n=(mod.pattern[p][pp]&0x0f)<<8 | mod.pattern[p][pp+1];
if (n) {
mod.channel[ch].period=n;
mod.channel[ch].voiceperiod=mod.channel[ch].period;
@ -893,7 +906,7 @@ Protracker.prototype.effect_t1_e7=function(mod, ch) { // e7
Protracker.prototype.effect_t1_e8=function(mod, ch) { // e8
}
Protracker.prototype.effect_t1_e9=function(mod, ch) { // e9 retrig sample
if (mod.tick%(mod.channel[ch].data&0x0f)==0)
if (mod.tick%(mod.channel[ch].data&0x0f)===0)
mod.channel[ch].samplepos=0;
}
Protracker.prototype.effect_t1_ea=function(mod, ch) { // ea

View file

@ -1,3 +1,4 @@
/* global Phaser:true */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -74,7 +75,7 @@ var Phaser = Phaser || {
};
PIXI.InteractionManager = function (dummy) {
PIXI.InteractionManager = function () {
// We don't need this in Pixi, so we've removed it to save space
// however the Stage object expects a reference to it, so here is a dummy entry.
};

View file

@ -586,4 +586,4 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
return output;
}
};

View file

@ -313,7 +313,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this._onBoot = function () {
return _this.boot();
}
};
if (document.readyState === 'complete' || document.readyState === 'interactive')
{

View file

@ -210,7 +210,7 @@ Phaser.Group.prototype.add = function (child) {
return child;
}
};
/**
* Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
@ -247,7 +247,7 @@ Phaser.Group.prototype.addAt = function (child, index) {
return child;
}
};
/**
* Returns the child found at the given index within this Group.
@ -267,7 +267,7 @@ Phaser.Group.prototype.getAt = function (index) {
return this.getChildAt(index);
}
}
};
/**
* Automatically creates a new Phaser.Sprite object and adds it to the top of this Group.
@ -312,7 +312,7 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
return child;
}
};
/**
* Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group.
@ -334,7 +334,7 @@ Phaser.Group.prototype.createMultiple = function (quantity, key, frame, exists)
this.create(0, 0, key, frame, exists);
}
}
};
/**
* Internal method that re-applies all of the childrens Z values.
@ -351,7 +351,7 @@ Phaser.Group.prototype.updateZ = function () {
this.children[i].z = i;
}
}
};
/**
* Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object.
@ -375,7 +375,7 @@ Phaser.Group.prototype.next = function () {
this.cursor = this.children[this._cache[8]];
}
}
};
/**
* Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object.
@ -399,7 +399,7 @@ Phaser.Group.prototype.previous = function () {
this.cursor = this.children[this._cache[8]];
}
}
};
/**
* Swaps the position of two children in this Group. Both children must be in this Group.
@ -420,7 +420,7 @@ Phaser.Group.prototype.swap = function (child1, child2) {
return result;
}
};
/**
* Brings the given child to the top of this Group so it renders above all other children.
@ -439,7 +439,7 @@ Phaser.Group.prototype.bringToTop = function (child) {
return child;
}
};
/**
* Sends the given child to the bottom of this Group so it renders below all other children.
@ -458,7 +458,7 @@ Phaser.Group.prototype.sendToBack = function (child) {
return child;
}
};
/**
* Moves the given child up one place in this Group unless it's already at the top.
@ -482,7 +482,7 @@ Phaser.Group.prototype.moveUp = function (child) {
return child;
}
};
/**
* Moves the given child down one place in this Group unless it's already at the top.
@ -506,7 +506,7 @@ Phaser.Group.prototype.moveDown = function (child) {
return child;
}
};
/**
* Positions the child found at the given index within this Group to the given x and y coordinates.
@ -528,7 +528,7 @@ Phaser.Group.prototype.xy = function (index, x, y) {
this.getChildAt(index).y = y;
}
}
};
/**
* Reverses all children in this Group. Note that this does not propagate, only direct children are re-ordered.
@ -540,7 +540,7 @@ Phaser.Group.prototype.reverse = function () {
this.children.reverse();
this.updateZ();
}
};
/**
* Get the index position of the given child in this Group. This should always match the childs z property.
@ -553,7 +553,7 @@ Phaser.Group.prototype.getIndex = function (child) {
return this.children.indexOf(child);
}
};
/**
* Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.
@ -589,7 +589,7 @@ Phaser.Group.prototype.replace = function (oldChild, newChild) {
return temp;
}
}
};
/**
* Sets the given property to the given value on the child. The operation controls the assignment of the value.
@ -649,7 +649,7 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation) {
else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
}
}
};
/**
* This function allows you to quickly set a property on a single child of this Group to a new value.
@ -675,7 +675,7 @@ Phaser.Group.prototype.set = function (child, key, value, checkAlive, checkVisib
this.setProperty(child, key, value, operation);
}
}
};
/**
* This function allows you to quickly set the same property across all children of this Group to a new value.
@ -708,7 +708,7 @@ Phaser.Group.prototype.setAll = function (key, value, checkAlive, checkVisible,
}
}
}
};
/**
* This function allows you to quickly set the same property across all children of this Group, and any child Groups, to a new value.
@ -747,7 +747,7 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
}
}
}
};
/**
* Adds the amount to the given property on all children in this Group.
@ -763,7 +763,7 @@ Phaser.Group.prototype.addAll = function (property, amount, checkAlive, checkVis
this.setAll(property, amount, checkAlive, checkVisible, 1);
}
};
/**
* Subtracts the amount from the given property on all children in this Group.
@ -779,7 +779,7 @@ Phaser.Group.prototype.subAll = function (property, amount, checkAlive, checkVis
this.setAll(property, amount, checkAlive, checkVisible, 2);
}
};
/**
* Multiplies the given property by the amount on all children in this Group.
@ -795,7 +795,7 @@ Phaser.Group.prototype.multiplyAll = function (property, amount, checkAlive, che
this.setAll(property, amount, checkAlive, checkVisible, 3);
}
};
/**
* Divides the given property by the amount on all children in this Group.
@ -811,7 +811,7 @@ Phaser.Group.prototype.divideAll = function (property, amount, checkAlive, check
this.setAll(property, amount, checkAlive, checkVisible, 4);
}
};
/**
* Calls a function on all of the children that have exists=true in this Group.
@ -834,7 +834,7 @@ Phaser.Group.prototype.callAllExists = function (callback, existsValue) {
}
}
}
};
/**
* Returns a reference to a function that exists on a child of the Group based on the given callback array.
@ -887,7 +887,7 @@ Phaser.Group.prototype.callbackFromArray = function (child, callback, length) {
return false;
}
};
/**
* Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that)
@ -947,7 +947,7 @@ Phaser.Group.prototype.callAll = function (method, context) {
}
}
}
};
/**
* The core preUpdate - as called by World.
@ -971,7 +971,7 @@ Phaser.Group.prototype.preUpdate = function () {
return true;
}
};
/**
* The core update - as called by World.
@ -987,7 +987,7 @@ Phaser.Group.prototype.update = function () {
this.children[i].update();
}
}
};
/**
* The core postUpdate - as called by World.
@ -1010,7 +1010,7 @@ Phaser.Group.prototype.postUpdate = function () {
this.children[i].postUpdate();
}
}
};
/**
* Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
@ -1039,7 +1039,7 @@ Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExist
}
}
}
};
/**
* Allows you to call your own function on each member of this Group where child.exists=true. You must pass the callback and context in which it will run.
@ -1057,7 +1057,7 @@ Phaser.Group.prototype.forEachExists = function (callback, callbackContext) {
this.iterate('exists', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
}
};
/**
* Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run.
@ -1075,7 +1075,7 @@ Phaser.Group.prototype.forEachAlive = function (callback, callbackContext) {
this.iterate('alive', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
}
};
/**
* Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run.
@ -1093,7 +1093,7 @@ Phaser.Group.prototype.forEachDead = function (callback, callbackContext) {
this.iterate('alive', false, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args);
}
};
/**
* Call this function to sort the group according to a particular value and order.
@ -1127,7 +1127,7 @@ Phaser.Group.prototype.sort = function (index, order) {
this.updateZ();
}
};
/**
* An internal helper function for the sort process.
@ -1158,7 +1158,7 @@ Phaser.Group.prototype.ascendingSortHandler = function (a, b) {
}
}
}
};
/**
* An internal helper function for the sort process.
@ -1182,7 +1182,7 @@ Phaser.Group.prototype.descendingSortHandler = function (a, b) {
return 0;
}
}
};
/**
* Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match.
@ -1239,7 +1239,7 @@ Phaser.Group.prototype.iterate = function (key, value, returnType, callback, cal
return null;
}
}
};
/**
* Call this function to retrieve the first object with exists == (the given state) in the Group.
@ -1257,7 +1257,7 @@ Phaser.Group.prototype.getFirstExists = function (state) {
return this.iterate('exists', state, Phaser.Group.RETURN_CHILD);
}
};
/**
* Call this function to retrieve the first object with alive === true in the group.
@ -1270,7 +1270,7 @@ Phaser.Group.prototype.getFirstAlive = function () {
return this.iterate('alive', true, Phaser.Group.RETURN_CHILD);
}
};
/**
* Call this function to retrieve the first object with alive === false in the group.
@ -1283,7 +1283,7 @@ Phaser.Group.prototype.getFirstDead = function () {
return this.iterate('alive', false, Phaser.Group.RETURN_CHILD);
}
};
/**
* Returns the child at the top of this Group. The top is the one being displayed (rendered) above every other child.
@ -1298,7 +1298,7 @@ Phaser.Group.prototype.getTop = function () {
return this.children[this.children.length - 1];
}
}
};
/**
* Returns the child at the bottom of this Group. The bottom is the one being displayed (rendered) below every other child.
@ -1313,7 +1313,7 @@ Phaser.Group.prototype.getBottom = function () {
return this.children[0];
}
}
};
/**
* Call this function to find out how many members of the group are alive.
@ -1325,7 +1325,7 @@ Phaser.Group.prototype.countLiving = function () {
return this.iterate('alive', true, Phaser.Group.RETURN_TOTAL);
}
};
/**
* Call this function to find out how many members of the group are dead.
@ -1337,7 +1337,7 @@ Phaser.Group.prototype.countDead = function () {
return this.iterate('alive', false, Phaser.Group.RETURN_TOTAL);
}
};
/**
* Returns a member at random from the group.
@ -1359,7 +1359,7 @@ Phaser.Group.prototype.getRandom = function (startIndex, length) {
return this.game.math.getRandom(this.children, startIndex, length);
}
};
/**
* Removes the given child from this Group and sets its group property to null.
@ -1391,7 +1391,7 @@ Phaser.Group.prototype.remove = function (child) {
return true;
}
};
/**
* Removes all children from this Group, setting all group properties to null.
@ -1419,7 +1419,7 @@ Phaser.Group.prototype.removeAll = function () {
this.cursor = null;
}
};
/**
* Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.
@ -1457,7 +1457,7 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) {
this.updateZ();
}
};
/**
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
@ -1503,7 +1503,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
this.exists = false;
}
}
};
/**
* @name Phaser.Group#total

View file

@ -147,7 +147,7 @@ Phaser.LinkedList.prototype = {
entity = entity.next;
}
while(entity != this.last.next)
while(entity != this.last.next);
}

View file

@ -756,7 +756,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isFullScreen", {
get: function () {
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement'])
return (document['fullscreenElement'] || document['mozFullScreenElement'] || document['webkitFullscreenElement']);
}

View file

@ -111,7 +111,7 @@ Phaser.Stage.prototype.preUpdate = function () {
this.children[i].preUpdate();
}
}
};
/**
* This is called automatically after the State.update, but before particles or plugins update.
@ -127,7 +127,7 @@ Phaser.Stage.prototype.update = function () {
this.children[i].update();
}
}
};
/**
* This is called automatically before the renderer runs and after the plugins have updated.
@ -176,7 +176,7 @@ Phaser.Stage.prototype.postUpdate = function () {
}
}
}
};
/**
* Parses a Game configuration object.
@ -229,7 +229,7 @@ Phaser.Stage.prototype.parseConfig = function (config) {
this.backgroundColor = config['backgroundColor'];
}
}
};
/**
* Initialises the stage and adds the event listeners.
@ -246,14 +246,14 @@ Phaser.Stage.prototype.boot = function () {
this._onChange = function (event) {
return _this.visibilityChange(event);
}
};
Phaser.Canvas.setUserSelect(this.game.canvas, 'none');
Phaser.Canvas.setTouchAction(this.game.canvas, 'none');
this.checkVisibility();
}
};
/**
* Starts a page visibility event listener running, or window.blur/focus if not supported by the browser.
@ -294,7 +294,7 @@ Phaser.Stage.prototype.checkVisibility = function () {
window.onblur = this._onChange;
window.onfocus = this._onChange;
}
};
/**
* This method is called when the document visibility is changed.
@ -331,7 +331,7 @@ Phaser.Stage.prototype.visibilityChange = function (event) {
this.game.gameResumed(event);
}
}
};
/**
* Sets the background color for the stage.
@ -346,7 +346,7 @@ Phaser.Stage.prototype.setBackgroundColor = function(backgroundColor)
var hex = this._backgroundColor.toString(16);
hex = '000000'.substr(0, 6 - hex.length) + hex;
this.backgroundColorString = '#' + hex;
}
};
/**
* @name Phaser.Stage#backgroundColor

View file

@ -34,7 +34,7 @@ Phaser.World = function (game) {
*/
this.camera = null;
}
};
Phaser.World.prototype = Object.create(Phaser.Group.prototype);
Phaser.World.prototype.constructor = Phaser.World;
@ -57,7 +57,7 @@ Phaser.World.prototype.boot = function () {
this.game.stage.addChild(this);
}
};
/**
* Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
@ -90,7 +90,7 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
this.game.physics.setBoundsToWorld();
}
};
/**
* Destroyer of worlds.
@ -102,7 +102,7 @@ Phaser.World.prototype.shutdown = function () {
// World is a Group, so run a soft destruction on this and all children.
this.destroy(true, true);
}
};
/**
* @name Phaser.World#width

View file

@ -106,7 +106,7 @@ Phaser.BitmapData = function (game, key, width, height) {
*/
this.dirty = false;
}
};
Phaser.BitmapData.prototype = {

View file

@ -177,7 +177,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
return true;
}
};
/**
* Override and use this function in your own custom objects to handle any update requirements you may have.
@ -186,7 +186,7 @@ Phaser.BitmapText.prototype.preUpdate = function () {
*/
Phaser.BitmapText.prototype.update = function() {
}
};
/**
* Automatically called by World.postUpdate.
@ -201,7 +201,7 @@ Phaser.BitmapText.prototype.postUpdate = function () {
this.position.y = (this.game.camera.view.y + this.cameraOffset.y) / this.game.camera.scale.y;
}
}
};
/**
* Destroy this BitmapText instance. This will remove any filters and un-parent any children.
@ -257,7 +257,7 @@ Phaser.BitmapText.prototype.destroy = function(destroyChildren) {
this.mask = null;
this.game = null;
}
};
/**
* @name Phaser.BitmapText#align

View file

@ -222,7 +222,7 @@ Phaser.Button.prototype.clearFrames = function () {
this._onUpFrameName = null;
this._onUpFrameID = null;
}
};
/**
* Used to manually set the frames that will be used for the different states of the Button.
@ -349,7 +349,7 @@ Phaser.Button.prototype.setSounds = function (overSound, overMarker, downSound,
this.setDownSound(downSound, downMarker);
this.setUpSound(upSound, upMarker);
}
};
/**
* The Sound to be played when a Pointer moves over this Button.
@ -373,7 +373,7 @@ Phaser.Button.prototype.setOverSound = function (sound, marker) {
this.onOverSoundMarker = marker;
}
}
};
/**
* The Sound to be played when a Pointer moves out of this Button.
@ -397,7 +397,7 @@ Phaser.Button.prototype.setOutSound = function (sound, marker) {
this.onOutSoundMarker = marker;
}
}
};
/**
* The Sound to be played when a Pointer presses down on this Button.
@ -421,7 +421,7 @@ Phaser.Button.prototype.setDownSound = function (sound, marker) {
this.onDownSoundMarker = marker;
}
}
};
/**
* The Sound to be played when a Pointer has pressed down and is released from this Button.
@ -445,7 +445,7 @@ Phaser.Button.prototype.setUpSound = function (sound, marker) {
this.onUpSoundMarker = marker;
}
}
};
/**
* Internal function that handles input events.

View file

@ -112,7 +112,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
return true;
}
};
/**
* Override and use this function in your own custom objects to handle any update requirements you may have.
@ -122,7 +122,7 @@ Phaser.Graphics.prototype.preUpdate = function () {
*/
Phaser.Graphics.prototype.update = function() {
}
};
/**
* Automatically called by World.postUpdate.
@ -137,7 +137,7 @@ Phaser.Graphics.prototype.postUpdate = function () {
this.position.y = (this.game.camera.view.y + this.cameraOffset.y) / this.game.camera.scale.y;
}
}
};
/**
* Destroy this Graphics instance.
@ -185,7 +185,7 @@ Phaser.Graphics.prototype.destroy = function(destroyChildren) {
this.game = null;
}
};
/*
* Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled
@ -203,7 +203,7 @@ Phaser.Graphics.prototype.drawPolygon = function (poly) {
this.lineTo(poly.points[0].x, poly.points[0].y);
}
};
/**
* Indicates the rotation of the Graphics, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.

View file

@ -164,7 +164,7 @@ Phaser.Image.prototype.preUpdate = function() {
return true;
}
};
/**
* Override and use this function in your own custom objects to handle any update requirements you may have.
@ -174,7 +174,7 @@ Phaser.Image.prototype.preUpdate = function() {
*/
Phaser.Image.prototype.update = function() {
}
};
/**
* Internal function called by the World postUpdate cycle.
@ -202,7 +202,7 @@ Phaser.Image.prototype.postUpdate = function() {
this.children[i].postUpdate();
}
}
};
/**
* Changes the Texture the Image is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache.
@ -279,7 +279,7 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
}
}
}
};
/**
* Crop allows you to crop the texture used to display this Image.
@ -326,7 +326,7 @@ Phaser.Image.prototype.crop = function(rect) {
}
}
}
};
/**
* Brings a 'dead' Image back to life, optionally giving it the health value specified.
@ -350,7 +350,7 @@ Phaser.Image.prototype.revive = function() {
return this;
}
};
/**
* Kills a Image. A killed Image has its alive, exists and visible properties all set to false.
@ -375,7 +375,7 @@ Phaser.Image.prototype.kill = function() {
return this;
}
};
/**
* Destroys the Image. This removes it from its parent group, destroys the input, event and animation handlers if present
@ -438,7 +438,7 @@ Phaser.Image.prototype.destroy = function(destroyChildren) {
this.mask = null;
this.game = null;
}
};
/**
* Resets the Image. This places the Image at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true.
@ -461,7 +461,7 @@ Phaser.Image.prototype.reset = function(x, y) {
return this;
}
};
/**
* Brings the Image to the top of the display list it is a child of. Images that are members of a Phaser.Group are only
@ -480,7 +480,7 @@ Phaser.Image.prototype.bringToTop = function() {
return this;
}
};
/**
* Indicates the rotation of the Image, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.

View file

@ -58,7 +58,7 @@ Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear)
this.render(displayObject, this._temp, clear);
}
};
// Documentation stubs

View file

@ -274,7 +274,7 @@ Phaser.RetroFont.prototype.setFixedWidth = function (width, lineAlignment) {
this.fixedWidth = width;
this.align = lineAlignment;
}
};
/**
* A helper function that quickly sets lots of variables at once, and then updates the text.
@ -309,7 +309,7 @@ Phaser.RetroFont.prototype.setText = function (content, multiLine, characterSpac
this.text = content;
}
}
};
/**
* Over rides the default PIXI.RenderTexture resize event as we need our baseTexture resized as well.
@ -344,7 +344,7 @@ Phaser.RetroFont.prototype.resize = function (width, height) {
PIXI.Texture.frameUpdates.push(this);
}
};
/**
* Updates the BitmapData of the Sprite with the text
@ -435,7 +435,7 @@ Phaser.RetroFont.prototype.buildRetroFontText = function () {
this.pasteLine(this._text, cx, 0, this.customSpacingX);
}
}
};
/**
* Internal function that takes a single line of text (2nd parameter) and pastes it into the BitmapData at the given coordinates.
@ -477,7 +477,7 @@ Phaser.RetroFont.prototype.pasteLine = function (line, x, y, customSpacingX) {
}
}
}
}
};
/**
* Works out the longest line of text in _text and returns its length
@ -504,7 +504,7 @@ Phaser.RetroFont.prototype.getLongestLine = function () {
}
return longestLine;
}
};
/**
* Internal helper function that removes all unsupported characters from the _text String, leaving only characters contained in the font set.
@ -531,7 +531,7 @@ Phaser.RetroFont.prototype.removeUnsupportedCharacters = function (stripCR) {
}
return newString;
}
};
/**
* @name Phaser.BitmapText#text

View file

@ -175,7 +175,7 @@ Phaser.Text.prototype.preUpdate = function () {
return true;
}
};
/**
* Override and use this function in your own custom objects to handle any update requirements you may have.
@ -185,7 +185,7 @@ Phaser.Text.prototype.preUpdate = function () {
*/
Phaser.Text.prototype.update = function() {
}
};
/**
* Automatically called by World.postUpdate.
@ -205,7 +205,7 @@ Phaser.Text.prototype.postUpdate = function () {
this.children[i].postUpdate();
}
}
};
/**
* @method Phaser.Text.prototype.destroy
@ -265,7 +265,7 @@ Phaser.Text.prototype.destroy = function (destroyChildren) {
this.mask = null;
this.game = null;
}
};
/**
* @method Phaser.Text.prototype.setShadow
@ -282,7 +282,7 @@ Phaser.Text.prototype.setShadow = function (x, y, color, blur) {
this.style.shadowBlur = blur || 0;
this.dirty = true;
}
};
/**
* Set the style of the text by passing a single style object to it.
@ -315,7 +315,7 @@ Phaser.Text.prototype.setStyle = function (style) {
this.style = style;
this.dirty = true;
}
};
/**
* Renders text. This replaces the Pixi.Text.updateText function as we need a few extra bits in here.
@ -404,7 +404,7 @@ Phaser.Text.prototype.updateText = function () {
}
this.updateTexture();
}
};
/**
* Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds.
@ -452,7 +452,7 @@ Phaser.Text.prototype.runWordWrap = function (text) {
return result;
}
};
/**
* Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.

View file

@ -253,7 +253,7 @@ Phaser.TileSprite.prototype.preUpdate = function() {
return true;
}
};
/**
* Override and use this function in your own custom objects to handle any update requirements you may have.
@ -263,7 +263,7 @@ Phaser.TileSprite.prototype.preUpdate = function() {
*/
Phaser.TileSprite.prototype.update = function() {
}
};
/**
* Internal function called by the World postUpdate cycle.
@ -291,7 +291,7 @@ Phaser.TileSprite.prototype.postUpdate = function() {
this.children[i].postUpdate();
}
}
};
/**
* Sets this TileSprite to automatically scroll in the given direction until stopped via TileSprite.stopScroll().
@ -306,7 +306,7 @@ Phaser.TileSprite.prototype.autoScroll = function(x, y) {
this._scroll.set(x, y);
}
};
/**
* Stops an automatically scrolling TileSprite.
@ -318,7 +318,7 @@ Phaser.TileSprite.prototype.stopScroll = function() {
this._scroll.set(0, 0);
}
};
/**
* Changes the Texture the TileSprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache.
@ -390,7 +390,7 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
}
}
}
};
/**
* Destroys the TileSprite. This removes it from its parent group, destroys the event and animation handlers if present
@ -451,7 +451,7 @@ Phaser.TileSprite.prototype.destroy = function(destroyChildren) {
this.mask = null;
this.game = null;
}
};
/**
* Play an animation based on the given key. The animation should previously have been added via sprite.animations.add()
@ -469,7 +469,7 @@ Phaser.TileSprite.prototype.play = function (name, frameRate, loop, killOnComple
return this.animations.play(name, frameRate, loop, killOnComplete);
}
};
/**
* Resets the TileSprite. This places the TileSprite at the given x/y world coordinates, resets the tilePosition and then

View file

@ -119,7 +119,7 @@ Phaser.Circle.prototype = {
*/
distance: function (dest, round) {
if (typeof round === "undefined") { round = false }
if (typeof round === "undefined") { round = false; }
if (round)
{

View file

@ -411,7 +411,7 @@ Phaser.Point.equals = function (a, b) {
*/
Phaser.Point.distance = function (a, b, round) {
if (typeof round === "undefined") { round = false }
if (typeof round === "undefined") { round = false; }
if (round)
{

View file

@ -146,7 +146,7 @@ Phaser.Keyboard.prototype = {
down: this.addKey(Phaser.Keyboard.DOWN),
left: this.addKey(Phaser.Keyboard.LEFT),
right: this.addKey(Phaser.Keyboard.RIGHT)
}
};
},

View file

@ -378,7 +378,7 @@ Phaser.Pointer.prototype = {
}
currentNode = currentNode.next;
}
while (currentNode != null)
while (currentNode != null);
}
if (this._highestRenderObject === null)
@ -508,7 +508,7 @@ Phaser.Pointer.prototype = {
currentNode = currentNode.next;
}
while (currentNode != null)
while (currentNode != null);
}
if (this.targetObject)

View file

@ -1,3 +1,4 @@
/* jshint wsh:true */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -1163,11 +1164,11 @@ Phaser.Loader.prototype = {
if (file.autoDecode)
{
this.game.cache.updateSound(key, 'isDecoding', true);
var that = this;
var key = file.key;
this.game.cache.updateSound(key, 'isDecoding', true);
this.game.sound.context.decodeAudioData(file.data, function (buffer) {
if (buffer)
{

View file

@ -1311,7 +1311,7 @@ Phaser.Math = {
* @method Phaser.Math#degToRad
* @return {function}
*/
degToRad: function() {
degToRad: (function() {
var degreeToRadiansFactor = Math.PI / 180;
@ -1321,7 +1321,7 @@ Phaser.Math = {
};
}(),
}()),
/**
* Convert degrees to radians.
@ -1329,7 +1329,7 @@ Phaser.Math = {
* @method Phaser.Math#radToDeg
* @return {function}
*/
radToDeg: function() {
radToDeg: (function() {
var radianToDegreesFactor = 180 / Math.PI;
@ -1339,6 +1339,6 @@ Phaser.Math = {
};
}()
}())
};

View file

@ -1 +1 @@
Phaser.Particles.Arcade = {}
Phaser.Particles.Arcade = {};

View file

@ -245,7 +245,7 @@ Phaser.Particles.Arcade.Emitter.prototype.update = function () {
}
}
}
};
/**
* This function generates a new array of particle sprites to attach to the emitter.
@ -312,7 +312,7 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
return this;
}
};
/**
* Call this function to turn off all the particles and the emitter.
@ -324,7 +324,7 @@ Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
this.alive = false;
this.exists = false;
}
};
/**
* Handy for bringing game objects "back to life". Just sets alive and exists back to true.
@ -335,7 +335,7 @@ Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
this.alive = true;
this.exists = true;
}
};
/**
* Call this function to start emitting particles.
@ -373,7 +373,7 @@ Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, f
this._counter = 0;
this._timer = this.game.time.now + frequency;
}
};
/**
* This function can be used both internally and externally to emit the next particle.
@ -450,7 +450,7 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
particle.body.drag.y = this.particleDrag.y;
particle.body.angularDrag = this.angularDrag;
}
};
/**
* A more compact way of setting the width and height of the emitter.
@ -463,7 +463,7 @@ Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
this.width = width;
this.height = height;
}
};
/**
* A more compact way of setting the X velocity range of the emitter.
@ -479,7 +479,7 @@ Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
this.minParticleSpeed.x = min;
this.maxParticleSpeed.x = max;
}
};
/**
* A more compact way of setting the Y velocity range of the emitter.
@ -495,7 +495,7 @@ Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
this.minParticleSpeed.y = min;
this.maxParticleSpeed.y = max;
}
};
/**
* A more compact way of setting the angular velocity constraints of the emitter.
@ -511,7 +511,7 @@ Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
this.minRotation = min;
this.maxRotation = max;
}
};
/**
* Change the emitters center to match the center of any object with a `center` property, such as a Sprite.
@ -526,7 +526,7 @@ Phaser.Particles.Arcade.Emitter.prototype.at = function (object) {
this.emitY = object.center.y;
}
}
};
/**
* @name Phaser.Particles.Arcade.Emitter#x

View file

@ -146,11 +146,11 @@ Phaser.Physics.prototype = {
}
else if (system === Phaser.Physics.BOX2D && this.box2d === null)
{
// Coming soon
throw new Error('The Box2D physics system has not been implemented yet.');
}
else if (system === Phaser.Physics.CHIPMUNK && this.chipmunk === null)
{
// Coming soon
throw new Error('The Chipmunk physics system has not been implemented yet.');
}
},

View file

@ -755,7 +755,7 @@ Phaser.Physics.Arcade.Body.render = function (context, body, filled, color) {
context.strokeRect(body.position.x - body.game.camera.x, body.position.y - body.game.camera.y, body.width, body.height);
}
}
};
/**
* Render Sprite Body Physics Data as text.
@ -776,6 +776,6 @@ Phaser.Physics.Arcade.Body.renderBodyInfo = function (debug, body) {
debug.line('touching left: ' + body.touching.left, 'right: ' + body.touching.right, 'up: ' + body.touching.up, 'down: ' + body.touching.down);
debug.line('blocked left: ' + body.blocked.left, 'right: ' + body.blocked.right, 'up: ' + body.blocked.up, 'down: ' + body.blocked.down);
}
};
Phaser.Physics.Arcade.Body.prototype.constructor = Phaser.Physics.Arcade.Body;

View file

@ -1289,7 +1289,7 @@ Phaser.Physics.Arcade.prototype = {
* @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
* @param {number} y - The y separation amount.
*/
processTileSeparationY: function (body, y, tile) {
processTileSeparationY: function (body, y) {
if (y < 0)
{

View file

@ -1,3 +1,4 @@
/* jshint camelcase: false */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -135,7 +136,7 @@ Phaser.Physics.Ninja.AABB.prototype = {
* @param {number} dy - Collision normal
* @param {number} obj - Object this AABB collided with
*/
reportCollisionVsWorld: function (px, py, dx, dy, obj) {
reportCollisionVsWorld: function (px, py, dx, dy) {
var p = this.pos;
var o = this.oldpos;
@ -244,16 +245,6 @@ Phaser.Physics.Ninja.AABB.prototype = {
var vx1 = this.pos.x - this.oldpos.x; // Calc velocity of this object
var vy1 = this.pos.y - this.oldpos.y;
var dp1 = (vx1 * dx + vy1 * dy); // Find component of velocity parallel to collision normal
var nx1 = dp1 * dx; // Project velocity onto collision normal
var ny1 = dp1 * dy; // nx, ny is normal velocity
var dx2 = dx * -1;
var dy2 = dy * -1;
var vx2 = obj.pos.x - obj.oldpos.x; // Calc velocity of colliding object
var vy2 = obj.pos.y - obj.oldpos.y;
var dp2 = (vx2 * dx2 + vy2 * dy2); // Find component of velocity parallel to collision normal
var nx2 = dp2 * dx2; // Project velocity onto collision normal
var ny2 = dp2 * dy2; // nx, ny is normal velocity
// We only want to apply collision response forces if the object is travelling into, and not out of, the collision
if (this.body.immovable && obj.body.immovable)
@ -1014,4 +1005,4 @@ Phaser.Physics.Ninja.AABB.prototype = {
this.system = null;
}
}
};

View file

@ -1,3 +1,4 @@
/* jshint camelcase: false */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -99,7 +100,7 @@ Phaser.Physics.Ninja.Circle = function (body, x, y, radius) {
this.circleTileProjections[Phaser.Physics.Ninja.Tile.TYPE_67DEGb] = this.projCircle_67DegB;
this.circleTileProjections[Phaser.Physics.Ninja.Tile.TYPE_HALF] = this.projCircle_Half;
}
};
Phaser.Physics.Ninja.Circle.prototype.constructor = Phaser.Physics.Ninja.Circle;
@ -139,7 +140,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
* @param {number} dy - Collision normal
* @param {number} obj - Object this Circle collided with
*/
reportCollisionVsWorld: function (px, py, dx, dy, obj) {
reportCollisionVsWorld: function (px, py, dx, dy) {
var p = this.pos;
var o = this.oldpos;
@ -352,9 +353,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
//if we're colliding vs. horiz. or vert. neighb, we simply project horiz/vert
//if we're colliding diagonally, we need to collide vs. tile corner
if (oH == 0)
if (oH === 0)
{
if (oV == 0)
if (oV === 0)
{
//collision with current cell
if (x < y)
@ -362,7 +363,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
//penetration in x is smaller; project in x
var dx = obj.pos.x - t.pos.x;//get sign for projection along x-axis
//NOTE: should we handle the delta == 0 case?! and how? (project towards oldpos?)
//NOTE: should we handle the delta === 0 case?! and how? (project towards oldpos?)
if (dx < 0)
{
obj.reportCollisionVsWorld(-x, 0, -1, 0, t);
@ -379,7 +380,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
//penetration in y is smaller; project in y
var dy = obj.pos.y - t.pos.y;//get sign for projection along y-axis
//NOTE: should we handle the delta == 0 case?! and how? (project towards oldpos?)
//NOTE: should we handle the delta === 0 case?! and how? (project towards oldpos?)
if (dy < 0)
{
obj.reportCollisionVsWorld(0, -y, 0, -1, t);
@ -400,7 +401,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
return Phaser.Physics.Ninja.Circle.COL_AXIS;
}
}
else if (oV == 0)
else if (oV === 0)
{
//collision with horizontal neighbor
obj.reportCollisionVsWorld(x * oH, 0, oH, 0, t);
@ -423,7 +424,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -470,9 +471,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
var signy = t.signy;
var lenP;
if (oH == 0)
if (oH === 0)
{
if (oV == 0)
if (oV === 0)
{
//colliding with current tile
@ -599,7 +600,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if (oV == 0)
else if (oV === 0)
{
//colliding horizontally
if ((signx * oH) < 0)
@ -692,7 +693,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -740,9 +741,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
var signy = t.signy;
var lenP;
if (oH == 0)
if (oH === 0)
{
if (oV == 0)
if (oV === 0)
{
//colliding with current tile
@ -836,7 +837,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out vertically
dx = 0;
@ -855,7 +856,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if (oV == 0)
else if (oV === 0)
{
//colliding horizontally
if ((signx * oH) < 0)
@ -881,7 +882,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out horizontally
dx = oH;
@ -924,7 +925,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -974,9 +975,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
var signy = t.signy;
var lenP;
if (oH == 0)
if (oH === 0)
{
if (oV == 0)
if (oV === 0)
{
//colliding with current tile
@ -1028,7 +1029,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
else
{
//note: len should NEVER be == 0, because if it is,
//note: len should NEVER be === 0, because if it is,
//projeciton by an axis shoudl always be shorter, and we should
//never arrive here
ox /= len;
@ -1069,7 +1070,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//note: len should NEVER be == 0, because if it is,
//note: len should NEVER be === 0, because if it is,
//obj is not in a neighboring cell!
ox /= len;
oy /= len;
@ -1081,7 +1082,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if (oV == 0)
else if (oV === 0)
{
//colliding horizontally
if ((signx * oH) < 0)
@ -1109,7 +1110,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//note: len should NEVER be == 0, because if it is,
//note: len should NEVER be === 0, because if it is,
//obj is not in a neighboring cell!
ox /= len;
oy /= len;
@ -1141,7 +1142,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//note: len should NEVER be == 0, because if it is,
//note: len should NEVER be === 0, because if it is,
//obj is not in a neighboring cell!
ox /= len;
oy /= len;
@ -1166,7 +1167,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if (len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -1226,9 +1227,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
//obj is in "far" (pointed-at-by-normal) neighbor of halffull tile, and will never hit
return Phaser.Physics.Ninja.Circle.COL_NONE;
}
else if(oH == 0)
else if (oH === 0)
{
if(oV == 0)
if (oV === 0)
{
//colliding with current tile
var r = obj.radius;
@ -1274,10 +1275,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
{
//colliding vertically
if(celldp == 0)
if (celldp === 0)
{
var r = obj.radius;
var dx = obj.pos.x - t.pos.x;
//we're in a cell perpendicular to the normal, and can collide vs. halfedge vertex
@ -1299,7 +1299,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = signx / Math.SQRT2;
@ -1330,13 +1330,12 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
else if(oV == 0)
else if (oV === 0)
{
//colliding horizontally
if(celldp == 0)
if (celldp === 0)
{
var r = obj.radius;
var dy = obj.pos.y - t.pos.y;
//we're in a cell perpendicular to the normal, and can collide vs. halfedge vertex
@ -1358,7 +1357,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = signx / Math.SQRT2;
@ -1404,7 +1403,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -1453,6 +1452,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
// else(collide vs. corner of slope) (vert collision with a non-grid-aligned vert)
//if obj is vert neighb against direction of slope: collide vs. face
var lenP;
var signx = t.signx;
var signy = t.signy;
@ -1462,9 +1462,9 @@ Phaser.Physics.Ninja.Circle.prototype = {
return Phaser.Physics.Ninja.Circle.COL_NONE;
}
else if(oH == 0)
else if (oH === 0)
{
if(oV == 0)
if (oV === 0)
{
//colliding with current tile
//we could only be colliding vs the slope OR a vertex
@ -1569,7 +1569,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
return Phaser.Physics.Ninja.Circle.COL_AXIS;
}
}
else if(oV == 0)
else if (oV === 0)
{
//colliding horizontally
if ((signx*oH) < 0)
@ -1600,7 +1600,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -1696,7 +1696,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -1744,12 +1744,13 @@ Phaser.Physics.Ninja.Circle.prototype = {
//
//if obj is vert neighb in direction of slope: collide vs. slope or vertex
var lenP;
var signx = t.signx;
var signy = t.signy;
if(oH == 0)
if (oH === 0)
{
if(oV == 0)
if (oV === 0)
{
//colliding with current cell
@ -1875,7 +1876,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if(oV == 0)
else if (oV === 0)
{
//colliding horizontally
@ -1997,7 +1998,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -2055,14 +2056,15 @@ Phaser.Physics.Ninja.Circle.prototype = {
return Phaser.Physics.Ninja.Circle.COL_NONE;
}
else if(oH == 0)
else if (oH === 0)
{
if(oV == 0)
if (oV === 0)
{
//colliding with current tile
//we could only be colliding vs the slope OR a vertex
//look at the vector form the closest vert to the circle to decide
var lenP;
var sx = t.sx;
var sy = t.sy;
@ -2138,7 +2140,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
{
obj.reportCollisionVsWorld(x,y,x/lenP, y/lenP, t);
return Phaser.Physics.Ninja.Circle.COL_AXIS
return Phaser.Physics.Ninja.Circle.COL_AXIS;
}
else
{
@ -2182,7 +2184,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -2255,7 +2257,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if(oV == 0)
else if (oV === 0)
{
//colliding horizontally; we can assume that (signy*oV) < 0
//due to the first conditional far above
@ -2282,7 +2284,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -2333,12 +2335,13 @@ Phaser.Physics.Ninja.Circle.prototype = {
var signx = t.signx;
var signy = t.signy;
if(oH == 0)
if (oH === 0)
{
if(oV == 0)
if (oV === 0)
{
//colliding with current cell
var lenP;
var sx = t.sx;
var sy = t.sy;
@ -2473,7 +2476,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
}
}
}
else if(oV == 0)
else if (oV === 0)
{
//colliding horizontally
@ -2585,7 +2588,7 @@ Phaser.Physics.Ninja.Circle.prototype = {
if (0 < pen)
{
//vertex is in the circle; project outward
if(len == 0)
if (len === 0)
{
//project out by 45deg
dx = oH / Math.SQRT2;
@ -2618,4 +2621,4 @@ Phaser.Physics.Ninja.Circle.prototype = {
this.system = null;
}
}
};

View file

@ -1,3 +1,4 @@
/* jshint camelcase: false */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -201,8 +202,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
* @param {number} dy - Collision normal
* @param {number} obj - Object this Tile collided with
*/
reportCollisionVsWorld: function (px, py, dx, dy, obj) {
reportCollisionVsWorld: function (px, py, dx, dy) {
var p = this.pos;
var o = this.oldpos;
@ -665,7 +665,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
}
}
}
};
/**
* @name Phaser.Physics.Ninja.Tile#x

View file

@ -136,7 +136,7 @@ Phaser.Physics.Ninja.prototype = {
if (Array.isArray(object))
{
i = object.length;
var i = object.length;
while (i--)
{
@ -264,9 +264,6 @@ Phaser.Physics.Ninja.prototype = {
layer = map.getLayer(layer);
if (typeof addToWorld === 'undefined') { addToWorld = true; }
if (typeof optimize === 'undefined') { optimize = true; }
// If the bodies array is already populated we need to nuke it
this.clearTilemapLayerBodies(map, layer);
@ -570,11 +567,9 @@ Phaser.Physics.Ninja.prototype = {
* @method Phaser.Physics.Ninja#separate
* @param {Phaser.Physics.Ninja.Body} body1 - The Body object to separate.
* @param {Phaser.Physics.Ninja.Body} body2 - The Body object to separate.
* @param {function} [processCallback=null] - UN-USED: A callback function that lets you perform additional checks against the two objects if they overlap. If this function is set then the sprites will only be collided if it returns true.
* @param {object} [callbackContext] - UN-USED: The context in which to run the process callback.
* @returns {boolean} Returns true if the bodies collided, otherwise false.
*/
separate: function (body1, body2, processCallback, callbackContext, overlapOnly) {
separate: function (body1, body2) {
if (body1.type !== Phaser.Physics.NINJA || body2.type !== Phaser.Physics.NINJA)
{

View file

@ -134,7 +134,7 @@ Phaser.Physics.P2.Body = function (game, sprite, x, y, mass) {
/**
* @property {Phaser.Physics.P2.BodyDebug} debugBody - Reference to the debug body.
*/
this.debugBody = null
this.debugBody = null;
// Set-up the default shape
if (sprite)
@ -763,7 +763,7 @@ Phaser.Physics.P2.Body.prototype = {
this.debugBody.destroy();
}
this.debugBody = null
this.debugBody = null;
this.sprite = null;
@ -1136,28 +1136,26 @@ Phaser.Physics.P2.Body.prototype = {
if (fixtureData.circle)
{
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius))
shape.collisionGroup = fixtureData.filter.categoryBits
shape.collisionMask = fixtureData.filter.maskBits
shape.sensor = fixtureData.isSensor
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius));
shape.collisionGroup = fixtureData.filter.categoryBits;
shape.collisionMask = fixtureData.filter.maskBits;
shape.sensor = fixtureData.isSensor;
var offset = p2.vec2.create();
offset[0] = this.world.pxmi(fixtureData.circle.position[0] - this.sprite.width/2)
offset[1] = this.world.pxmi(fixtureData.circle.position[1] - this.sprite.height/2)
offset[0] = this.world.pxmi(fixtureData.circle.position[0] - this.sprite.width/2);
offset[1] = this.world.pxmi(fixtureData.circle.position[1] - this.sprite.height/2);
this.data.addShape(shape, offset);
generatedShapes.push(shape)
generatedShapes.push(shape);
}
else
{
polygons = fixtureData.polygons;
var polygons = fixtureData.polygons;
var cm = p2.vec2.create();
for (var i = 0; i < polygons.length; i++)
{
shapes = polygons[i];
var shapes = polygons[i];
var vertices = [];
for (var s = 0; s < shapes.length; s += 2)
@ -1755,7 +1753,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "debug", {
if (value && !this.debugBody)
{
// This will be added to the global space
this.debugBody = new Phaser.Physics.P2.BodyDebug(this.game, this.data)
this.debugBody = new Phaser.Physics.P2.BodyDebug(this.game, this.data);
}
else if (!value && this.debugBody)
{

View file

@ -31,7 +31,7 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
debugPolygons: false,
lineWidth: 1,
alpha: 0.5
}
};
this.settings = Phaser.Utils.extend(defaultSettings, settings);
@ -51,16 +51,16 @@ Phaser.Physics.P2.BodyDebug = function(game, body, settings) {
*/
this.canvas = new Phaser.Graphics(game);
this.canvas.alpha = this.settings.alpha
this.canvas.alpha = this.settings.alpha;
this.add(this.canvas);
this.draw();
}
};
Phaser.Physics.P2.BodyDebug.prototype = Object.create(Phaser.Group.prototype)
Phaser.Physics.P2.BodyDebug.prototype.constructor = Phaser.Physics.P2.BodyDebug
Phaser.Physics.P2.BodyDebug.prototype = Object.create(Phaser.Group.prototype);
Phaser.Physics.P2.BodyDebug.prototype.constructor = Phaser.Physics.P2.BodyDebug;
Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
@ -106,7 +106,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
if (obj instanceof p2.Body && obj.shapes.length)
{
var l = obj.shapes.length
var l = obj.shapes.length;
i = 0;
@ -149,7 +149,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
this.drawRectangle(sprite, offset[0] * this.ppu, -offset[1] * this.ppu, angle, child.width * this.ppu, child.height * this.ppu, lineColor, color, lw);
}
i++
i++;
}
}
@ -424,4 +424,4 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
}
})
});

View file

@ -18,4 +18,4 @@ Phaser.Physics.P2.CollisionGroup = function (bitmask) {
*/
this.mask = bitmask;
}
};

View file

@ -58,7 +58,7 @@ Phaser.Physics.P2.ContactMaterial = function (materialA, materialB, options) {
p2.ContactMaterial.call(this, materialA, materialB, options);
}
};
Phaser.Physics.P2.ContactMaterial.prototype = Object.create(p2.ContactMaterial.prototype);
Phaser.Physics.P2.ContactMaterial.prototype.constructor = Phaser.Physics.P2.ContactMaterial;

View file

@ -34,7 +34,7 @@ Phaser.Physics.P2.DistanceConstraint = function (world, bodyA, bodyB, distance,
p2.DistanceConstraint.call(this, bodyA, bodyB, distance, maxForce);
}
};
Phaser.Physics.P2.DistanceConstraint.prototype = Object.create(p2.DistanceConstraint.prototype);
Phaser.Physics.P2.DistanceConstraint.prototype.constructor = Phaser.Physics.P2.DistanceConstraint;

View file

@ -35,7 +35,7 @@ Phaser.Physics.P2.GearConstraint = function (world, bodyA, bodyB, angle, ratio)
p2.GearConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.GearConstraint.prototype = Object.create(p2.GearConstraint.prototype);
Phaser.Physics.P2.GearConstraint.prototype.constructor = Phaser.Physics.P2.GearConstraint;

View file

@ -39,7 +39,7 @@ Phaser.Physics.P2.LockConstraint = function (world, bodyA, bodyB, offset, angle,
p2.LockConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.LockConstraint.prototype = Object.create(p2.LockConstraint.prototype);
Phaser.Physics.P2.LockConstraint.prototype.constructor = Phaser.Physics.P2.LockConstraint;

View file

@ -21,7 +21,7 @@ Phaser.Physics.P2.Material = function (name) {
p2.Material.call(this);
}
};
Phaser.Physics.P2.Material.prototype = Object.create(p2.Material.prototype);
Phaser.Physics.P2.Material.prototype.constructor = Phaser.Physics.P2.Material;

View file

@ -44,7 +44,7 @@ Phaser.Physics.P2.PrismaticConstraint = function (world, bodyA, bodyB, lockRotat
p2.PrismaticConstraint.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.PrismaticConstraint.prototype = Object.create(p2.PrismaticConstraint.prototype);
Phaser.Physics.P2.PrismaticConstraint.prototype.constructor = Phaser.Physics.P2.PrismaticConstraint;

View file

@ -37,7 +37,7 @@ Phaser.Physics.P2.RevoluteConstraint = function (world, bodyA, pivotA, bodyB, pi
p2.RevoluteConstraint.call(this, bodyA, pivotA, bodyB, pivotB, maxForce);
}
};
Phaser.Physics.P2.RevoluteConstraint.prototype = Object.create(p2.RevoluteConstraint.prototype);
Phaser.Physics.P2.RevoluteConstraint.prototype.constructor = Phaser.Physics.P2.RevoluteConstraint;

View file

@ -67,7 +67,7 @@ Phaser.Physics.P2.Spring = function (world, bodyA, bodyB, restLength, stiffness,
p2.Spring.call(this, bodyA, bodyB, options);
}
};
Phaser.Physics.P2.Spring.prototype = Object.create(p2.Spring.prototype);
Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;

View file

@ -279,7 +279,7 @@ Phaser.Physics.P2.prototype = {
if (object.hasOwnProperty('body') && object.body === null)
{
object.body = new Phaser.Physics.P2.Body(this.game, object, object.x, object.y, 1);
object.body.debug = debug
object.body.debug = debug;
object.anchor.set(0.5);
}

View file

@ -177,7 +177,7 @@ Phaser.Tilemap.prototype = {
* @param {Phaser.Group} [group] - Optional Group to add the layer to. If not specified it will be added to the World group.
* @return {Phaser.TilemapLayer} The TilemapLayer object. This is an extension of Phaser.Image and can be moved around the display list accordingly.
*/
create: function (name, width, height, tileWidth, tileHeight) {
create: function (name, width, height, tileWidth, tileHeight, group) {
if (typeof group === 'undefined') { group = this.game.world; }

View file

@ -229,7 +229,7 @@ Phaser.TilemapLayer.prototype.postUpdate = function () {
// this.children[i].postUpdate();
// }
}
};
/**
* Sets the world size to match the size of this layer.
@ -241,7 +241,7 @@ Phaser.TilemapLayer.prototype.resizeWorld = function () {
this.game.world.setBounds(0, 0, this.layer.widthInPixels, this.layer.heightInPixels);
}
};
/**
* Take an x coordinate that doesn't account for scrollFactorX and 'fix' it
@ -266,7 +266,7 @@ Phaser.TilemapLayer.prototype._fixX = function(x) {
return this._mc.x + (x - (this._mc.x / this.scrollFactorX));
}
};
/**
* Take an x coordinate that _does_ account for scrollFactorX and 'unfix' it
@ -286,7 +286,7 @@ Phaser.TilemapLayer.prototype._unfixX = function(x) {
return (this._mc.x / this.scrollFactorX) + (x - this._mc.x);
}
};
/**
* Take a y coordinate that doesn't account for scrollFactorY and 'fix' it
@ -311,7 +311,7 @@ Phaser.TilemapLayer.prototype._fixY = function(y) {
return this._mc.y + (y - (this._mc.y / this.scrollFactorY));
}
};
/**
* Take a y coordinate that _does_ account for scrollFactorY and 'unfix' it
@ -331,7 +331,7 @@ Phaser.TilemapLayer.prototype._unfixY = function(y) {
return (this._mc.y / this.scrollFactorY) + (y - this._mc.y);
}
};
/**
* Convert a pixel value to a tile coordinate.
@ -346,7 +346,7 @@ Phaser.TilemapLayer.prototype.getTileX = function (x) {
return this.game.math.snapToFloor(this._fixX(x), this.map.tileWidth) / this.map.tileWidth;
}
};
/**
* Convert a pixel value to a tile coordinate.
@ -361,7 +361,7 @@ Phaser.TilemapLayer.prototype.getTileY = function (y) {
return this.game.math.snapToFloor(this._fixY(y), this.map.tileHeight) / this.map.tileHeight;
}
};
/**
* Convert a pixel value to a tile coordinate.
@ -379,7 +379,7 @@ Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
return point;
}
};
/**
* Gets all tiles that intersect with the given line.
@ -425,7 +425,7 @@ Phaser.TilemapLayer.prototype.getRayCastTiles = function (line, stepRate, collid
return results;
}
};
/**
* Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
@ -484,7 +484,7 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
return this._results;
}
};
/**
* Internal function to update maximum values.
@ -511,7 +511,7 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
this.dirty = true;
}
};
/**
* Renders the tiles to the layer canvas and pushes to the display.
@ -603,7 +603,7 @@ Phaser.TilemapLayer.prototype.render = function () {
return true;
}
};
/**
* Renders a collision debug overlay on-top of the canvas. Called automatically by render when debug = true.
@ -673,7 +673,7 @@ Phaser.TilemapLayer.prototype.renderDebug = function () {
}
}
};
/**
* @name Phaser.TilemapLayer#scrollX

View file

@ -454,4 +454,4 @@ Phaser.TilemapParser = {
}
}
};

View file

@ -99,17 +99,17 @@ Phaser.Utils = {
switch (dir)
{
case 1:
str = Array(len + 1 - str.length).join(pad) + str;
str = new Array(len + 1 - str.length).join(pad) + str;
break;
case 3:
var right = Math.ceil((padlen = len - str.length) / 2);
var left = padlen - right;
str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
str = new Array(left+1).join(pad) + str + new Array(right+1).join(pad);
break;
default:
str = str + Array(len + 1 - str.length).join(pad);
str = str + new Array(len + 1 - str.length).join(pad);
break;
}
}
@ -140,7 +140,7 @@ Phaser.Utils = {
// the "constructor" property of certain host objects, ie. |window.location|
// https://bugzilla.mozilla.org/show_bug.cgi?id=814622
try {
if (obj.constructor && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf"))
if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf"))
{
return false;
}
@ -245,6 +245,7 @@ Phaser.Utils = {
*/
if (typeof Function.prototype.bind != 'function') {
/* jshint freeze: false */
Function.prototype.bind = (function () {
var slice = Array.prototype.slice;
@ -264,7 +265,10 @@ if (typeof Function.prototype.bind != 'function') {
}
bound.prototype = (function F(proto) {
proto && (F.prototype = proto);
if (proto)
{
F.prototype = proto;
}
if (!(this instanceof F))
{
@ -285,5 +289,5 @@ if (!Array.isArray)
Array.isArray = function (arg)
{
return Object.prototype.toString.call(arg) == '[object Array]';
}
};
}

23
tasks/.jshintrc Normal file
View file

@ -0,0 +1,23 @@
{
"node" : true,
"browser": false,
"boss" : true,
"curly": true,
"debug": false,
"devel": false,
"eqeqeq": true,
"eqnull": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"plusplus": false,
"strict": false,
"sub": true,
"trailing": true,
"undef": true,
"white": false
}