mirror of
https://github.com/photonstorm/phaser
synced 2024-12-19 09:34:02 +00:00
1 line
277 KiB
JavaScript
1 line
277 KiB
JavaScript
|
var PIXI=PIXI||{};var Phaser=Phaser||{VERSION:"1.0.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,SPRITE:0,BUTTON:1,BULLET:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11};PIXI.InteractionManager=function(b){};Phaser.Utils={pad:function(g,b,f,c){if(typeof(b)=="undefined"){var b=0}if(typeof(f)=="undefined"){var f=" "}if(typeof(c)=="undefined"){var c=3}if(b+1>=g.length){switch(c){case 1:g=Array(b+1-g.length).join(f)+g;break;case 3:var d=Math.ceil((padlen=b-g.length)/2);var e=padlen-d;g=Array(e+1).join(f)+g+Array(d+1).join(f);break;default:g=g+Array(b+1-g.length).join(f);break}}return g},isPlainObject:function(c){if(typeof(c)!=="object"||c.nodeType||c===c.window){return false}try{if(c.constructor&&!hasOwn.call(c.constructor.prototype,"isPrototypeOf")){return false}}catch(b){return false}return true},extend:function(){var l,d,b,c,h,j,g=arguments[0]||{},f=1,e=arguments.length,k=false;if(typeof g==="boolean"){k=g;g=arguments[1]||{};f=2}if(e===f){g=this;--f}for(;f<e;f++){if((l=arguments[f])!=null){for(d in l){b=g[d];c=l[d];if(g===c){continue}if(k&&c&&(Phaser.Utils.isPlainObject(c)||(h=Array.isArray(c)))){if(h){h=false;j=b&&Array.isArray(b)?b:[]}else{j=b&&Phaser.Utils.isPlainObject(b)?b:{}}g[d]=extend(k,j,c)}else{if(c!==undefined){g[d]=c}}}}}return g}};function HEXtoRGB(b){return[(b>>16&255)/255,(b>>8&255)/255,(b&255)/255]}if(typeof Function.prototype.bind!="function"){Function.prototype.bind=(function(){var b=Array.prototype.slice;return function(c){var f=this,g=b.call(arguments,1);if(typeof f!="function"){throw new TypeError()}function d(){var h=g.concat(b.call(arguments));f.apply(this instanceof d?this:c,h)}d.prototype=(function e(h){h&&(e.prototype=h);if(!(this instanceof e)){return new e}})(f.prototype);return d}})()}function determineMatrixArrayType(){PIXI.Matrix=(typeof Float32Array!=="undefined")?Float32Array:Array;return PIXI.Matrix}determineMatrixArrayType();PIXI.mat3={};PIXI.mat3.create=function(){var b=new PIXI.Matrix(9);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat3.identity=function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat4={};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat3.multiply=function(q,h,i){if(!i){i=q}var v=q[0],u=q[1],t=q[2],g=q[3],f=q[4],e=q[5],o=q[6],n=q[7],m=q[8],l=h[0],k=h[1],j=h[2],s=h[3],r=h[4],p=h[5],d=h[6],c=h[7],b=h[8];i[0]=l*v+k*g+j*o;i[1]=l*u+k*f+j*n;i[2]=l*t+k*e+j*m;i[3]=s*v+r*g+p*o;i[4]=s*u+r*f+p*n;i[5]=s*t+r*e+p*m;i[6]=d*v+c*g+b*o;i[7]=d*u+c*f+b*n;i[8]=d*t+c*e+b*m;return i};PIXI.mat3.clone=function(c){var b=new PIXI.Matrix(9);b[0]=c[0];b[1]=c[1];b[2]=c[2];b[3]=c[3];b[4]=c[4];b[5]=c[5];b[6]=c[6];b[7]=c[7];b[8]=c[8];return b};PIXI.mat3.transpose=function(d,c){if(!c||d===c){var f=d[1],e=d[2],b=d[5];d[1]=d[3];d[2]=d[6];d[3]=f;d[5]=d[7];d[6]=e;d[7]=b;return d}c[0]=d[0];c[1]=d[3];c[2]=d[6];c[3]=d[1];c[4]=d[4];c[5]=d[7];c[6]=d[2];c[7]=d[5];c[8]=d[8];return c};PIXI.mat3.toMat4=function(c,b){if(!b){b=PIXI.mat4.create()}b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=c[8];b[9]=c[7];b[8]=c[6];b[7]=0;b[6]=c[5];b[5]=c[4];b[4]=c[3];b[3]=0;b[2]=c[2];b[1]=c[1];b[0]=c[0];return b};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat4.transpose=function(e,d){if(!d||e===d){var i=e[1],g=e[2],f=e[3],b=e[6],h=e[7],c=e[11];e[1]=e[4];e[2]=e[8];e[3]=e[12];e[4]=i;e[6]=e[9];e[7]=e[13];e[8]=g;e[9]=b;e[11]=e[14];e[12]=f;e[13]=h;e[14]=c;return e}d[0]=e[0];d[1]=e[4];d[2]=e[8];d[3]=e[12];d[4]=e[1];d[5]=e[5];d[6]=e[9];d[7]=e[13];d[8]=e[2];d[9]=e[6];d[10]=e[10];d[11]=e[14];d[12]=e[3];d[13]=e[7];d[14]=e[11];d[15]=e[15];return d};PIXI.mat4.multiply=function(p,i,k){if(!k){k=p}var v=p[0],u=p[1],s=p[2],q=p[3];var h=p[4],f=p[5],d=p[6],b=p[7];var o=p[8],n=p[9],m=p[10],l=p[11];var z=p[12],w=p[13],t=p[14],r=p[15];var j=i[0],g=i[1],e=
|