From 72c5a230311526ccab6f3f855b8d1b8ccd55a22f Mon Sep 17 00:00:00 2001 From: hyperandroid Date: Sun, 22 Jan 2012 18:00:17 +0100 Subject: [PATCH] 01/22/2012 *0.2 Build 18* -------------------------- * Added dirty rectangles clear support. To be enabled a call director.setClear( CAAT.Director.CLEAR_DIRTY_RECTS ); must be performed. Every actor which changes affine transformation, either position, rotation or scale, will automatically be invalidated. In you want any other actor to be explicitly invalidated, just call actor.invalidate(); * Cleaned some ctx.save/restore code. * Modified license file to reflect copyright 2012. --- LICENSE | 2 +- build/caat-box2d-min.js | 8 +- build/caat-box2d.js | 8 +- build/caat-css-min.js | 109 +- build/caat-css.js | 194 ++- build/caat-min.js | 157 +- build/caat.js | 336 +++-- changelog | 13 +- documentation/jsdoc/files.html | 2 +- documentation/jsdoc/index.html | 2 +- documentation/jsdoc/symbols/CAAT.Actor.html | 55 +- .../jsdoc/symbols/CAAT.ActorContainer.html | 4 +- .../jsdoc/symbols/CAAT.AudioManager.html | 2 +- .../jsdoc/symbols/CAAT.B2DBodyActor.html | 2 +- .../jsdoc/symbols/CAAT.B2DCircularBody.html | 2 +- .../jsdoc/symbols/CAAT.B2DPolygonBody.html | 2 +- documentation/jsdoc/symbols/CAAT.Bezier.html | 2 +- .../jsdoc/symbols/CAAT.CatmullRom.html | 2 +- .../jsdoc/symbols/CAAT.Color.RGB.html | 2 +- documentation/jsdoc/symbols/CAAT.Color.html | 2 +- documentation/jsdoc/symbols/CAAT.Curve.html | 2 +- .../jsdoc/symbols/CAAT.CurvePath.html | 2 +- .../jsdoc/symbols/CAAT.Director.html | 49 +- documentation/jsdoc/symbols/CAAT.IMActor.html | 4 +- documentation/jsdoc/symbols/CAAT.IMBump.html | 2 +- .../jsdoc/symbols/CAAT.IMPlasma.html | 2 +- .../jsdoc/symbols/CAAT.IMRotoZoom.html | 2 +- .../jsdoc/symbols/CAAT.ImagePreloader.html | 2 +- .../jsdoc/symbols/CAAT.ImageProcessor.html | 2 +- .../jsdoc/symbols/CAAT.Interpolator.html | 2 +- .../jsdoc/symbols/CAAT.InterpolatorActor.html | 4 +- .../jsdoc/symbols/CAAT.LinearPath.html | 2 +- documentation/jsdoc/symbols/CAAT.Matrix3.html | 2 +- .../jsdoc/symbols/CAAT.MatrixStack.html | 2 +- .../jsdoc/symbols/CAAT.MouseEvent.html | 2 +- documentation/jsdoc/symbols/CAAT.Path.html | 2 +- .../jsdoc/symbols/CAAT.PathActor.html | 4 +- .../jsdoc/symbols/CAAT.PathSegment.html | 2 +- documentation/jsdoc/symbols/CAAT.Point.html | 2 +- .../jsdoc/symbols/CAAT.Rectangle.html | 47 +- documentation/jsdoc/symbols/CAAT.Scene.html | 4 +- .../jsdoc/symbols/CAAT.ShapeActor.html | 4 +- .../jsdoc/symbols/CAAT.SpriteImage.html | 161 +- .../jsdoc/symbols/CAAT.StarActor.html | 4 +- .../jsdoc/symbols/CAAT.TextActor.html | 4 +- .../jsdoc/symbols/CAAT.TimerTask.html | 2 +- documentation/jsdoc/symbols/CAAT.html | 18 +- ...AT.modules.CircleManager.PackedCircle.html | 2 +- ...les.CircleManager.PackedCircleManager.html | 2 +- .../symbols/CAAT.modules.CircleManager.html | 2 +- .../symbols/CAAT.modules.LocalStorage.html | 2 +- documentation/jsdoc/symbols/CAAT.modules.html | 2 +- documentation/jsdoc/symbols/Function.html | 2 +- documentation/jsdoc/symbols/_global_.html | 60 +- ...on_js_CAAT_src_model_conpoundimage.js.html | 1335 +++++++++-------- src/math/rectangle.js | 16 + src/model/actor.js | 190 +-- src/model/actorCSS.js | 48 +- src/model/director.js | 122 +- 59 files changed, 1844 insertions(+), 1180 deletions(-) diff --git a/LICENSE b/LICENSE index da0757f8..bdd73a5e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2010-2011 Ibon Tolosana [@hyperandroid] +Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build/caat-box2d-min.js b/build/caat-box2d-min.js index a80ad27b..45578518 100644 --- a/build/caat-box2d-min.js +++ b/build/caat-box2d-min.js @@ -2,7 +2,7 @@ /* The MIT License -Copyright (c) 2010-2011 Ibon Tolosana [@hyperandroid] +Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -22,11 +22,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Version: 0.1 build: 631 +Version: 0.2 build: 17 Created on: -DATE: 2012-01-21 -TIME: 00:52:09 +DATE: 2012-01-22 +TIME: 17:56:52 */ diff --git a/build/caat-box2d.js b/build/caat-box2d.js index b18a7b35..0e559381 100644 --- a/build/caat-box2d.js +++ b/build/caat-box2d.js @@ -1,7 +1,7 @@ /* The MIT License -Copyright (c) 2010-2011 Ibon Tolosana [@hyperandroid] +Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,11 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Version: 0.1 build: 632 +Version: 0.2 build: 18 Created on: -DATE: 2012-01-21 -TIME: 00:52:32 +DATE: 2012-01-22 +TIME: 17:57:15 */ diff --git a/build/caat-css-min.js b/build/caat-css-min.js index dc99bb5e..66673b90 100644 --- a/build/caat-css-min.js +++ b/build/caat-css-min.js @@ -2,7 +2,7 @@ /* The MIT License -Copyright (c) 2010-2011 Ibon Tolosana [@hyperandroid] +Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -22,15 +22,15 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Version: 0.1 build: 631 +Version: 0.2 build: 17 Created on: -DATE: 2012-01-21 -TIME: 00:52:09 +DATE: 2012-01-22 +TIME: 17:56:52 */ -var CAAT=CAAT||{};Function.prototype.bind=Function.prototype.bind||function(){var a=this,b=Array.prototype.slice.call(arguments),c=b.shift();return function(){return a.apply(c,b.concat(Array.prototype.slice.call(arguments)))}};CAAT.__CSS__=1;CAAT.__CSS__=1;CAAT.__CSS__=1;(function(){CAAT.BrowserDetect=function(){this.init();return this};CAAT.BrowserDetect.prototype={browser:"",version:0,OS:"",init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var b=0;b>24&255,i=(g&16711680)>>16,j=(g&65280)>>8;g&=255;for(var k=a[f+1],m=((k>>24&255)-h)/b,n=(((k&16711680)>>16)-i)/b,l=(((k&65280)>>8)-j)/b,k=((k&255)-g)/b,o=0;o>0,q=i+n*o>>0,r=j+l*o>>0,s=g+k*o>>0;switch(c){case this.RampEnumeration.RAMP_RGBA:d.push("argb("+p+","+q+","+r+","+s+")");break;case this.RampEnumeration.RAMP_RGB:d.push("rgb("+q+","+r+","+s+")");break;case this.RampEnumeration.RAMP_CHANNEL_RGB:d.push(4278190080|q<<16|r<<8|s);break;case this.RampEnumeration.RAMP_CHANNEL_RGBA:d.push(p<< 24|q<<16|r<<8|s);break;case this.RampEnumeration.RAMP_CHANNEL_RGBA_ARRAY:d.push([q,r,s,p]);break;case this.RampEnumeration.RAMP_CHANNEL_RGB_ARRAY:d.push([q,r,s])}}}return d}}})();(function(){CAAT.Color.RGB=function(a,b,c){this.r=a||255;this.g=b||255;this.b=c||255;return this};CAAT.Color.RGB.prototype={r:255,g:255,b:255,toHex:function(){return("000000"+((this.r<<16)+(this.g<<8)+this.b).toString(16)).slice(-6)}}})();(function(){CAAT.Rectangle=function(){return this};CAAT.Rectangle.prototype={x:0,y:0,x1:0,y1:0,width:-1,height:-1,setEmpty:function(){this.height=this.width=-1;this.y1=this.x1=this.y=this.x=0;return this},setLocation:function(a,b){this.x=a;this.y=b;this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setDimension:function(a,b){this.width=a;this.height=b;this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setBounds:function(a,b,c,d){this.setLocation(a,b);this.setDimension(c, d);return this},contains:function(a,b){return a>=0&&a=0&&bthis.y1)this.y1=b;if(a>this.x1)this.x1=a;this.width=this.x1-this.x;this.height=this.y1-this.y}},unionRectangle:function(a){this.union(a.x,a.y);this.union(a.x1, -a.y);this.union(a.x,a.y1);this.union(a.x1,a.y1);return this}}})();(function(){CAAT.Curve=function(){return this};CAAT.Curve.prototype={coordlist:null,k:0.05,length:-1,interpolator:false,HANDLE_SIZE:20,drawHandles:true,paint:function(a){if(false!==this.drawHandles){a=a.ctx;a.save();a.beginPath();a.strokeStyle="#a0a0a0";a.moveTo(this.coordlist[0].x,this.coordlist[0].y);a.lineTo(this.coordlist[1].x,this.coordlist[1].y);a.stroke();this.cubic&&(a.moveTo(this.coordlist[2].x,this.coordlist[2].y),a.lineTo(this.coordlist[3].x,this.coordlist[3].y),a.stroke());a.globalAlpha= +a.y);this.union(a.x,a.y1);this.union(a.x1,a.y1);return this},intersects:function(a){return a.x1this.x1?false:a.y1this.y1?false:true}}})();(function(){CAAT.Curve=function(){return this};CAAT.Curve.prototype={coordlist:null,k:0.05,length:-1,interpolator:false,HANDLE_SIZE:20,drawHandles:true,paint:function(a){if(false!==this.drawHandles){a=a.ctx;a.save();a.beginPath();a.strokeStyle="#a0a0a0";a.moveTo(this.coordlist[0].x,this.coordlist[0].y);a.lineTo(this.coordlist[1].x,this.coordlist[1].y);a.stroke();this.cubic&&(a.moveTo(this.coordlist[2].x,this.coordlist[2].y),a.lineTo(this.coordlist[3].x,this.coordlist[3].y),a.stroke());a.globalAlpha= 0.5;for(var b=0;b=0&&bthis.framerate.timeLastRefresh+this.framerate.refreshInterval)this.framerate.fps=this.framerate.frames*1E3/(CAAT.RAF-this.framerate.timeLastRefresh)|0,this.framerate.fpsMin=this.framerate.frames>0?Math.min(this.framerate.fpsMin, this.framerate.fps):this.framerate.fpsMin,this.framerate.fpsMax=Math.max(this.framerate.fpsMax,this.framerate.fps),this.textFPS.innerHTML=this.framerate.fps,a=(this.frameTimeAcc*100/this.framerate.frames|0)/100,this.frameTimeAcc=0,this.textDrawTime.innerHTML=a,a=(this.frameRAFAcc*100/this.framerate.frames|0)/100,this.frameRAFAcc=0,this.textRAFTime.innerHTML=a,this.framerate.timeLastRefresh=CAAT.RAF,this.framerate.frames=0,this.paint(a);this.textEntitiesTotal.innerHTML=this.statistics.size_total;this.textEntitiesActive.innerHTML= this.statistics.size_active;this.textDraws.innerHTML=this.statistics.draws},paint:function(a){var b=this.ctx,c=0;b.drawImage(this.canvas,1,0,this.width-1,this.height,0,0,this.width-1,this.height);b.strokeStyle="black";b.beginPath();b.moveTo(this.width-0.5,0);b.lineTo(this.width-0.5,this.height);b.stroke();b.strokeStyle="#a22";b.beginPath();c=this.height-(20/this.SCALE*this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();b.strokeStyle="#aa2";b.beginPath();c=this.height-(30/this.SCALE* -this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();c=Math.min(this.height-this.framerate.fps/this.SCALE*this.height,59);if(-1===this.framerate.prevFps)this.framerate.prevFps=c|0;b.strokeStyle="#0ff";b.beginPath();b.moveTo(this.width,(c|0)-0.5);b.lineTo(this.width,this.framerate.prevFps-0.5);b.stroke();this.framerate.prevFps=c;a=(this.height-a/this.SCALE*this.height>>0)-0.5;b.strokeStyle="#ff0";b.beginPath();b.moveTo(this.width,a);b.lineTo(this.width,a);b.stroke()}}})();(function(){CAAT.Actor=function(){this.behaviorList=[];this.lifecycleListenerList=[];this.rotateAnchor=this.scaleAnchor=this.ANCHOR_CENTER;this.behaviorList=[];this.domElement=document.createElement("div");this.domElement.style.position="absolute";this.domElement.style["-webkit-transform"]="translate3d(0,0,0)";this.domElement.style["-webkit-transition"]="all 0s linear";this.style("display","none");this.setVisible(true);this.resetTransform();this.setScale(1,1);this.setRotation(0);this.modelViewMatrix= -new CAAT.Matrix;this.worldModelViewMatrix=new CAAT.Matrix;return this};CAAT.Actor.prototype={lifecycleListenerList:null,behaviorList:null,x:0,y:0,width:0,height:0,start_time:0,duration:Number.MAX_VALUE,clip:false,scaleX:0,scaleY:0,scaleTX:0.5,scaleTY:0.5,scaleAnchor:0,rotationAngle:0,rotationY:0.5,alpha:1,rotationX:0.5,isGlobalAlpha:false,frameAlpha:1,expired:false,discardable:false,domParent:null,domElement:null,visible:true,ANCHOR_CENTER:0,ANCHOR_TOP:1,ANCHOR_BOTTOM:2,ANCHOR_LEFT:3,ANCHOR_RIGHT:4, -ANCHOR_TOP_LEFT:5,ANCHOR_TOP_RIGHT:6,ANCHOR_BOTTOM_LEFT:7,ANCHOR_BOTTOM_RIGHT:8,ANCHOR_CUSTOM:9,mouseEnabled:true,time:0,inFrame:false,backgroundImage:null,size_active:1,size_total:1,id:null,getId:function(){return this.id},setId:function(a){this.id=a;return this},setParent:function(a){this.parent&&this.domParent.removeChild(this.domElement);this.parent=a;null!=a?(this.parent.domElement.appendChild(this.domElement),this.domParent=this.parent.domElement):this.domParent=null;this.dirty=true;return this}, -setBackgroundImage:function(a,b){if(a){if(a instanceof HTMLImageElement)a=(new CAAT.SpriteImage).initialize(a,1,1);else if(a instanceof HTMLCanvasElement)a.src=a.toDataURL(),a=(new CAAT.SpriteImage).initialize(a,1,1);else if(a instanceof CAAT.SpriteImage){if(a.image instanceof HTMLCanvasElement&&!a.image.src)a.image.src=a.image.toDataURL()}else throw"Invalid image object to set actor's background";a.setOwner(this);this.backgroundImage=a;(typeof b==="undefined"||b)&&this.setSize(a.getWidth(),a.getHeight()); -this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition())}else this.backgroundImage=null,this.style("background","none");return this},setSpriteIndex:function(a){this.backgroundImage&&(this.backgroundImage.setSpriteIndex(a),this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setBackgroundImageOffset:function(a,b){this.backgroundImage&&(this.backgroundImage.setOffset(a, -b),this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setAnimationImageIndex:function(a){this.backgroundImage&&(this.backgroundImage.setAnimationImageIndex(a),this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setImageTransformation:function(a){this.transformation=a;a===CAAT.SpriteImage.prototype.TR_FIXED_TO_SIZE&&this.style("background-size", +this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();c=Math.min(this.height-this.framerate.fps/this.SCALE*this.height,59);if(-1===this.framerate.prevFps)this.framerate.prevFps=c|0;b.strokeStyle="#0ff";b.beginPath();b.moveTo(this.width,(c|0)-0.5);b.lineTo(this.width,this.framerate.prevFps-0.5);b.stroke();this.framerate.prevFps=c;a=(this.height-a/this.SCALE*this.height>>0)-0.5;b.strokeStyle="#ff0";b.beginPath();b.moveTo(this.width,a);b.lineTo(this.width,a);b.stroke()}}})();(function(){CAAT.Actor=function(){this.behaviorList=[];this.lifecycleListenerList=[];this.scaleAnchor=this.ANCHOR_CENTER;this.behaviorList=[];this.domElement=document.createElement("div");this.domElement.style.position="absolute";this.domElement.style["-webkit-transform"]="translate3d(0,0,0)";this.domElement.style["-webkit-transition"]="all 0s linear";this.style("display","none");this.setVisible(true);this.resetTransform();this.setScale(1,1);this.setRotation(0);this.modelViewMatrix=new CAAT.Matrix; +this.worldModelViewMatrix=new CAAT.Matrix;return this};CAAT.Actor.prototype={lifecycleListenerList:null,behaviorList:null,x:0,y:0,width:0,height:0,start_time:0,duration:Number.MAX_VALUE,clip:false,scaleX:0,scaleY:0,scaleTX:0.5,scaleTY:0.5,scaleAnchor:0,rotationAngle:0,rotationY:0.5,alpha:1,rotationX:0.5,isGlobalAlpha:false,frameAlpha:1,expired:false,discardable:false,domParent:null,domElement:null,visible:true,ANCHOR_CENTER:0,ANCHOR_TOP:1,ANCHOR_BOTTOM:2,ANCHOR_LEFT:3,ANCHOR_RIGHT:4,ANCHOR_TOP_LEFT:5, +ANCHOR_TOP_RIGHT:6,ANCHOR_BOTTOM_LEFT:7,ANCHOR_BOTTOM_RIGHT:8,ANCHOR_CUSTOM:9,mouseEnabled:true,time:0,inFrame:false,backgroundImage:null,size_active:1,size_total:1,id:null,getId:function(){return this.id},setId:function(a){this.id=a;return this},setParent:function(a){this.parent&&this.domParent.removeChild(this.domElement);this.parent=a;null!=a?(this.parent.domElement.appendChild(this.domElement),this.domParent=this.parent.domElement):this.domParent=null;this.dirty=true;return this},setBackgroundImage:function(a, +b){if(a){if(a instanceof HTMLImageElement)a=(new CAAT.SpriteImage).initialize(a,1,1);else if(a instanceof HTMLCanvasElement)a.src=a.toDataURL(),a=(new CAAT.SpriteImage).initialize(a,1,1);else if(a instanceof CAAT.SpriteImage){if(a.image instanceof HTMLCanvasElement&&!a.image.src)a.image.src=a.image.toDataURL()}else throw"Invalid image object to set actor's background";a.setOwner(this);this.backgroundImage=a;(typeof b==="undefined"||b)&&this.setSize(a.getWidth(),a.getHeight());this.style("background", +"url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition())}else this.backgroundImage=null,this.style("background","none");return this},setSpriteIndex:function(a){this.backgroundImage&&(this.backgroundImage.setSpriteIndex(a),this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setBackgroundImageOffset:function(a,b){this.backgroundImage&&(this.backgroundImage.setOffset(a,b), +this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setAnimationImageIndex:function(a){this.backgroundImage&&(this.backgroundImage.setAnimationImageIndex(a),this.style("background","url("+this.backgroundImage.image.src+") "+this.backgroundImage.getCurrentSpriteImageCSSPosition()));return this},setImageTransformation:function(a){this.transformation=a;a===CAAT.SpriteImage.prototype.TR_FIXED_TO_SIZE&&this.style("background-size", "100%");return this},centerOn:function(a,b){this.setLocation(a-this.width/2,b-this.height/2);return this},setVisible:function(a){this.visible=a;return this},style:function(a,b){this.domElement.style[a]=b},style3:function(){var a="";this.transformation===CAAT.SpriteImage.prototype.TR_FLIP_HORIZONTAL&&(a=" scale(-1,1) ");a="rotate("+this.rotationAngle+"rad) scale("+this.scaleX+","+this.scaleY+")"+a;this.domElement.style["-ms-transform"]=a;this.domElement.style["-webkit-transform"]="translate3d(0,0,0) "+ a;this.domElement.style.OTransform=a;this.domElement.style.MozTransform=a;this.domElement.style.transform=a;a=""+this.rotationX*100+"% "+this.rotationY*100+"% ";this.domElement.style["transform-origin"]=a;this.domElement.style["-webkit-transform-origin"]=a;this.domElement.style["-ms-transform-origin"]=a;this.domElement.style.OTransformOrigin=a;this.domElement.style.MozTransformOrigin=a;return this},styleAlpha:function(){this.domElement.style.filter="alpha(opacity="+(this.alpha*100>>0)+")";this.domElement.style.Oopacity= this.alpha;this.domElement.style.MozOpacity=this.alpha;this.domElement.style["-khtml-opacity"]=this.alpha;this.domElement.style.opacity=this.alpha;return this},setOutOfFrameTime:function(){this.setFrameTime(-1,0);this.style("display","none");return this},addListener:function(a){this.lifecycleListenerList.push(a)},removeListener:function(a){for(var b=this.lifecycleListenerList.length;b--;)if(this.lifecycleListenerList[b]===a){this.lifecycleListenerList.splice(b,1);break}},setGlobalAlpha:function(a){this.isGlobalAlpha= a;return this},fireEvent:function(a,b){for(var c=0;c=this.start_time+this.duration?(this.expired||this.setExpired(a),false):this.start_time<=a&&a=0&&b>=0&&ad+this.range?this.minSize:a===d?this.maxSize:a=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},resetStats:function(){this.statistics.size_total= -0;this.statistics.size_active=0;this.statistics.draws=0},render:function(a){this.time+=a;this.animate(this,a);CAAT.DEBUG&&this.resetStats();var b=this.childrenList.length,c,d,e;if(this.glEnabled){this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT);for(c=this.uvIndex=this.coordsIndex=0;c=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},resetStats:function(){this.statistics.size_total=0;this.statistics.size_active=0;this.statistics.draws=0},render:function(a){this.time+=a;this.animate(this,a);CAAT.DEBUG&&this.resetStats();var b=this.childrenList.length,c,d,e,f=this.ctx;if(this.glEnabled){this.gl.clear(this.gl.COLOR_BUFFER_BIT| +this.gl.DEPTH_BUFFER_BIT);for(c=this.uvIndex=this.coordsIndex=0;c=this.dirtyRects.length)for(b=0;b<32;b++)this.dirtyRects.push(new CAAT.Rectangle);b=this.dirtyRects[this.dirtyRectsIndex];b.x=a.x;b.y=a.y;b.x1=a.x1;b.y1=a.y1;b.width=a.width;b.height=a.height;this.cDirtyRects.push(b)}},renderToContext:function(a,b){if(b.isInAnimationFrame(this.time)){a.globalAlpha=1;a.globalCompositeOperation= +"source-over";a.clearRect(0,0,this.width,this.height);a.setTransform(1,0,0,0,1,0);var c=this.ctx,d=this.crc;this.ctx=this.crc=a;a.save();var e=this.worldModelViewMatrix;this.worldModelViewMatrix=new CAAT.Matrix;this.wdirty=true;b.animate(this,b.time);if(b.onRenderStart)b.onRenderStart(b.time);b.paintActor(this,b.time);if(b.onRenderEnd)b.onRenderEnd(b.time);this.worldModelViewMatrix=e;a.restore();this.ctx=c;this.crc=d}},addScene:function(a){a.setBounds(0,0,this.width,this.height);this.scenes.push(a); +a.setEaseListener(this);null===this.currentScene&&this.setScene(0)},getNumScenes:function(){return this.scenes.length},easeInOut:function(a,b,c,d,e,f,g,h,i,j){if(a!==this.getCurrentSceneIndex()){a=this.scenes[a];d=this.scenes[d];if(!this.glEnabled&&!navigator.browser==="iOS")this.worldModelViewMatrix.transformRenderingContext(this.transitionScene.ctx),this.renderToContext(this.transitionScene.ctx,d),d=this.transitionScene;a.setExpired(false);d.setExpired(false);a.mouseEnabled=false;d.mouseEnabled= +false;a.resetTransform();d.resetTransform();a.setLocation(0,0);d.setLocation(0,0);a.alpha=1;d.alpha=1;b===CAAT.Scene.prototype.EASE_ROTATION?a.easeRotationIn(g,h,c,i):b===CAAT.Scene.prototype.EASE_SCALE?a.easeScaleIn(0,g,h,c,i):a.easeTranslationIn(g,h,c,i);e===CAAT.Scene.prototype.EASE_ROTATION?d.easeRotationOut(g,h,f,j):e===CAAT.Scene.prototype.EASE_SCALE?d.easeScaleOut(0,g,h,f,j):d.easeTranslationOut(g,h,f,j);this.childrenList=[];this.addChild(d);this.addChild(a)}},easeInOutRandom:function(a,b, +c,d){var e=Math.random(),f=Math.random(),g;e<0.33?(e=CAAT.Scene.prototype.EASE_ROTATION,g=(new CAAT.Interpolator).createExponentialInOutInterpolator(4)):e<0.66?(e=CAAT.Scene.prototype.EASE_SCALE,g=(new CAAT.Interpolator).createElasticOutInterpolator(1.1,0.4)):(e=CAAT.Scene.prototype.EASE_TRANSLATE,g=(new CAAT.Interpolator).createBounceOutInterpolator());var h;f<0.33?(f=CAAT.Scene.prototype.EASE_ROTATION,h=(new CAAT.Interpolator).createExponentialInOutInterpolator(4)):f<0.66?(f=CAAT.Scene.prototype.EASE_SCALE, h=(new CAAT.Interpolator).createExponentialOutInterpolator(4)):(f=CAAT.Scene.prototype.EASE_TRANSLATE,h=(new CAAT.Interpolator).createBounceOutInterpolator());this.easeInOut(a,e,Math.random()*8.99>>0,b,f,Math.random()*8.99>>0,c,d,g,h)},easeIn:function(a,b,c,d,e,f){a=this.scenes[a];b===CAAT.Scene.prototype.EASE_ROTATION?a.easeRotationIn(c,d,e,f):b===CAAT.Scene.prototype.EASE_SCALE?a.easeScaleIn(0,c,d,e,f):a.easeTranslationIn(c,d,e,f);this.childrenList=[];this.addChild(a);a.resetTransform();a.setLocation(0, 0);a.alpha=1;a.mouseEnabled=false;a.setExpired(false)},setScene:function(a){a=this.scenes[a];this.childrenList=[];this.addChild(a);this.currentScene=a;a.setExpired(false);a.mouseEnabled=true;a.resetTransform();a.setLocation(0,0);a.alpha=1;a.activated()},switchToScene:function(a,b,c,d){var e=this.getSceneIndex(this.currentScene);d?this.easeInOutRandom(a,e,b,c):this.setScene(a)},switchToPrevScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===0||(c?this.easeInOutRandom(d- 1,d,a,b):this.setScene(d-1))},switchToNextScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===this.getNumScenes()-1||(c?this.easeInOutRandom(d+1,d,a,b):this.setScene(d+1))},mouseEnter:function(){},mouseExit:function(){},mouseMove:function(){},mouseDown:function(){},mouseUp:function(){},mouseDrag:function(){},easeEnd:function(a,b){b?(this.currentScene=a,this.currentScene.activated()):a.setExpired(true);a.mouseEnabled=true;a.emptyBehaviorList()},getSceneIndex:function(a){for(var b= 0;b500&&(b=500);if(this.onRenderStart)this.onRenderStart(b);this.render(b);this.debugInfo&&this.debugInfo(this.statistics);this.timeline=a;if(this.onRenderEnd)this.onRenderEnd(b)},endLoop:function(){},setClear:function(a){this.clear= -a;return this},getAudioManager:function(){return this.audioManager},cumulateOffset:function(a,b,c){var d=c+"Left";c+="Top";for(var e=0,f=0,g;navigator.browser!=="iOS"&&a&&a.style;)if(g=a.currentStyle?a.currentStyle.position:(g=(a.ownerDocument.defaultView||a.ownerDocument.parentWindow).getComputedStyle(a,null))?g.getPropertyValue("position"):null,/^(fixed)$/.test(g))break;else e+=a[d],f+=a[c],a=a[b];return{x:e,y:f,style:g}},getOffset:function(a){var b=this.cumulateOffset(a,"offsetParent","offset"); -return b.style==="fixed"?(a=this.cumulateOffset(a,a.parentNode?"parentNode":"parentElement","scroll"),{x:b.x+a.x,y:b.y+a.y}):{x:b.x,y:b.y}},getCanvasCoord:function(a,b){var c=0,d=0;if(!b)b=window.event;if(b.pageX||b.pageY)c=b.pageX,d=b.pageY;else if(b.clientX||b.clientY)c=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,d=b.clientY+document.body.scrollTop+document.documentElement.scrollTop;var e=this.getOffset(b.target);c-=e.x;d-=e.y;d=new CAAT.Point(c,d);this.modelViewMatrixI= -this.modelViewMatrix.getInverse();this.modelViewMatrixI.transformCoord(d);c=d.x;d=d.y;a.set(c,d);this.screenMousePoint.set(c,d)},__mouseDownHandler:function(a){if(this.dragging&&this.lastSelectedActor)this.__mouseUpHandler(a);else{this.getCanvasCoord(this.mousePoint,a);this.isMouseDown=true;var b=this.findActorAtPosition(this.mousePoint);if(null!==b){var c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0));b.mouseDown((new CAAT.MouseEvent).init(c.x,c.y,a,b,new CAAT.Point(this.screenMousePoint.x, -this.screenMousePoint.y)))}this.lastSelectedActor=b}},__mouseUpHandler:function(a){this.isMouseDown=false;this.getCanvasCoord(this.mousePoint,a);var b=null,c=this.lastSelectedActor;null!==c&&(b=c.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),c.actionPerformed&&c.contains(b.x,b.y)&&c.actionPerformed(a),c.mouseUp((new CAAT.MouseEvent).init(b.x,b.y,a,c,this.screenMousePoint,this.currentScene.time)));!this.dragging&&null!==c&&c.contains(b.x,b.y)&&c.mouseClick((new CAAT.MouseEvent).init(b.x, -b.y,a,c,this.screenMousePoint,this.currentScene.time));this.in_=this.dragging=false},__mouseMoveHandler:function(a){this.getCanvasCoord(this.mousePoint,a);var b,c;if(this.isMouseDown&&null!==this.lastSelectedActor){b=this.lastSelectedActor;c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0));this.dragging=true;var d=b.x,e=b.y;b.mouseDrag((new CAAT.MouseEvent).init(c.x,c.y,a,b,new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y),this.currentScene.time));this.prevMousePoint.x= -c.x;this.prevMousePoint.y=c.y;if(d===b.x&&e===b.y){d=b.contains(c.x,c.y);if(this.in_&&!d)b.mouseExit((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)),this.in_=false;if(!this.in_&&d)b.mouseEnter((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)),this.in_=true}}else this.in_=true,b=this.findActorAtPosition(this.mousePoint),b!==this.lastSelectedActor&&(null!==this.lastSelectedActor&&(c=this.lastSelectedActor.viewToModel(new CAAT.Point(this.screenMousePoint.x, -this.screenMousePoint.y,0)),this.lastSelectedActor.mouseExit((new CAAT.MouseEvent).init(c.x,c.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time))),null!==b&&(c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),b.mouseEnter((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)))),c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),null!==b&&b.mouseMove((new CAAT.MouseEvent).init(c.x,c.y, -a,b,this.screenMousePoint,this.currentScene.time)),this.lastSelectedActor=b},__mouseOutHandler:function(a){if(null!==this.lastSelectedActor){this.getCanvasCoord(this.mousePoint,a);var b=new CAAT.Point(this.mousePoint.x,this.mousePoint.y,0);this.lastSelectedActor.viewToModel(b);a=(new CAAT.MouseEvent).init(b.x,b.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time);this.lastSelectedActor.mouseExit(a);this.lastSelectedActor.mouseOut(a);if(!this.dragging)this.lastSelectedActor=null}else this.in_= -this.isMouseDown=false},__mouseOverHandler:function(a){var b,c;this.getCanvasCoord(this.mousePoint,a);null==this.lastSelectedActor?(b=this.findActorAtPosition(this.mousePoint),null!==b&&(c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),a=(new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time),b.mouseOver(a),b.mouseEnter(a)),this.lastSelectedActor=b):(b=this.lastSelectedActor,c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y, -0)),a=(new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time),b.mouseOver(a),b.mouseEnter(a))},__mouseDBLClickHandler:function(a){this.getCanvasCoord(this.mousePoint,a);null!==this.lastSelectedActor&&this.lastSelectedActor.mouseDblClick((new CAAT.MouseEvent).init(this.mousePoint.x,this.mousePoint.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time))},__touchStartHandler:function(a){a.preventDefault();a=a.targetTouches[0];this.__mouseDownHandler(a)}, -__touchEndHandler:function(a){a.preventDefault();a=a.changedTouches[0];this.__mouseUpHandler(a)},__touchMoveHandler:function(a){a.preventDefault();if(!this.gesturing)for(var b=0;b this.x1 ) { + return false; + } + if ( r.y1< this.y ) { + return false; + } + if ( r.y> this.y1 ) { + return false; + } + + return true; } }; })();/** @@ -5022,10 +5038,9 @@ var cp1= proxy( */ CAAT.Actor = function() { this.behaviorList= []; -// this.keyframesList= []; + this.lifecycleListenerList= []; this.scaleAnchor= this.ANCHOR_CENTER; - this.rotateAnchor= this.ANCHOR_CENTER; this.behaviorList= []; this.domElement= document.createElement('div'); @@ -5041,23 +5056,14 @@ var cp1= proxy( this.modelViewMatrix= new CAAT.Matrix(); this.worldModelViewMatrix= new CAAT.Matrix(); - /* - this.modelViewMatrixI= new CAAT.Matrix(); - this.worldModelViewMatrixI= new CAAT.Matrix(); - this.tmpMatrix= new CAAT.Matrix(); - */ return this; }; CAAT.Actor.prototype= { -// tmpMatrix : null, - lifecycleListenerList: null, // Array of life cycle listener behaviorList: null, // Array of behaviors to apply to the Actor - -// keyframesList: null, x: 0, // x position on parent. In parent's local coord. system. y: 0, // y position on parent. In parent's local coord. system. width: 0, // Actor's width. In parent's local coord. system. @@ -5463,7 +5469,6 @@ var cp1= proxy( */ resetTransform : function () { this.rotationAngle=0; - this.rotateAnchor=0; this.rotationX=.5; this.rotationY=.5; this.scaleX=1; @@ -5527,49 +5532,36 @@ var cp1= proxy( switch( anchor ) { case this.ANCHOR_CENTER: -// tx= this.width/2; -// ty= this.height/2; tx= .5; ty= .5; break; case this.ANCHOR_TOP: -// tx= this.width/2; - tx= .5; + tx= .5; ty= 0; break; case this.ANCHOR_BOTTOM: -// tx= this.width/2; -// ty= this.height; - tx= .5; - ty= 1; + tx= .5; + ty= 1; break; case this.ANCHOR_LEFT: -// tx= 0; -// ty= this.height/2; - tx= 0; - ty= .5; + tx= 0; + ty= .5; break; case this.ANCHOR_RIGHT: -// tx= this.width; -// ty= this.height/2; - tx= 1; - ty= .5; + tx= 1; + ty= .5; break; case this.ANCHOR_TOP_RIGHT: -// tx= this.width; - tx= 1; + tx= 1; ty= 0; break; case this.ANCHOR_BOTTOM_LEFT: tx= 0; -// ty= this.height; - ty= 1; + ty= 1; break; case this.ANCHOR_BOTTOM_RIGHT: -// tx= this.width; -// ty= this.height; - tx= 1; - ty= 1; + tx= 1; + ty= 1; break; case this.ANCHOR_TOP_LEFT: tx= 0; @@ -7558,10 +7550,19 @@ var cp1= proxy( this.lastSelectedActor = null; this.dragging = false; + this.cDirtyRects= []; + this.dirtyRects= []; + for( var i=0; i<64; i++ ) { + this.dirtyRects.push( new CAAT.Rectangle() ); + } + this.dirtyRectsIndex= 0; + return this; }; + CAAT.Director.CLEAR_DIRTY_RECTS= 1; + CAAT.Director.CLEAR_ALL= true; CAAT.Director.prototype = { @@ -7627,10 +7628,15 @@ var cp1= proxy( RESIZE_BOTH: 8, RESIZE_PROPORTIONAL:16, resize: 1, - onResizeCallback: null, + onResizeCallback : null, - __gestureScale : 0, - __gestureRotation : 0, + __gestureScale : 0, + __gestureRotation : 0, + + dirtyRects : null, + cDirtyRects : null, + dirtyRectsIndex : 0, + dirtyRectsEnabled : false, checkDebug : function() { if ( CAAT.DEBUG ) { @@ -8039,6 +8045,8 @@ var cp1= proxy( */ var ne = this.childrenList.length; var i, tt, c; + var ctx= this.ctx; + if (this.glEnabled) { this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT); @@ -8072,11 +8080,24 @@ var cp1= proxy( this.glFlush(); } else { - this.ctx.globalAlpha = 1; - this.ctx.globalCompositeOperation = 'source-over'; + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + + ctx.save(); + if ( this.dirtyRectsEnabled ) { - if (this.clear) { - this.ctx.clearRect(0, 0, this.width, this.height); + ctx.beginPath(); +ctx.rect(0,0,100,40); + var dr= this.cDirtyRects; + for( i=0; i=this.dirtyRects.length ) { + for( i=0; i<32; i++ ) { + this.dirtyRects.push( new CAAT.Rectangle() ); + } + } + + var r= this.dirtyRects[ this.dirtyRectsIndex ]; + + r.x= rectangle.x; + r.y= rectangle.y; + r.x1= rectangle.x1; + r.y1= rectangle.y1; + r.width= rectangle.width; + r.height= rectangle.height; + + this.cDirtyRects.push( r ); + + }, /** * This method draws an Scene to an offscreen canvas. This offscreen canvas is also a child of * another Scene (transitionScene). So instead of drawing two scenes while transitioning from @@ -8743,6 +8828,9 @@ var cp1= proxy( */ setClear : function(clear) { this.clear = clear; + if ( this.clear===CAAT.Director.CLEAR_DIRTY_RECTS ) { + this.dirtyRectsEnabled= true; + } return this; }, /** diff --git a/build/caat-min.js b/build/caat-min.js index 309926de..fe1534ee 100644 --- a/build/caat-min.js +++ b/build/caat-min.js @@ -2,7 +2,7 @@ /* The MIT License -Copyright (c) 2010-2011 Ibon Tolosana [@hyperandroid] +Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -22,11 +22,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Version: 0.1 build: 631 +Version: 0.2 build: 17 Created on: -DATE: 2012-01-21 -TIME: 00:52:09 +DATE: 2012-01-22 +TIME: 17:56:52 */ @@ -59,7 +59,7 @@ b[5]);return this},transformRenderingContextSet_Clamp:function(a){var b=this.mat a[f],h=g>>24&255,i=(g&16711680)>>16,j=(g&65280)>>8;g&=255;for(var k=a[f+1],m=((k>>24&255)-h)/b,n=(((k&16711680)>>16)-i)/b,l=(((k&65280)>>8)-j)/b,k=((k&255)-g)/b,o=0;o>0,q=i+n*o>>0,r=j+l*o>>0,s=g+k*o>>0;switch(c){case this.RampEnumeration.RAMP_RGBA:d.push("argb("+p+","+q+","+r+","+s+")");break;case this.RampEnumeration.RAMP_RGB:d.push("rgb("+q+","+r+","+s+")");break;case this.RampEnumeration.RAMP_CHANNEL_RGB:d.push(4278190080|q<<16|r<<8|s);break;case this.RampEnumeration.RAMP_CHANNEL_RGBA:d.push(p<< 24|q<<16|r<<8|s);break;case this.RampEnumeration.RAMP_CHANNEL_RGBA_ARRAY:d.push([q,r,s,p]);break;case this.RampEnumeration.RAMP_CHANNEL_RGB_ARRAY:d.push([q,r,s])}}}return d}}})();(function(){CAAT.Color.RGB=function(a,b,c){this.r=a||255;this.g=b||255;this.b=c||255;return this};CAAT.Color.RGB.prototype={r:255,g:255,b:255,toHex:function(){return("000000"+((this.r<<16)+(this.g<<8)+this.b).toString(16)).slice(-6)}}})();(function(){CAAT.Rectangle=function(){return this};CAAT.Rectangle.prototype={x:0,y:0,x1:0,y1:0,width:-1,height:-1,setEmpty:function(){this.height=this.width=-1;this.y1=this.x1=this.y=this.x=0;return this},setLocation:function(a,b){this.x=a;this.y=b;this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setDimension:function(a,b){this.width=a;this.height=b;this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setBounds:function(a,b,c,d){this.setLocation(a,b);this.setDimension(c, d);return this},contains:function(a,b){return a>=0&&a=0&&bthis.y1)this.y1=b;if(a>this.x1)this.x1=a;this.width=this.x1-this.x;this.height=this.y1-this.y}},unionRectangle:function(a){this.union(a.x,a.y);this.union(a.x1, -a.y);this.union(a.x,a.y1);this.union(a.x1,a.y1);return this}}})();(function(){CAAT.Curve=function(){return this};CAAT.Curve.prototype={coordlist:null,k:0.05,length:-1,interpolator:false,HANDLE_SIZE:20,drawHandles:true,paint:function(a){if(false!==this.drawHandles){a=a.ctx;a.save();a.beginPath();a.strokeStyle="#a0a0a0";a.moveTo(this.coordlist[0].x,this.coordlist[0].y);a.lineTo(this.coordlist[1].x,this.coordlist[1].y);a.stroke();this.cubic&&(a.moveTo(this.coordlist[2].x,this.coordlist[2].y),a.lineTo(this.coordlist[3].x,this.coordlist[3].y),a.stroke());a.globalAlpha= +a.y);this.union(a.x,a.y1);this.union(a.x1,a.y1);return this},intersects:function(a){return a.x1this.x1?false:a.y1this.y1?false:true}}})();(function(){CAAT.Curve=function(){return this};CAAT.Curve.prototype={coordlist:null,k:0.05,length:-1,interpolator:false,HANDLE_SIZE:20,drawHandles:true,paint:function(a){if(false!==this.drawHandles){a=a.ctx;a.save();a.beginPath();a.strokeStyle="#a0a0a0";a.moveTo(this.coordlist[0].x,this.coordlist[0].y);a.lineTo(this.coordlist[1].x,this.coordlist[1].y);a.stroke();this.cubic&&(a.moveTo(this.coordlist[2].x,this.coordlist[2].y),a.lineTo(this.coordlist[3].x,this.coordlist[3].y),a.stroke());a.globalAlpha= 0.5;for(var b=0;b=0&&bthis.framerate.timeLastRefresh+this.framerate.refreshInterval)this.framerate.fps=this.framerate.frames*1E3/(CAAT.RAF-this.framerate.timeLastRefresh)|0,this.framerate.fpsMin=this.framerate.frames>0?Math.min(this.framerate.fpsMin, this.framerate.fps):this.framerate.fpsMin,this.framerate.fpsMax=Math.max(this.framerate.fpsMax,this.framerate.fps),this.textFPS.innerHTML=this.framerate.fps,a=(this.frameTimeAcc*100/this.framerate.frames|0)/100,this.frameTimeAcc=0,this.textDrawTime.innerHTML=a,a=(this.frameRAFAcc*100/this.framerate.frames|0)/100,this.frameRAFAcc=0,this.textRAFTime.innerHTML=a,this.framerate.timeLastRefresh=CAAT.RAF,this.framerate.frames=0,this.paint(a);this.textEntitiesTotal.innerHTML=this.statistics.size_total;this.textEntitiesActive.innerHTML= this.statistics.size_active;this.textDraws.innerHTML=this.statistics.draws},paint:function(a){var b=this.ctx,c=0;b.drawImage(this.canvas,1,0,this.width-1,this.height,0,0,this.width-1,this.height);b.strokeStyle="black";b.beginPath();b.moveTo(this.width-0.5,0);b.lineTo(this.width-0.5,this.height);b.stroke();b.strokeStyle="#a22";b.beginPath();c=this.height-(20/this.SCALE*this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();b.strokeStyle="#aa2";b.beginPath();c=this.height-(30/this.SCALE* -this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();c=Math.min(this.height-this.framerate.fps/this.SCALE*this.height,59);if(-1===this.framerate.prevFps)this.framerate.prevFps=c|0;b.strokeStyle="#0ff";b.beginPath();b.moveTo(this.width,(c|0)-0.5);b.lineTo(this.width,this.framerate.prevFps-0.5);b.stroke();this.framerate.prevFps=c;a=(this.height-a/this.SCALE*this.height>>0)-0.5;b.strokeStyle="#ff0";b.beginPath();b.moveTo(this.width,a);b.lineTo(this.width,a);b.stroke()}}})();(function(){CAAT.Actor=function(){this.behaviorList=[];this.lifecycleListenerList=[];this.AABB=new CAAT.Rectangle;this.viewVertices=[new CAAT.Point(0,0,0),new CAAT.Point(0,0,0),new CAAT.Point(0,0,0),new CAAT.Point(0,0,0)];this.rotateAnchor=this.scaleAnchor=this.ANCHOR_CENTER;this.modelViewMatrix=new CAAT.Matrix;this.worldModelViewMatrix=new CAAT.Matrix;this.resetTransform();this.setScale(1,1);this.setRotation(0);return this};CAAT.Actor.ANCHOR_CENTER=0;CAAT.Actor.ANCHOR_TOP=1;CAAT.Actor.ANCHOR_BOTTOM= -2;CAAT.Actor.ANCHOR_LEFT=3;CAAT.Actor.ANCHOR_RIGHT=4;CAAT.Actor.ANCHOR_TOP_LEFT=5;CAAT.Actor.ANCHOR_TOP_RIGHT=6;CAAT.Actor.ANCHOR_BOTTOM_LEFT=7;CAAT.Actor.ANCHOR_BOTTOM_RIGHT=8;CAAT.Actor.ANCHOR_CUSTOM=9;CAAT.Actor.prototype={lifecycleListenerList:null,behaviorList:null,parent:null,x:0,y:0,width:0,height:0,start_time:0,duration:Number.MAX_VALUE,clip:false,clipPath:null,scaleX:0,scaleY:0,scaleTX:0.5,scaleTY:0.5,scaleAnchor:0,rotationAngle:0,rotationY:0.5,alpha:1,rotationX:0.5,isGlobalAlpha:false,frameAlpha:1, -expired:false,discardable:false,pointed:false,mouseEnabled:true,visible:true,ANCHOR_CENTER:0,ANCHOR_TOP:1,ANCHOR_BOTTOM:2,ANCHOR_LEFT:3,ANCHOR_RIGHT:4,ANCHOR_TOP_LEFT:5,ANCHOR_TOP_RIGHT:6,ANCHOR_BOTTOM_LEFT:7,ANCHOR_BOTTOM_RIGHT:8,ANCHOR_CUSTOM:9,fillStyle:null,strokeStyle:null,time:0,AABB:null,viewVertices:null,inFrame:false,dirty:true,wdirty:true,oldX:-1,oldY:-1,modelViewMatrix:null,worldModelViewMatrix:null,modelViewMatrixI:null,worldModelViewMatrixI:null,glEnabled:false,backgroundImage:null,id:null, -size_active:1,size_total:1,__next:null,__d_ax:-1,__d_ay:-1,gestureEnabled:false,setGestureEnabled:function(a){this.gestureEnabled=!!a},isGestureEnabled:function(){return this.gestureEnabled},getId:function(){return this.id},setId:function(a){this.id=a;return this},setParent:function(a){this.parent=a;return this},setBackgroundImage:function(a,b){if(a){a instanceof CAAT.SpriteImage||(a=(new CAAT.SpriteImage).initialize(a,1,1));a.setOwner(this);this.backgroundImage=a;if(typeof b==="undefined"||b)this.width= -a.getWidth(),this.height=a.getHeight();this.glEnabled=true}else this.backgroundImage=null;return this},setSpriteIndex:function(a){this.backgroundImage&&this.backgroundImage.setSpriteIndex(a);return this},setBackgroundImageOffset:function(a,b){this.backgroundImage&&this.backgroundImage.setOffset(a,b);return this},setAnimationImageIndex:function(a){this.backgroundImage&&this.backgroundImage.setAnimationImageIndex(a);return this},setChangeFPS:function(a){this.backgroundImage&&this.backgroundImage.setChangeFPS(a); -return this},setImageTransformation:function(a){this.backgroundImage&&this.backgroundImage.setSpriteTransformation(a);return this},centerOn:function(a,b){this.setLocation(a-this.width/2,b-this.height/2);return this},centerAt:function(a,b){return this.centerOn(a,b)},getTextureGLPage:function(){return this.backgroundImage.image.__texturePage},setVisible:function(a){this.visible=a;return this},setOutOfFrameTime:function(){this.setFrameTime(-1,0);return this},addListener:function(a){this.lifecycleListenerList.push(a); -return this},removeListener:function(a){for(var b=this.lifecycleListenerList.length;b--;)if(this.lifecycleListenerList[b]===a){this.lifecycleListenerList.splice(b,1);break}},setGlobalAlpha:function(a){this.isGlobalAlpha=a;return this},fireEvent:function(a,b){for(var c=0;cb)b=this.viewVertices[e].x;if(this.viewVertices[e].yd)d=this.viewVertices[e].y}this.AABB.x=a;this.AABB.y=c;this.AABB.width=b-a;this.AABB.height=d-c;return this},setExpired:function(a){this.expired= -true;this.fireEvent("expired",a);return this},enableEvents:function(a){this.mouseEnabled=a;return this},emptyBehaviorList:function(){this.behaviorList=[];return this},setFillStyle:function(a){this.fillStyle=a;return this},setStrokeStyle:function(a){this.strokeStyle=a;return this},setPaint:function(a){return this.setFillStyle(a)},setAlpha:function(a){this.alpha=a;return this},resetTransform:function(){this.rotateAnchor=this.rotationAngle=0;this.rotationY=this.rotationX=0.5;this.scaleY=this.scaleX= -1;this.scaleTY=this.scaleTX=0.5;this.scaleAnchor=0;this.oldY=this.oldX=-1;this.dirty=true;return this},setFrameTime:function(a,b){this.start_time=a;this.duration=b;this.expired=false;this.dirty=true;return this},paint:function(a,b){if(this.backgroundImage)this.backgroundImage.paint(a,b,0,0);else if(this.fillStyle){var c=a.crc;c.fillStyle=this.fillStyle;c.fillRect(0,0,this.width,this.height)}},setScale:function(a,b){this.setScaleAnchored(a,b,0.5,0.5);this.dirty=true;return this},getAnchorPercent:function(a){var b= -[0.5,0.5,0.5,0,0.5,1,0,0.5,1,0.5,0,0,1,0,0,1,1,1];return{x:b[a*2],y:b[a*2+1]}},getAnchor:function(a){var b=0,c=0;switch(a){case this.ANCHOR_CENTER:c=b=0.5;break;case this.ANCHOR_TOP:b=0.5;c=0;break;case this.ANCHOR_BOTTOM:b=0.5;c=1;break;case this.ANCHOR_LEFT:b=0;c=0.5;break;case this.ANCHOR_RIGHT:b=1;c=0.5;break;case this.ANCHOR_TOP_RIGHT:b=1;c=0;break;case this.ANCHOR_BOTTOM_LEFT:b=0;c=1;break;case this.ANCHOR_BOTTOM_RIGHT:c=b=1;break;case this.ANCHOR_TOP_LEFT:c=b=0}return{x:b,y:c}},setScaleAnchored:function(a, -b,c,d){this.scaleTX=c;this.scaleTY=d;this.scaleX=a;this.scaleY=b;this.dirty=true;return this},setRotation:function(a){this.setRotationAnchored(a,0.5,0.5);return this},setRotationAnchored:function(a,b,c){this.rotationAngle=a;this.rotationX=b?b:0;this.rotationY=c?c:0;this.dirty=true;return this},setSize:function(a,b){this.width=a|0;this.height=b|0;this.dirty=true;return this},setBounds:function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d;this.dirty=true;return this},setLocation:function(a, -b){this.x=a;this.y=b;this.oldX=a;this.oldY=b;this.dirty=true;return this},isInAnimationFrame:function(a){if(this.expired)return false;if(this.duration===Number.MAX_VALUE)return this.start_time<=a;return a>=this.start_time+this.duration?(this.expired||this.setExpired(a),false):this.start_time<=a&&a=0&&b>=0&&a>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();c=Math.min(this.height-this.framerate.fps/this.SCALE*this.height,59);if(-1===this.framerate.prevFps)this.framerate.prevFps=c|0;b.strokeStyle="#0ff";b.beginPath();b.moveTo(this.width,(c|0)-0.5);b.lineTo(this.width,this.framerate.prevFps-0.5);b.stroke();this.framerate.prevFps=c;a=(this.height-a/this.SCALE*this.height>>0)-0.5;b.strokeStyle="#ff0";b.beginPath();b.moveTo(this.width,a);b.lineTo(this.width,a);b.stroke()}}})();(function(){CAAT.Actor=function(){this.behaviorList=[];this.lifecycleListenerList=[];this.AABB=new CAAT.Rectangle;this.viewVertices=[new CAAT.Point(0,0,0),new CAAT.Point(0,0,0),new CAAT.Point(0,0,0),new CAAT.Point(0,0,0)];this.scaleAnchor=this.ANCHOR_CENTER;this.modelViewMatrix=new CAAT.Matrix;this.worldModelViewMatrix=new CAAT.Matrix;this.resetTransform();this.setScale(1,1);this.setRotation(0);return this};CAAT.Actor.ANCHOR_CENTER=0;CAAT.Actor.ANCHOR_TOP=1;CAAT.Actor.ANCHOR_BOTTOM=2;CAAT.Actor.ANCHOR_LEFT= +3;CAAT.Actor.ANCHOR_RIGHT=4;CAAT.Actor.ANCHOR_TOP_LEFT=5;CAAT.Actor.ANCHOR_TOP_RIGHT=6;CAAT.Actor.ANCHOR_BOTTOM_LEFT=7;CAAT.Actor.ANCHOR_BOTTOM_RIGHT=8;CAAT.Actor.ANCHOR_CUSTOM=9;CAAT.Actor.prototype={lifecycleListenerList:null,behaviorList:null,parent:null,x:0,y:0,width:0,height:0,start_time:0,duration:Number.MAX_VALUE,clip:false,clipPath:null,scaleX:0,scaleY:0,scaleTX:0.5,scaleTY:0.5,scaleAnchor:0,rotationAngle:0,rotationY:0.5,alpha:1,rotationX:0.5,isGlobalAlpha:false,frameAlpha:1,expired:false, +discardable:false,pointed:false,mouseEnabled:true,visible:true,ANCHOR_CENTER:0,ANCHOR_TOP:1,ANCHOR_BOTTOM:2,ANCHOR_LEFT:3,ANCHOR_RIGHT:4,ANCHOR_TOP_LEFT:5,ANCHOR_TOP_RIGHT:6,ANCHOR_BOTTOM_LEFT:7,ANCHOR_BOTTOM_RIGHT:8,ANCHOR_CUSTOM:9,fillStyle:null,strokeStyle:null,time:0,AABB:null,viewVertices:null,inFrame:false,dirty:true,wdirty:true,oldX:-1,oldY:-1,modelViewMatrix:null,worldModelViewMatrix:null,modelViewMatrixI:null,worldModelViewMatrixI:null,glEnabled:false,backgroundImage:null,id:null,size_active:1, +size_total:1,__next:null,__d_ax:-1,__d_ay:-1,gestureEnabled:false,invalid:true,invalidate:function(){this.invalid=true},setGestureEnabled:function(a){this.gestureEnabled=!!a},isGestureEnabled:function(){return this.gestureEnabled},getId:function(){return this.id},setId:function(a){this.id=a;return this},setParent:function(a){this.parent=a;return this},setBackgroundImage:function(a,b){if(a){a instanceof CAAT.SpriteImage||(a=(new CAAT.SpriteImage).initialize(a,1,1));a.setOwner(this);this.backgroundImage= +a;if(typeof b==="undefined"||b)this.width=a.getWidth(),this.height=a.getHeight();this.glEnabled=true}else this.backgroundImage=null;return this},setSpriteIndex:function(a){this.backgroundImage&&this.backgroundImage.setSpriteIndex(a);return this},setBackgroundImageOffset:function(a,b){this.backgroundImage&&this.backgroundImage.setOffset(a,b);return this},setAnimationImageIndex:function(a){this.backgroundImage&&this.backgroundImage.setAnimationImageIndex(a);return this},setChangeFPS:function(a){this.backgroundImage&& +this.backgroundImage.setChangeFPS(a);return this},setImageTransformation:function(a){this.backgroundImage&&this.backgroundImage.setSpriteTransformation(a);return this},centerOn:function(a,b){this.setLocation(a-this.width/2,b-this.height/2);return this},centerAt:function(a,b){return this.centerOn(a,b)},getTextureGLPage:function(){return this.backgroundImage.image.__texturePage},setVisible:function(a){this.visible=a;return this},setOutOfFrameTime:function(){this.setFrameTime(-1,0);return this},addListener:function(a){this.lifecycleListenerList.push(a); +return this},removeListener:function(a){for(var b=this.lifecycleListenerList.length;b--;)if(this.lifecycleListenerList[b]===a){this.lifecycleListenerList.splice(b,1);break}},setGlobalAlpha:function(a){this.isGlobalAlpha=a;return this},fireEvent:function(a,b){for(var c=0;c=this.start_time+this.duration?(this.expired||this.setExpired(a),false):this.start_time<=a&&a=0&&b>=0&&ac)c=a[f].x;if(a[f].ye)e=a[f].y}a=this.AABB;a.x=b;a.y=d;a.x1=c;a.y1=e;a.width=c-b;a.height=e-d;return this},paintActor:function(a,b){if(!this.visible)return true;var c=a.ctx;this.frameAlpha=this.parent?this.parent.frameAlpha*this.alpha:1;c.globalAlpha=this.frameAlpha;a.modelViewMatrix.transformRenderingContextSet(c);c.save();this.worldModelViewMatrix.transformRenderingContext(c);this.clip&&(c.beginPath(),this.clipPath?this.clipPath.applyAsPath(a): +c.rect(0,0,this.width,this.height),c.clip());this.paint(a,b);c.restore();return true},__paintActor:function(a,b){if(!this.visible)return true;var c=a.ctx;this.frameAlpha=this.alpha;var d=this.worldModelViewMatrix.matrix;c.setTransform(d[0],d[3],d[1],d[4],d[2],d[5],this.frameAlpha);this.paint(a,b);return true},paintActorGL:function(a){this.frameAlpha=this.parent.frameAlpha*this.alpha;if(this.glEnabled&&this.visible)if(this.glNeedsFlush(a)){a.glFlush();this.glSetShader(a);if(!this.__uv)this.__uv=new Float32Array(8); +if(!this.__vv)this.__vv=new Float32Array(12);this.setGLCoords(this.__vv,0);this.setUV(this.__uv,0);a.glRender(this.__vv,12,this.__uv)}else{var b=a.coordsIndex;this.setGLCoords(a.coords,b);a.coordsIndex=b+12;this.setUV(a.uv,a.uvIndex);a.uvIndex+=8}},setGLCoords:function(a,b){var c=this.viewVertices;a[b++]=c[0].x;a[b++]=c[0].y;a[b++]=0;a[b++]=c[1].x;a[b++]=c[1].y;a[b++]=0;a[b++]=c[2].x;a[b++]=c[2].y;a[b++]=0;a[b++]=c[3].x;a[b++]=c[3].y;a[b++]=0},setUV:function(a,b){this.backgroundImage.setUV(a,b)}, +glNeedsFlush:function(a){return this.getTextureGLPage()!==a.currentTexturePage?true:this.frameAlpha!==a.currentOpacity?true:false},glSetShader:function(a){var b=this.getTextureGLPage();b!==a.currentTexturePage&&a.setGLTexturePage(b);this.frameAlpha!==a.currentOpacity&&a.setGLCurrentOpacity(this.frameAlpha)},endAnimate:function(){return this},initialize:function(a){if(a)for(var b in a)this[b]=a[b];return this},setClip:function(a,b){this.clip=a;this.clipPath=b;return this},cacheAsBitmap:function(a){var a= +a||0,b=document.createElement("canvas");b.width=this.width;b.height=this.height;var c=b.getContext("2d");this.paintActor({ctx:c,crc:c,modelViewMatrix:new CAAT.Matrix},a);this.setBackgroundImage(b);return this},setAsButton:function(a,b,c,d,e,f){this.setBackgroundImage(a,true);this.iNormal=b||0;this.iOver=c||b;this.iPress=d||b;this.iDisabled=e||b;this.fnOnClick=f;this.enabled=true;this.setSpriteIndex(b);this.setEnabled=function(a){this.enabled=a;this.setSpriteIndex(this.enabled?this.iNormal:this.iDisabled)}; +this.actionPerformed=function(){this.enabled&&null!==this.fnOnClick&&this.fnOnClick(this)};this.mouseEnter=function(){this.enabled&&(this.dragging?this.setSpriteIndex(this.iPress):this.setSpriteIndex(this.iOver),CAAT.setCursor("pointer"))};this.mouseExit=function(){this.enabled&&(this.setSpriteIndex(this.iNormal),CAAT.setCursor("default"))};this.mouseDown=function(){this.enabled&&this.setSpriteIndex(this.iPress)};this.mouseUp=function(){if(this.enabled)this.setSpriteIndex(this.iNormal),this.dragging= +false};this.mouseClick=function(){};this.mouseDrag=function(){if(this.enabled)this.dragging=true};this.setButtonImageIndex=function(a,b,c,d){this.iNormal=a;this.iOver=b;this.iPress=c;this.iDisabled=d;this.setSpriteIndex(this.iNormal);return this};return this}};if(CAAT.NO_PERF)CAAT.Actor.prototype.paintActor=CAAT.Actor.prototype.__paintActor})(); (function(){CAAT.ActorContainer=function(a){CAAT.ActorContainer.superclass.constructor.call(this);this.childrenList=[];this.pendingChildrenList=[];if(typeof a!=="undefined")this.addHint=a,this.boundingBox=new CAAT.Rectangle;return this};CAAT.ActorContainer.AddHint={CONFORM:1};CAAT.ActorContainer.prototype={childrenList:null,activeChildren:null,pendingChildrenList:null,addHint:0,boundingBox:null,runion:new CAAT.Rectangle,drawScreenBoundingBox:function(a,b){if(this.inFrame){for(var c=this.childrenList, -d=0;d=this.childrenList.length)b=this.childrenList.length;a.parent=this;a.dirty=true;this.childrenList.splice(b,0,a);return this},findChild:function(a){for(var b=this.childrenList,c=0,d=b.length,c=0;c=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},destroy:function(){for(var a=this.childrenList,b=a.length-1;b>=0;b--)a[b].destroy();CAAT.ActorContainer.superclass.destroy.call(this);return this},getNumChildren:function(){return this.childrenList.length},getNumActiveChildren:function(){return this.activeChildren.length},getChildAt:function(a){return this.childrenList[a]},setZOrder:function(a,b){var c= -this.findChild(a);if(-1!==c){var d=this.childrenList;if(b!==c)if(b>=d.length)d.splice(c,1),d.push(a);else{c=d.splice(c,1);if(b<0)b=0;else if(b>d.length)b=d.length;d.splice(b,0,c[0])}}}};if(CAAT.NO_PERF)CAAT.ActorContainer.prototype.paintActor=CAAT.ActorContainer.prototype.__paintActor;extend(CAAT.ActorContainer,CAAT.Actor,null)})(); +d=0;d=this.childrenList.length)b=this.childrenList.length; +a.parent=this;a.dirty=true;this.childrenList.splice(b,0,a);return this},findChild:function(a){for(var b=this.childrenList,c=0,d=b.length,c=0;c=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x, +a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},destroy:function(){for(var a=this.childrenList,b=a.length-1;b>=0;b--)a[b].destroy();CAAT.ActorContainer.superclass.destroy.call(this);return this},getNumChildren:function(){return this.childrenList.length},getNumActiveChildren:function(){return this.activeChildren.length},getChildAt:function(a){return this.childrenList[a]},setZOrder:function(a,b){var c=this.findChild(a);if(-1!==c){var d=this.childrenList;if(b!==c)if(b>=d.length)d.splice(c, +1),d.push(a);else{c=d.splice(c,1);if(b<0)b=0;else if(b>d.length)b=d.length;d.splice(b,0,c[0])}}}};if(CAAT.NO_PERF)CAAT.ActorContainer.prototype.paintActor=CAAT.ActorContainer.prototype.__paintActor;extend(CAAT.ActorContainer,CAAT.Actor,null)})(); (function(){CAAT.TextActor=function(){CAAT.TextActor.superclass.constructor.call(this);this.font="10px sans-serif";this.textAlign="left";this.textBaseline="top";this.outlineColor="black";this.clip=false;return this};CAAT.TextActor.TRAVERSE_PATH_FORWARD=1;CAAT.TextActor.TRAVERSE_PATH_BACKWARD=-1;CAAT.TextActor.prototype={font:null,textAlign:null,textBaseline:null,fill:true,text:null,textWidth:0,textHeight:0,outline:false,outlineColor:null,path:null,pathInterpolator:null,pathDuration:1E4,sign:1,setFill:function(a){this.fill= a;return this},setOutline:function(a){this.outline=a;return this},setPathTraverseDirection:function(a){this.sign=a;return this},setOutlineColor:function(a){this.outlineColor=a;return this},setText:function(a){this.text=a;this.setFont(this.font);return this},setTextAlign:function(a){this.textAlign=a;return this},setAlign:function(a){return this.setTextAlign(a)},setTextBaseline:function(a){this.textBaseline=a;return this},setBaseline:function(a){return this.setTextBaseline(a)},setFont:function(a){if(!a)return this; this.font=a;if(null===this.text||this.text==="")this.width=this.height=0;return this},calcTextSize:function(a){if(a.glEnabled)return this;a.ctx.save();a.ctx.font=this.font;this.textWidth=a.crc.measureText(this.text).width;if(this.width===0)this.width=this.textWidth;try{var b=this.font.substring(0,this.font.indexOf("px"));this.textHeight=parseInt(b,10);this.textHeight+=this.textHeight/4>>0}catch(c){this.textHeight=20}if(this.height===0)this.height=this.textHeight;a.crc.restore();return this},paint:function(a, @@ -185,51 +185,54 @@ this.getChildAt(a),b.y=c,c+=b.height,b.x=this.layoutOp===this.OP_LAYOUT_LEFT?0:t c,"height").setFrameTime(this.scene.time,250));a===this.getNumChildren()-1&&c.behaviorList[0].addListener({behaviorApplied:function(a,b,c,g){g.parent.layout()},behaviorExpired:function(d,e,f){for(a=0;ad+this.range?this.minSize:a===d?this.maxSize:a=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},resetStats:function(){this.statistics.size_total= -0;this.statistics.size_active=0;this.statistics.draws=0},render:function(a){this.time+=a;this.animate(this,a);CAAT.DEBUG&&this.resetStats();var b=this.childrenList.length,c,d,e;if(this.glEnabled){this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT);for(c=this.uvIndex=this.coordsIndex=0;c=0;b--){var c=this.childrenList[b],d=new CAAT.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},resetStats:function(){this.statistics.size_total=0;this.statistics.size_active=0;this.statistics.draws=0},render:function(a){this.time+=a;this.animate(this,a);CAAT.DEBUG&&this.resetStats();var b=this.childrenList.length,c,d,e,f=this.ctx;if(this.glEnabled){this.gl.clear(this.gl.COLOR_BUFFER_BIT| +this.gl.DEPTH_BUFFER_BIT);for(c=this.uvIndex=this.coordsIndex=0;c=this.dirtyRects.length)for(b=0;b<32;b++)this.dirtyRects.push(new CAAT.Rectangle);b=this.dirtyRects[this.dirtyRectsIndex];b.x=a.x;b.y=a.y;b.x1=a.x1;b.y1=a.y1;b.width=a.width;b.height=a.height;this.cDirtyRects.push(b)}},renderToContext:function(a,b){if(b.isInAnimationFrame(this.time)){a.globalAlpha=1;a.globalCompositeOperation= +"source-over";a.clearRect(0,0,this.width,this.height);a.setTransform(1,0,0,0,1,0);var c=this.ctx,d=this.crc;this.ctx=this.crc=a;a.save();var e=this.worldModelViewMatrix;this.worldModelViewMatrix=new CAAT.Matrix;this.wdirty=true;b.animate(this,b.time);if(b.onRenderStart)b.onRenderStart(b.time);b.paintActor(this,b.time);if(b.onRenderEnd)b.onRenderEnd(b.time);this.worldModelViewMatrix=e;a.restore();this.ctx=c;this.crc=d}},addScene:function(a){a.setBounds(0,0,this.width,this.height);this.scenes.push(a); +a.setEaseListener(this);null===this.currentScene&&this.setScene(0)},getNumScenes:function(){return this.scenes.length},easeInOut:function(a,b,c,d,e,f,g,h,i,j){if(a!==this.getCurrentSceneIndex()){a=this.scenes[a];d=this.scenes[d];if(!this.glEnabled&&!navigator.browser==="iOS")this.worldModelViewMatrix.transformRenderingContext(this.transitionScene.ctx),this.renderToContext(this.transitionScene.ctx,d),d=this.transitionScene;a.setExpired(false);d.setExpired(false);a.mouseEnabled=false;d.mouseEnabled= +false;a.resetTransform();d.resetTransform();a.setLocation(0,0);d.setLocation(0,0);a.alpha=1;d.alpha=1;b===CAAT.Scene.prototype.EASE_ROTATION?a.easeRotationIn(g,h,c,i):b===CAAT.Scene.prototype.EASE_SCALE?a.easeScaleIn(0,g,h,c,i):a.easeTranslationIn(g,h,c,i);e===CAAT.Scene.prototype.EASE_ROTATION?d.easeRotationOut(g,h,f,j):e===CAAT.Scene.prototype.EASE_SCALE?d.easeScaleOut(0,g,h,f,j):d.easeTranslationOut(g,h,f,j);this.childrenList=[];this.addChild(d);this.addChild(a)}},easeInOutRandom:function(a,b, +c,d){var e=Math.random(),f=Math.random(),g;e<0.33?(e=CAAT.Scene.prototype.EASE_ROTATION,g=(new CAAT.Interpolator).createExponentialInOutInterpolator(4)):e<0.66?(e=CAAT.Scene.prototype.EASE_SCALE,g=(new CAAT.Interpolator).createElasticOutInterpolator(1.1,0.4)):(e=CAAT.Scene.prototype.EASE_TRANSLATE,g=(new CAAT.Interpolator).createBounceOutInterpolator());var h;f<0.33?(f=CAAT.Scene.prototype.EASE_ROTATION,h=(new CAAT.Interpolator).createExponentialInOutInterpolator(4)):f<0.66?(f=CAAT.Scene.prototype.EASE_SCALE, h=(new CAAT.Interpolator).createExponentialOutInterpolator(4)):(f=CAAT.Scene.prototype.EASE_TRANSLATE,h=(new CAAT.Interpolator).createBounceOutInterpolator());this.easeInOut(a,e,Math.random()*8.99>>0,b,f,Math.random()*8.99>>0,c,d,g,h)},easeIn:function(a,b,c,d,e,f){a=this.scenes[a];b===CAAT.Scene.prototype.EASE_ROTATION?a.easeRotationIn(c,d,e,f):b===CAAT.Scene.prototype.EASE_SCALE?a.easeScaleIn(0,c,d,e,f):a.easeTranslationIn(c,d,e,f);this.childrenList=[];this.addChild(a);a.resetTransform();a.setLocation(0, 0);a.alpha=1;a.mouseEnabled=false;a.setExpired(false)},setScene:function(a){a=this.scenes[a];this.childrenList=[];this.addChild(a);this.currentScene=a;a.setExpired(false);a.mouseEnabled=true;a.resetTransform();a.setLocation(0,0);a.alpha=1;a.activated()},switchToScene:function(a,b,c,d){var e=this.getSceneIndex(this.currentScene);d?this.easeInOutRandom(a,e,b,c):this.setScene(a)},switchToPrevScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===0||(c?this.easeInOutRandom(d- 1,d,a,b):this.setScene(d-1))},switchToNextScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===this.getNumScenes()-1||(c?this.easeInOutRandom(d+1,d,a,b):this.setScene(d+1))},mouseEnter:function(){},mouseExit:function(){},mouseMove:function(){},mouseDown:function(){},mouseUp:function(){},mouseDrag:function(){},easeEnd:function(a,b){b?(this.currentScene=a,this.currentScene.activated()):a.setExpired(true);a.mouseEnabled=true;a.emptyBehaviorList()},getSceneIndex:function(a){for(var b= 0;b500&&(b=500);if(this.onRenderStart)this.onRenderStart(b);this.render(b);this.debugInfo&&this.debugInfo(this.statistics);this.timeline=a;if(this.onRenderEnd)this.onRenderEnd(b)},endLoop:function(){},setClear:function(a){this.clear= -a;return this},getAudioManager:function(){return this.audioManager},cumulateOffset:function(a,b,c){var d=c+"Left";c+="Top";for(var e=0,f=0,g;navigator.browser!=="iOS"&&a&&a.style;)if(g=a.currentStyle?a.currentStyle.position:(g=(a.ownerDocument.defaultView||a.ownerDocument.parentWindow).getComputedStyle(a,null))?g.getPropertyValue("position"):null,/^(fixed)$/.test(g))break;else e+=a[d],f+=a[c],a=a[b];return{x:e,y:f,style:g}},getOffset:function(a){var b=this.cumulateOffset(a,"offsetParent","offset"); -return b.style==="fixed"?(a=this.cumulateOffset(a,a.parentNode?"parentNode":"parentElement","scroll"),{x:b.x+a.x,y:b.y+a.y}):{x:b.x,y:b.y}},getCanvasCoord:function(a,b){var c=0,d=0;if(!b)b=window.event;if(b.pageX||b.pageY)c=b.pageX,d=b.pageY;else if(b.clientX||b.clientY)c=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,d=b.clientY+document.body.scrollTop+document.documentElement.scrollTop;var e=this.getOffset(b.target);c-=e.x;d-=e.y;d=new CAAT.Point(c,d);this.modelViewMatrixI= -this.modelViewMatrix.getInverse();this.modelViewMatrixI.transformCoord(d);c=d.x;d=d.y;a.set(c,d);this.screenMousePoint.set(c,d)},__mouseDownHandler:function(a){if(this.dragging&&this.lastSelectedActor)this.__mouseUpHandler(a);else{this.getCanvasCoord(this.mousePoint,a);this.isMouseDown=true;var b=this.findActorAtPosition(this.mousePoint);if(null!==b){var c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0));b.mouseDown((new CAAT.MouseEvent).init(c.x,c.y,a,b,new CAAT.Point(this.screenMousePoint.x, -this.screenMousePoint.y)))}this.lastSelectedActor=b}},__mouseUpHandler:function(a){this.isMouseDown=false;this.getCanvasCoord(this.mousePoint,a);var b=null,c=this.lastSelectedActor;null!==c&&(b=c.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),c.actionPerformed&&c.contains(b.x,b.y)&&c.actionPerformed(a),c.mouseUp((new CAAT.MouseEvent).init(b.x,b.y,a,c,this.screenMousePoint,this.currentScene.time)));!this.dragging&&null!==c&&c.contains(b.x,b.y)&&c.mouseClick((new CAAT.MouseEvent).init(b.x, -b.y,a,c,this.screenMousePoint,this.currentScene.time));this.in_=this.dragging=false},__mouseMoveHandler:function(a){this.getCanvasCoord(this.mousePoint,a);var b,c;if(this.isMouseDown&&null!==this.lastSelectedActor){b=this.lastSelectedActor;c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0));this.dragging=true;var d=b.x,e=b.y;b.mouseDrag((new CAAT.MouseEvent).init(c.x,c.y,a,b,new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y),this.currentScene.time));this.prevMousePoint.x= -c.x;this.prevMousePoint.y=c.y;if(d===b.x&&e===b.y){d=b.contains(c.x,c.y);if(this.in_&&!d)b.mouseExit((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)),this.in_=false;if(!this.in_&&d)b.mouseEnter((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)),this.in_=true}}else this.in_=true,b=this.findActorAtPosition(this.mousePoint),b!==this.lastSelectedActor&&(null!==this.lastSelectedActor&&(c=this.lastSelectedActor.viewToModel(new CAAT.Point(this.screenMousePoint.x, -this.screenMousePoint.y,0)),this.lastSelectedActor.mouseExit((new CAAT.MouseEvent).init(c.x,c.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time))),null!==b&&(c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),b.mouseEnter((new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time)))),c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),null!==b&&b.mouseMove((new CAAT.MouseEvent).init(c.x,c.y, -a,b,this.screenMousePoint,this.currentScene.time)),this.lastSelectedActor=b},__mouseOutHandler:function(a){if(null!==this.lastSelectedActor){this.getCanvasCoord(this.mousePoint,a);var b=new CAAT.Point(this.mousePoint.x,this.mousePoint.y,0);this.lastSelectedActor.viewToModel(b);a=(new CAAT.MouseEvent).init(b.x,b.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time);this.lastSelectedActor.mouseExit(a);this.lastSelectedActor.mouseOut(a);if(!this.dragging)this.lastSelectedActor=null}else this.in_= -this.isMouseDown=false},__mouseOverHandler:function(a){var b,c;this.getCanvasCoord(this.mousePoint,a);null==this.lastSelectedActor?(b=this.findActorAtPosition(this.mousePoint),null!==b&&(c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),a=(new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time),b.mouseOver(a),b.mouseEnter(a)),this.lastSelectedActor=b):(b=this.lastSelectedActor,c=b.viewToModel(new CAAT.Point(this.screenMousePoint.x,this.screenMousePoint.y, -0)),a=(new CAAT.MouseEvent).init(c.x,c.y,a,b,this.screenMousePoint,this.currentScene.time),b.mouseOver(a),b.mouseEnter(a))},__mouseDBLClickHandler:function(a){this.getCanvasCoord(this.mousePoint,a);null!==this.lastSelectedActor&&this.lastSelectedActor.mouseDblClick((new CAAT.MouseEvent).init(this.mousePoint.x,this.mousePoint.y,a,this.lastSelectedActor,this.screenMousePoint,this.currentScene.time))},__touchStartHandler:function(a){a.preventDefault();a=a.targetTouches[0];this.__mouseDownHandler(a)}, -__touchEndHandler:function(a){a.preventDefault();a=a.changedTouches[0];this.__mouseUpHandler(a)},__touchMoveHandler:function(a){a.preventDefault();if(!this.gesturing)for(var b=0;b this.x1 ) { + return false; + } + if ( r.y1< this.y ) { + return false; + } + if ( r.y> this.y1 ) { + return false; + } + + return true; } }; })();/** @@ -5033,7 +5049,6 @@ var cp1= proxy( ]; this.scaleAnchor= this.ANCHOR_CENTER; - this.rotateAnchor= this.ANCHOR_CENTER; this.modelViewMatrix= new CAAT.Matrix(); this.worldModelViewMatrix= new CAAT.Matrix(); @@ -5138,6 +5153,11 @@ var cp1= proxy( __d_ay: -1, gestureEnabled: false, + invalid : true, + + invalidate : function() { + this.invalid= true; + }, setGestureEnabled : function( enable ) { this.gestureEnabled= !!enable; }, @@ -5361,48 +5381,6 @@ var cp1= proxy( this.lifecycleListenerList[i].actorLifeCycleEvent(this, sEventType, time); } }, - /** - * Calculates the 2D bounding box in canvas coordinates of the Actor. - * This bounding box takes into account the transformations applied hierarchically for - * each Scene Actor. - * - * @private - * - */ - setScreenBounds : function() { - - this.viewVertices[0].set(0, 0); - this.viewVertices[1].set(this.width, 0); - this.viewVertices[2].set(this.width, this.height); - this.viewVertices[3].set(0, this.height); - - this.modelToView( this.viewVertices ); - - var xmin= Number.MAX_VALUE, xmax=Number.MIN_VALUE; - var ymin= Number.MAX_VALUE, ymax=Number.MIN_VALUE; - - for( var i=0; i<4; i++ ) { - if ( this.viewVertices[i].x < xmin ) { - xmin=this.viewVertices[i].x; - } - if ( this.viewVertices[i].x > xmax ) { - xmax=this.viewVertices[i].x; - } - if ( this.viewVertices[i].y < ymin ) { - ymin=this.viewVertices[i].y; - } - if ( this.viewVertices[i].y > ymax ) { - ymax=this.viewVertices[i].y; - } - } - - this.AABB.x= xmin; - this.AABB.y= ymin; - this.AABB.width= (xmax-xmin); - this.AABB.height= (ymax-ymin); - - return this; - }, /** * Sets this Actor as Expired. * If this is a Container, all the contained Actors won't be nor drawn nor will receive @@ -5481,7 +5459,6 @@ var cp1= proxy( */ resetTransform : function () { this.rotationAngle=0; - this.rotateAnchor=0; this.rotationX=.5; this.rotationY=.5; this.scaleX=1; @@ -5857,13 +5834,25 @@ var cp1= proxy( * */ modelToView : function(point) { + + var tm= this.worldModelViewMatrix.matrix; + if ( point instanceof Array ) { for( var i=0; i xmax ) { + xmax=vv[i].x; + } + if ( vv[i].y < ymin ) { + ymin=vv[i].y; + } + if ( vv[i].y > ymax ) { + ymax=vv[i].y; + } + } + + var AABB= this.AABB; + AABB.x= xmin; + AABB.y= ymin; + AABB.x1= xmax; + AABB.y1= ymax; + AABB.width= (xmax-xmin); + AABB.height= (ymax-ymin); return this; }, @@ -6296,6 +6327,9 @@ var cp1= proxy( this.frameAlpha= this.parent ? this.parent.frameAlpha*this.alpha : 1; ctx.globalAlpha= this.frameAlpha; + director.modelViewMatrix.transformRenderingContextSet( ctx ); + ctx.save(); + this.worldModelViewMatrix.transformRenderingContext(ctx); if ( this.clip ) { @@ -6310,6 +6344,8 @@ var cp1= proxy( this.paint(director, time); + ctx.restore(); + return true; }, /** @@ -6723,10 +6759,6 @@ var cp1= proxy( } var ctx= director.ctx; - var dmvm= director.modelViewMatrix; - - ctx.save(); -// dmvm.transformRenderingContextSet( ctx ); CAAT.ActorContainer.superclass.paintActor.call(this,director,time); if ( !this.isGlobalAlpha ) { @@ -6735,13 +6767,9 @@ var cp1= proxy( for( var actor= this.activeChildren; actor; actor=actor.__next ) { if ( actor.visible ) { - dmvm.transformRenderingContextSet( ctx ); - ctx.save(); actor.paintActor(director,time); - ctx.restore(); } } - ctx.restore(); return true; }, @@ -6846,7 +6874,11 @@ var cp1= proxy( } for( i=0, l=markDelete.length; i=this.dirtyRects.length ) { + for( i=0; i<32; i++ ) { + this.dirtyRects.push( new CAAT.Rectangle() ); + } + } + + var r= this.dirtyRects[ this.dirtyRectsIndex ]; + + r.x= rectangle.x; + r.y= rectangle.y; + r.x1= rectangle.x1; + r.y1= rectangle.y1; + r.width= rectangle.width; + r.height= rectangle.height; + + this.cDirtyRects.push( r ); + + }, /** * This method draws an Scene to an offscreen canvas. This offscreen canvas is also a child of * another Scene (transitionScene). So instead of drawing two scenes while transitioning from @@ -9760,6 +9885,9 @@ var cp1= proxy( */ setClear : function(clear) { this.clear = clear; + if ( this.clear===CAAT.Director.CLEAR_DIRTY_RECTS ) { + this.dirtyRectsEnabled= true; + } return this; }, /** diff --git a/changelog b/changelog index 9ead3f39..5f660db3 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,14 @@ +01/22/2012 *0.2 Build 18* +-------------------------- + +* Added dirty rectangles clear support. + To be enabled a call director.setClear( CAAT.Director.CLEAR_DIRTY_RECTS ); must be performed. + Every actor which changes affine transformation, either position, rotation or scale, will automatically + be invalidated. In you want any other actor to be explicitly invalidated, just call actor.invalidate(); +* Cleaned some ctx.save/restore code. +* Modified license file to reflect copyright 2012. + + 01/20/2012 *0.1 Build 631* -------------------------- @@ -17,7 +28,7 @@ 01/19/2012 *0.1 Build 610* -------------------------- -* Fixed a but which prevented scaled directors to properly show bounding boxes. +* Fixed a bug which prevented scaled directors to properly show bounding boxes. * Merged fix for template with splash screen. 01/18/2012 *0.1 Build 607* diff --git a/documentation/jsdoc/files.html b/documentation/jsdoc/files.html index 31fbabc4..40f7fb0e 100644 --- a/documentation/jsdoc/files.html +++ b/documentation/jsdoc/files.html @@ -696,7 +696,7 @@

/User
- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
\ No newline at end of file diff --git a/documentation/jsdoc/index.html b/documentation/jsdoc/index.html index 7c02615b..339aad00 100644 --- a/documentation/jsdoc/index.html +++ b/documentation/jsdoc/index.html @@ -564,7 +564,7 @@

Function

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
\ No newline at end of file diff --git a/documentation/jsdoc/symbols/CAAT.Actor.html b/documentation/jsdoc/symbols/CAAT.Actor.html index 4afacc85..28e8aa1a 100644 --- a/documentation/jsdoc/symbols/CAAT.Actor.html +++ b/documentation/jsdoc/symbols/CAAT.Actor.html @@ -577,6 +577,15 @@

+ +   + + +
+ + +   @@ -941,7 +950,7 @@

  -
setModelViewMatrix(glEnabled) +
Set this model view matrix if the actor is Dirty.
@@ -2143,6 +2152,31 @@

+
+ + +
+ + + invalidate() + +
+
+ + + +
+ + + + + + + + + + +
@@ -3841,11 +3875,24 @@

- setModelViewMatrix(glEnabled) + setModelViewMatrix(director)
Set this model view matrix if the actor is Dirty. + + mm[2]+= this.x; + mm[5]+= this.y; + if ( this.rotationAngle ) { + this.modelViewMatrix.multiply( m.setTranslate( this.rotationX, this.rotationY) ); + this.modelViewMatrix.multiply( m.setRotation( this.rotationAngle ) ); + this.modelViewMatrix.multiply( m.setTranslate( -this.rotationX, -this.rotationY) ); c= Math.cos( this.rotationAngle ); + } + if ( this.scaleX!=1 || this.scaleY!=1 && (this.scaleTX || this.scaleTY )) { + this.modelViewMatrix.multiply( m.setTranslate( this.scaleTX , this.scaleTY ) ); + this.modelViewMatrix.multiply( m.setScale( this.scaleX, this.scaleY ) ); + this.modelViewMatrix.multiply( m.setTranslate( -this.scaleTX , -this.scaleTY ) ); + }
@@ -3857,7 +3904,7 @@

Parameters:
- glEnabled + director
@@ -4523,7 +4570,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:45 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.ActorContainer.html b/documentation/jsdoc/symbols/CAAT.ActorContainer.html index a46ed22c..54f3fcb0 100644 --- a/documentation/jsdoc/symbols/CAAT.ActorContainer.html +++ b/documentation/jsdoc/symbols/CAAT.ActorContainer.html @@ -536,7 +536,7 @@

-
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, paint, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, paint, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -1418,7 +1418,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.AudioManager.html b/documentation/jsdoc/symbols/CAAT.AudioManager.html index 5d4cc222..d41233aa 100644 --- a/documentation/jsdoc/symbols/CAAT.AudioManager.html +++ b/documentation/jsdoc/symbols/CAAT.AudioManager.html @@ -1127,7 +1127,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.B2DBodyActor.html b/documentation/jsdoc/symbols/CAAT.B2DBodyActor.html index 232a6580..27fc1324 100644 --- a/documentation/jsdoc/symbols/CAAT.B2DBodyActor.html +++ b/documentation/jsdoc/symbols/CAAT.B2DBodyActor.html @@ -1227,7 +1227,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.B2DCircularBody.html b/documentation/jsdoc/symbols/CAAT.B2DCircularBody.html index e01636f9..5619382d 100644 --- a/documentation/jsdoc/symbols/CAAT.B2DCircularBody.html +++ b/documentation/jsdoc/symbols/CAAT.B2DCircularBody.html @@ -632,7 +632,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.B2DPolygonBody.html b/documentation/jsdoc/symbols/CAAT.B2DPolygonBody.html index 0288db51..341ee2d7 100644 --- a/documentation/jsdoc/symbols/CAAT.B2DPolygonBody.html +++ b/documentation/jsdoc/symbols/CAAT.B2DPolygonBody.html @@ -714,7 +714,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Bezier.html b/documentation/jsdoc/symbols/CAAT.Bezier.html index 14728772..00a09d85 100644 --- a/documentation/jsdoc/symbols/CAAT.Bezier.html +++ b/documentation/jsdoc/symbols/CAAT.Bezier.html @@ -1022,7 +1022,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.CatmullRom.html b/documentation/jsdoc/symbols/CAAT.CatmullRom.html index c426c4b9..e50a8e8b 100644 --- a/documentation/jsdoc/symbols/CAAT.CatmullRom.html +++ b/documentation/jsdoc/symbols/CAAT.CatmullRom.html @@ -597,7 +597,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Color.RGB.html b/documentation/jsdoc/symbols/CAAT.Color.RGB.html index d6474a5e..8f1e583d 100644 --- a/documentation/jsdoc/symbols/CAAT.Color.RGB.html +++ b/documentation/jsdoc/symbols/CAAT.Color.RGB.html @@ -470,7 +470,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Color.html b/documentation/jsdoc/symbols/CAAT.Color.html index af62d760..fc2b0b64 100644 --- a/documentation/jsdoc/symbols/CAAT.Color.html +++ b/documentation/jsdoc/symbols/CAAT.Color.html @@ -694,7 +694,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:49 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:46 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Curve.html b/documentation/jsdoc/symbols/CAAT.Curve.html index d57f1c70..a21b3c15 100644 --- a/documentation/jsdoc/symbols/CAAT.Curve.html +++ b/documentation/jsdoc/symbols/CAAT.Curve.html @@ -969,7 +969,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:47 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.CurvePath.html b/documentation/jsdoc/symbols/CAAT.CurvePath.html index ba303445..da0382ab 100644 --- a/documentation/jsdoc/symbols/CAAT.CurvePath.html +++ b/documentation/jsdoc/symbols/CAAT.CurvePath.html @@ -1205,7 +1205,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:47 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Director.html b/documentation/jsdoc/symbols/CAAT.Director.html index c9e0ce7f..9504ecc9 100644 --- a/documentation/jsdoc/symbols/CAAT.Director.html +++ b/documentation/jsdoc/symbols/CAAT.Director.html @@ -474,6 +474,15 @@

+ +   + +
addDirtyRect(rectangle) +
+
Before calling this method, check if this.dirtyRectsEnabled is true.
+ + +   @@ -1070,7 +1079,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChildAt, addChildDelayed, addChildImmediately, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseOut, mouseOver, paint, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChildAt, addChildDelayed, addChildImmediately, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseOut, mouseOver, paint, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -1674,6 +1683,42 @@

+
+ + +
+ + + addDirtyRect(rectangle) + +
+
+ Before calling this method, check if this.dirtyRectsEnabled is true. + + +
+ + + + +
+
Parameters:
+ +
+ rectangle + +
+
{CAAT.Rectangle}
+ +
+ + + + + + + +
@@ -4361,7 +4406,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.IMActor.html b/documentation/jsdoc/symbols/CAAT.IMActor.html index 27fe4f48..b7fef731 100644 --- a/documentation/jsdoc/symbols/CAAT.IMActor.html +++ b/documentation/jsdoc/symbols/CAAT.IMActor.html @@ -381,7 +381,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -553,7 +553,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.IMBump.html b/documentation/jsdoc/symbols/CAAT.IMBump.html index 5e7545c1..5646758b 100644 --- a/documentation/jsdoc/symbols/CAAT.IMBump.html +++ b/documentation/jsdoc/symbols/CAAT.IMBump.html @@ -819,7 +819,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.IMPlasma.html b/documentation/jsdoc/symbols/CAAT.IMPlasma.html index f5bedf99..71cf7498 100644 --- a/documentation/jsdoc/symbols/CAAT.IMPlasma.html +++ b/documentation/jsdoc/symbols/CAAT.IMPlasma.html @@ -574,7 +574,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.IMRotoZoom.html b/documentation/jsdoc/symbols/CAAT.IMRotoZoom.html index d2b2041c..9f12a21e 100644 --- a/documentation/jsdoc/symbols/CAAT.IMRotoZoom.html +++ b/documentation/jsdoc/symbols/CAAT.IMRotoZoom.html @@ -620,7 +620,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.ImagePreloader.html b/documentation/jsdoc/symbols/CAAT.ImagePreloader.html index 1fc9e793..e25e2040 100644 --- a/documentation/jsdoc/symbols/CAAT.ImagePreloader.html +++ b/documentation/jsdoc/symbols/CAAT.ImagePreloader.html @@ -476,7 +476,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.ImageProcessor.html b/documentation/jsdoc/symbols/CAAT.ImageProcessor.html index 37c8a548..446bec48 100644 --- a/documentation/jsdoc/symbols/CAAT.ImageProcessor.html +++ b/documentation/jsdoc/symbols/CAAT.ImageProcessor.html @@ -960,7 +960,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:50 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Interpolator.html b/documentation/jsdoc/symbols/CAAT.Interpolator.html index 3c395d20..e41f721c 100644 --- a/documentation/jsdoc/symbols/CAAT.Interpolator.html +++ b/documentation/jsdoc/symbols/CAAT.Interpolator.html @@ -1355,7 +1355,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:48 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.InterpolatorActor.html b/documentation/jsdoc/symbols/CAAT.InterpolatorActor.html index 03cdd93b..7c6b0ecc 100644 --- a/documentation/jsdoc/symbols/CAAT.InterpolatorActor.html +++ b/documentation/jsdoc/symbols/CAAT.InterpolatorActor.html @@ -390,7 +390,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -615,7 +615,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.LinearPath.html b/documentation/jsdoc/symbols/CAAT.LinearPath.html index 9237a003..003a663f 100644 --- a/documentation/jsdoc/symbols/CAAT.LinearPath.html +++ b/documentation/jsdoc/symbols/CAAT.LinearPath.html @@ -1079,7 +1079,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Matrix3.html b/documentation/jsdoc/symbols/CAAT.Matrix3.html index 69ab1b99..eeab15b4 100644 --- a/documentation/jsdoc/symbols/CAAT.Matrix3.html +++ b/documentation/jsdoc/symbols/CAAT.Matrix3.html @@ -1615,7 +1615,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.MatrixStack.html b/documentation/jsdoc/symbols/CAAT.MatrixStack.html index aa5c94be..fbc87a5a 100644 --- a/documentation/jsdoc/symbols/CAAT.MatrixStack.html +++ b/documentation/jsdoc/symbols/CAAT.MatrixStack.html @@ -624,7 +624,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.MouseEvent.html b/documentation/jsdoc/symbols/CAAT.MouseEvent.html index 5d32ef79..138bbcb9 100644 --- a/documentation/jsdoc/symbols/CAAT.MouseEvent.html +++ b/documentation/jsdoc/symbols/CAAT.MouseEvent.html @@ -651,7 +651,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Path.html b/documentation/jsdoc/symbols/CAAT.Path.html index 812ff1f0..4153cb37 100644 --- a/documentation/jsdoc/symbols/CAAT.Path.html +++ b/documentation/jsdoc/symbols/CAAT.Path.html @@ -2981,7 +2981,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.PathActor.html b/documentation/jsdoc/symbols/CAAT.PathActor.html index 351cf387..f429e9b5 100644 --- a/documentation/jsdoc/symbols/CAAT.PathActor.html +++ b/documentation/jsdoc/symbols/CAAT.PathActor.html @@ -426,7 +426,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -788,7 +788,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.PathSegment.html b/documentation/jsdoc/symbols/CAAT.PathSegment.html index 55a7a041..a643e887 100644 --- a/documentation/jsdoc/symbols/CAAT.PathSegment.html +++ b/documentation/jsdoc/symbols/CAAT.PathSegment.html @@ -1147,7 +1147,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Point.html b/documentation/jsdoc/symbols/CAAT.Point.html index 42402006..bd6a9038 100644 --- a/documentation/jsdoc/symbols/CAAT.Point.html +++ b/documentation/jsdoc/symbols/CAAT.Point.html @@ -1271,7 +1271,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Rectangle.html b/documentation/jsdoc/symbols/CAAT.Rectangle.html index 447d37a1..d7a59eb6 100644 --- a/documentation/jsdoc/symbols/CAAT.Rectangle.html +++ b/documentation/jsdoc/symbols/CAAT.Rectangle.html @@ -355,6 +355,15 @@

+ +   + + +
+ + +   @@ -513,6 +522,42 @@

+
+ + +
+ + + intersects(r) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ r + +
+
+ +
+ + + + + + + +
@@ -800,7 +845,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.Scene.html b/documentation/jsdoc/symbols/CAAT.Scene.html index e748ceb0..362f1733 100644 --- a/documentation/jsdoc/symbols/CAAT.Scene.html +++ b/documentation/jsdoc/symbols/CAAT.Scene.html @@ -572,7 +572,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -1748,7 +1748,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.ShapeActor.html b/documentation/jsdoc/symbols/CAAT.ShapeActor.html index a06e8514..8feedf0f 100644 --- a/documentation/jsdoc/symbols/CAAT.ShapeActor.html +++ b/documentation/jsdoc/symbols/CAAT.ShapeActor.html @@ -472,7 +472,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -990,7 +990,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.SpriteImage.html b/documentation/jsdoc/symbols/CAAT.SpriteImage.html index 51210d5f..46bc76fa 100644 --- a/documentation/jsdoc/symbols/CAAT.SpriteImage.html +++ b/documentation/jsdoc/symbols/CAAT.SpriteImage.html @@ -346,6 +346,15 @@

+ +   + +
drawString(ctx, str, x, y) +
+
+ + +   @@ -419,6 +428,15 @@

+ +   + +
initializeAsFontMap(image, map) +
+
+ + +   @@ -574,6 +592,15 @@

+ +   + +
stringWidth(str) +
+
+ + + @@ -649,6 +676,60 @@

Method Detail

+ +
+ + + drawString(ctx, str, x, y) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ ctx + +
+
+ +
+ str + +
+
+ +
+ x + +
+
+ +
+ y + +
+
+ +
+ + + + + + + + +
+
@@ -886,6 +967,48 @@

+
+ + +
+ + + initializeAsFontMap(image, map) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ image + +
+
+ +
+ map + +
+
+ +
+ + + + + + + +
@@ -1726,6 +1849,42 @@

+
+ + +
+ + + stringWidth(str) + +
+
+ + + +
+ + + + +
+
Parameters:
+ +
+ str + +
+
+ +
+ + + + + + + + @@ -1740,7 +1899,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.StarActor.html b/documentation/jsdoc/symbols/CAAT.StarActor.html index bb9aad1b..5949cb0d 100644 --- a/documentation/jsdoc/symbols/CAAT.StarActor.html +++ b/documentation/jsdoc/symbols/CAAT.StarActor.html @@ -480,7 +480,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -1032,7 +1032,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.TextActor.html b/documentation/jsdoc/symbols/CAAT.TextActor.html index 56088e84..1d04a1d5 100644 --- a/documentation/jsdoc/symbols/CAAT.TextActor.html +++ b/documentation/jsdoc/symbols/CAAT.TextActor.html @@ -481,7 +481,7 @@

-
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
+
Methods borrowed from class CAAT.ActorContainer:
__paintActor, addChild, addChildAt, addChildDelayed, addChildImmediately, animate, destroy, drawScreenBoundingBox, emptyChildren, endAnimate, findActorAtPosition, findChild, getChildAt, getNumActiveChildren, getNumChildren, paintActor, paintActorGL, recalcSize, removeChild, setZOrder
Methods borrowed from class CAAT.Actor:
addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, contains, create, emptyBehaviorList, enableDrag, enableEvents, fireEvent, getAnchor, getAnchorPercent, getBehavior, getId, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, isGestureEnabled, isInAnimationFrame, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, removeBehaviorById, removeBehaviour, removeListener, resetTransform, setAlpha, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setId, setImageTransformation, setLocation, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setRotation, setRotationAnchored, setScale, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, viewToModel
@@ -1123,7 +1123,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.TimerTask.html b/documentation/jsdoc/symbols/CAAT.TimerTask.html index 51f6ffe3..c67ff550 100644 --- a/documentation/jsdoc/symbols/CAAT.TimerTask.html +++ b/documentation/jsdoc/symbols/CAAT.TimerTask.html @@ -646,7 +646,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.html b/documentation/jsdoc/symbols/CAAT.html index 4e9b527f..d1b00b3c 100644 --- a/documentation/jsdoc/symbols/CAAT.html +++ b/documentation/jsdoc/symbols/CAAT.html @@ -648,7 +648,7 @@

<static>   -
CAAT.SpriteImageHelper(x, y, w, h) +
CAAT.SpriteImageHelper(x, y, w, h, iw, ih)
See LICENSE file.
@@ -1718,7 +1718,7 @@

<static> - CAAT.SpriteImageHelper(x, y, w, h) + CAAT.SpriteImageHelper(x, y, w, h, iw, ih)
@@ -1762,6 +1762,18 @@

+
+ iw + +
+
+ +
+ ih + +
+
+ @@ -1863,7 +1875,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:48 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:44 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircle.html b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircle.html index ff802035..f353e497 100644 --- a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircle.html +++ b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircle.html @@ -1025,7 +1025,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircleManager.html b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircleManager.html index 161b0f50..0714d748 100644 --- a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircleManager.html +++ b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.PackedCircleManager.html @@ -1054,7 +1054,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.html b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.html index 1b502537..728842cd 100644 --- a/documentation/jsdoc/symbols/CAAT.modules.CircleManager.html +++ b/documentation/jsdoc/symbols/CAAT.modules.CircleManager.html @@ -383,7 +383,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.modules.LocalStorage.html b/documentation/jsdoc/symbols/CAAT.modules.LocalStorage.html index 73da122b..8cc6beca 100644 --- a/documentation/jsdoc/symbols/CAAT.modules.LocalStorage.html +++ b/documentation/jsdoc/symbols/CAAT.modules.LocalStorage.html @@ -568,7 +568,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:50 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/CAAT.modules.html b/documentation/jsdoc/symbols/CAAT.modules.html index f81f6028..d54bea93 100644 --- a/documentation/jsdoc/symbols/CAAT.modules.html +++ b/documentation/jsdoc/symbols/CAAT.modules.html @@ -476,7 +476,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:51 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:49 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/Function.html b/documentation/jsdoc/symbols/Function.html index 3cc7bed6..2fdda1a8 100644 --- a/documentation/jsdoc/symbols/Function.html +++ b/documentation/jsdoc/symbols/Function.html @@ -392,7 +392,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:52 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:51 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/_global_.html b/documentation/jsdoc/symbols/_global_.html index b6cd1ecd..c1c6f2b0 100644 --- a/documentation/jsdoc/symbols/_global_.html +++ b/documentation/jsdoc/symbols/_global_.html @@ -308,34 +308,6 @@

- - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
  -
- i -
-
better avoid using behaviors
-
- - - - @@ -410,36 +382,6 @@

-
- Field Detail -
- - -
- - - i - -
-
- better avoid using behaviors - -
- Defined in: actor.js. - - -
- - - - - - - - - - - @@ -770,7 +712,7 @@

- Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 20 2012 02:02:48 GMT+0100 (CET) + Documentation generated by JsDoc Toolkit 2.4.0 on Sun Jan 22 2012 17:57:44 GMT+0100 (CET)
diff --git a/documentation/jsdoc/symbols/src/_Users_ibon_js_CAAT_src_model_conpoundimage.js.html b/documentation/jsdoc/symbols/src/_Users_ibon_js_CAAT_src_model_conpoundimage.js.html index b980ad69..70f5d90a 100644 --- a/documentation/jsdoc/symbols/src/_Users_ibon_js_CAAT_src_model_conpoundimage.js.html +++ b/documentation/jsdoc/symbols/src/_Users_ibon_js_CAAT_src_model_conpoundimage.js.html @@ -14,642 +14,719 @@ 7 8 (function() { 9 - 10 CAAT.SpriteImageHelper= function(x,y,w,h) { + 10 CAAT.SpriteImageHelper= function(x,y,w,h, iw, ih) { 11 this.x= x; 12 this.y= y; 13 this.width= w; 14 this.height= h; 15 - 16 return this; - 17 }; - 18 - 19 CAAT.SpriteImageHelper.prototype= { - 20 - 21 x : 0, - 22 y : 0, - 23 width : 0, - 24 height : 0, - 25 u : 0, - 26 v : 0, - 27 u1 : 0, - 28 v1 : 0, - 29 - 30 setGL : function( u,v,u1,v1 ) { - 31 this.u= u; - 32 this.v= v; - 33 this.u1= u1; - 34 this.v1= v1; - 35 return this; - 36 } - 37 }; - 38 })(); - 39 - 40 (function() { - 41 - 42 /** - 43 * - 44 * This class is used by CAAT.Actor to draw images. It differs from CAAT.CompoundImage in that it - 45 * manages the subimage change based on time and a list of animation sub-image indexes. - 46 * A common use of this class will be: - 47 * - 48 * <code> - 49 * var si= new CAAT.SpriteImage(). - 50 * initialize( an_image_instance, rows, columns ). - 51 * setAnimationImageIndex( [2,1,0,1] ). // cycle throwout image with these indexes - 52 * setChangeFPS( 200 ). // change sprite every 200 ms. - 53 * setSpriteTransformation( CAAT.SpriteImage.TR_xx); // optionally draw images inverted, ... - 54 * </code> - 55 * - 56 * A SpriteImage is an sprite sheet. It encapsulates an Image and treates and references it as a two - 57 * dimensional array of row by columns sub-images. The access form will be sequential so if defined a - 58 * CompoundImage of more than one row, the subimages will be referenced by an index ranging from 0 to - 59 * rows*columns-1. Each sumimage will be of size (image.width/columns) by (image.height/rows). - 60 * - 61 * <p> - 62 * It is able to draw its sub-images in the following ways: - 63 * <ul> - 64 * <li>no transformed (default) - 65 * <li>flipped horizontally - 66 * <li>flipped vertically - 67 * <li>flipped both vertical and horizontally - 68 * </ul> - 69 * - 70 * <p> - 71 * It is supposed to be used in conjunction with <code>CAAT.SpriteActor</code> instances. - 72 * - 73 * @constructor - 74 * - 75 */ - 76 CAAT.SpriteImage = function() { - 77 this.paint= this.paintN; - 78 this.setAnimationImageIndex([0]); - 79 this.mapInfo= {}; - 80 return this; - 81 }; - 82 - 83 CAAT.SpriteImage.prototype = { - 84 - 85 animationImageIndex: null, // an Array defining the sprite frame sequence - 86 prevAnimationTime: -1, - 87 changeFPS: 1000, // how much Scene time to take before changing an Sprite frame. - 88 transformation: 0, // any of the TR_* constants. - 89 spriteIndex: 0, // the current sprite frame - 90 - 91 TR_NONE: 0, // constants used to determine how to draw the sprite image, - 92 TR_FLIP_HORIZONTAL: 1, - 93 TR_FLIP_VERTICAL: 2, - 94 TR_FLIP_ALL: 3, - 95 TR_FIXED_TO_SIZE: 4, - 96 TR_TILE: 5, - 97 - 98 image: null, - 99 rows: 1, -100 columns: 1, -101 width: 0, -102 height: 0, -103 singleWidth: 0, -104 singleHeight: 0, -105 -106 scaleX: 1, -107 scaleY: 1, -108 -109 offsetX: 0, -110 offsetY: 0, -111 -112 ownerActor: null, -113 -114 mapInfo : null, -115 map : null, -116 -117 setOwner : function(actor) { -118 this.ownerActor= actor; -119 return this; -120 }, -121 getRows: function() { -122 return this.rows; -123 }, -124 getColumns : function() { -125 return this.columns; -126 }, -127 -128 getWidth : function() { -129 var el= this.mapInfo[this.spriteIndex]; -130 return el.width; -131 }, -132 -133 getHeight : function() { -134 var el= this.mapInfo[this.spriteIndex]; -135 return el.height; -136 }, -137 -138 /** -139 * Get a reference to the same image information (rows, columns, image and uv cache) of this -140 * SpriteImage. This means that re-initializing this objects image info (that is, calling initialize -141 * method) will change all reference's image information at the same time. -142 */ -143 getRef : function() { -144 var ret= new CAAT.SpriteImage(); -145 ret.image= this.image; -146 ret.rows= this.rows; -147 ret.columns= this.columns; -148 ret.width= this.width; -149 ret.height= this.height; -150 ret.singleWidth= this.singleWidth; -151 ret.singleHeight= this.singleHeight; -152 ret.mapInfo= this.mapInfo; -153 ret.offsetX= this.offsetX; -154 ret.offsetY= this.offsetY; -155 ret.scaleX= this.scaleX; -156 ret.scaleY= this.scaleY; -157 return ret; -158 }, -159 /** -160 * Set horizontal displacement to draw image. Positive values means drawing the image more to the -161 * right. -162 * @param x {number} -163 * @return this -164 */ -165 setOffsetX : function(x) { -166 this.offsetX= x; -167 return this; -168 }, -169 /** -170 * Set vertical displacement to draw image. Positive values means drawing the image more to the -171 * bottom. -172 * @param y {number} -173 * @return this -174 */ -175 setOffsetY : function(y) { -176 this.offsetY= y; -177 return this; -178 }, -179 setOffset : function( x,y ) { -180 this.offsetX= x; -181 this.offsetY= y; -182 return this; -183 }, -184 /** -185 * Initialize a grid of subimages out of a given image. -186 * @param image {HTMLImageElement|Image} an image object. -187 * @param rows {number} number of rows. -188 * @param columns {number} number of columns -189 * -190 * @return this -191 */ -192 initialize : function(image, rows, columns) { -193 this.image = image; -194 this.rows = rows; -195 this.columns = columns; -196 this.width = image.width; -197 this.height = image.height; -198 this.singleWidth = Math.floor(this.width / columns); -199 this.singleHeight = Math.floor(this.height / rows); -200 this.mapInfo= {}; -201 -202 var i,sx0,sy0; -203 var helper; -204 -205 if (image.__texturePage) { -206 image.__du = this.singleWidth / image.__texturePage.width; -207 image.__dv = this.singleHeight / image.__texturePage.height; -208 + 16 this.setGL( x/iw, y/ih, (x+w-1)/iw, (y+h-1)/ih ); + 17 return this; + 18 }; + 19 + 20 CAAT.SpriteImageHelper.prototype= { + 21 + 22 x : 0, + 23 y : 0, + 24 width : 0, + 25 height : 0, + 26 u : 0, + 27 v : 0, + 28 u1 : 0, + 29 v1 : 0, + 30 + 31 setGL : function( u,v,u1,v1 ) { + 32 this.u= u; + 33 this.v= v; + 34 this.u1= u1; + 35 this.v1= v1; + 36 return this; + 37 } + 38 }; + 39 })(); + 40 + 41 (function() { + 42 + 43 /** + 44 * + 45 * This class is used by CAAT.Actor to draw images. It differs from CAAT.CompoundImage in that it + 46 * manages the subimage change based on time and a list of animation sub-image indexes. + 47 * A common use of this class will be: + 48 * + 49 * <code> + 50 * var si= new CAAT.SpriteImage(). + 51 * initialize( an_image_instance, rows, columns ). + 52 * setAnimationImageIndex( [2,1,0,1] ). // cycle throwout image with these indexes + 53 * setChangeFPS( 200 ). // change sprite every 200 ms. + 54 * setSpriteTransformation( CAAT.SpriteImage.TR_xx); // optionally draw images inverted, ... + 55 * </code> + 56 * + 57 * A SpriteImage is an sprite sheet. It encapsulates an Image and treates and references it as a two + 58 * dimensional array of row by columns sub-images. The access form will be sequential so if defined a + 59 * CompoundImage of more than one row, the subimages will be referenced by an index ranging from 0 to + 60 * rows*columns-1. Each sumimage will be of size (image.width/columns) by (image.height/rows). + 61 * + 62 * <p> + 63 * It is able to draw its sub-images in the following ways: + 64 * <ul> + 65 * <li>no transformed (default) + 66 * <li>flipped horizontally + 67 * <li>flipped vertically + 68 * <li>flipped both vertical and horizontally + 69 * </ul> + 70 * + 71 * <p> + 72 * It is supposed to be used in conjunction with <code>CAAT.SpriteActor</code> instances. + 73 * + 74 * @constructor + 75 * + 76 */ + 77 CAAT.SpriteImage = function() { + 78 this.paint= this.paintN; + 79 this.setAnimationImageIndex([0]); + 80 this.mapInfo= {}; + 81 return this; + 82 }; + 83 + 84 CAAT.SpriteImage.prototype = { + 85 + 86 animationImageIndex: null, // an Array defining the sprite frame sequence + 87 prevAnimationTime: -1, + 88 changeFPS: 1000, // how much Scene time to take before changing an Sprite frame. + 89 transformation: 0, // any of the TR_* constants. + 90 spriteIndex: 0, // the current sprite frame + 91 + 92 TR_NONE: 0, // constants used to determine how to draw the sprite image, + 93 TR_FLIP_HORIZONTAL: 1, + 94 TR_FLIP_VERTICAL: 2, + 95 TR_FLIP_ALL: 3, + 96 TR_FIXED_TO_SIZE: 4, + 97 TR_TILE: 5, + 98 + 99 image: null, +100 rows: 1, +101 columns: 1, +102 width: 0, +103 height: 0, +104 singleWidth: 0, +105 singleHeight: 0, +106 +107 scaleX: 1, +108 scaleY: 1, +109 +110 offsetX: 0, +111 offsetY: 0, +112 +113 ownerActor: null, +114 +115 mapInfo : null, +116 map : null, +117 +118 setOwner : function(actor) { +119 this.ownerActor= actor; +120 return this; +121 }, +122 getRows: function() { +123 return this.rows; +124 }, +125 getColumns : function() { +126 return this.columns; +127 }, +128 +129 getWidth : function() { +130 var el= this.mapInfo[this.spriteIndex]; +131 return el.width; +132 }, +133 +134 getHeight : function() { +135 var el= this.mapInfo[this.spriteIndex]; +136 return el.height; +137 }, +138 +139 /** +140 * Get a reference to the same image information (rows, columns, image and uv cache) of this +141 * SpriteImage. This means that re-initializing this objects image info (that is, calling initialize +142 * method) will change all reference's image information at the same time. +143 */ +144 getRef : function() { +145 var ret= new CAAT.SpriteImage(); +146 ret.image= this.image; +147 ret.rows= this.rows; +148 ret.columns= this.columns; +149 ret.width= this.width; +150 ret.height= this.height; +151 ret.singleWidth= this.singleWidth; +152 ret.singleHeight= this.singleHeight; +153 ret.mapInfo= this.mapInfo; +154 ret.offsetX= this.offsetX; +155 ret.offsetY= this.offsetY; +156 ret.scaleX= this.scaleX; +157 ret.scaleY= this.scaleY; +158 return ret; +159 }, +160 /** +161 * Set horizontal displacement to draw image. Positive values means drawing the image more to the +162 * right. +163 * @param x {number} +164 * @return this +165 */ +166 setOffsetX : function(x) { +167 this.offsetX= x; +168 return this; +169 }, +170 /** +171 * Set vertical displacement to draw image. Positive values means drawing the image more to the +172 * bottom. +173 * @param y {number} +174 * @return this +175 */ +176 setOffsetY : function(y) { +177 this.offsetY= y; +178 return this; +179 }, +180 setOffset : function( x,y ) { +181 this.offsetX= x; +182 this.offsetY= y; +183 return this; +184 }, +185 /** +186 * Initialize a grid of subimages out of a given image. +187 * @param image {HTMLImageElement|Image} an image object. +188 * @param rows {number} number of rows. +189 * @param columns {number} number of columns +190 * +191 * @return this +192 */ +193 initialize : function(image, rows, columns) { +194 this.image = image; +195 this.rows = rows; +196 this.columns = columns; +197 this.width = image.width; +198 this.height = image.height; +199 this.singleWidth = Math.floor(this.width / columns); +200 this.singleHeight = Math.floor(this.height / rows); +201 this.mapInfo= {}; +202 +203 var i,sx0,sy0; +204 var helper; +205 +206 if (image.__texturePage) { +207 image.__du = this.singleWidth / image.__texturePage.width; +208 image.__dv = this.singleHeight / image.__texturePage.height; 209 -210 var w = this.singleWidth; -211 var h = this.singleHeight; -212 var mod = this.columns; -213 if (image.inverted) { -214 var t = w; -215 w = h; -216 h = t; -217 mod = this.rows; -218 } -219 -220 var xt = this.image.__tx; -221 var yt = this.image.__ty; -222 -223 var tp = this.image.__texturePage; -224 -225 for (i = 0; i < rows * columns; i++) { -226 +210 +211 var w = this.singleWidth; +212 var h = this.singleHeight; +213 var mod = this.columns; +214 if (image.inverted) { +215 var t = w; +216 w = h; +217 h = t; +218 mod = this.rows; +219 } +220 +221 var xt = this.image.__tx; +222 var yt = this.image.__ty; +223 +224 var tp = this.image.__texturePage; +225 +226 for (i = 0; i < rows * columns; i++) { 227 -228 var c = ((i % mod) >> 0); -229 var r = ((i / mod) >> 0); -230 -231 var u = xt + c * w; // esquina izq x -232 var v = yt + r * h; -233 -234 var u1 = u + w; -235 var v1 = v + h; -236 -237 helper= new CAAT.SpriteImageHelper().setGL( -238 u / tp.width, -239 v / tp.height, -240 u1 / tp.width, -241 v1 / tp.height ); -242 -243 this.mapInfo[i]= helper; -244 } -245 -246 } else { -247 for (i = 0; i < rows * columns; i++) { -248 sx0 = ((i % this.columns) | 0) * this.singleWidth; -249 sy0 = ((i / this.columns) | 0) * this.singleHeight; -250 -251 helper= new CAAT.SpriteImageHelper( sx0, sy0, this.singleWidth, this.singleHeight ); -252 this.mapInfo[i]= helper; -253 } -254 } -255 -256 return this; -257 }, -258 -259 /** -260 * Must be used to draw actor background and the actor should have setClip(true) so that the image tiles -261 * properly. -262 * @param director -263 * @param time -264 * @param x -265 * @param y -266 */ -267 paintTiled : function( director, time, x, y ) { -268 this.setSpriteIndexAtTime(time); -269 var el= this.mapInfo[this.spriteIndex]; -270 -271 var w= this.getWidth(); -272 var h= this.getHeight(); -273 var xoff= this.offsetX % w; -274 if ( xoff> 0 ) { -275 xoff= xoff-w; -276 } -277 var yoff= this.offsetY % h; -278 if ( yoff> 0 ) { -279 yoff= yoff-h; -280 } -281 -282 var nw= (((this.ownerActor.width-xoff)/w)>>0)+1; -283 var nh= (((this.ownerActor.height-yoff)/h)>>0)+1; -284 var i,j; -285 var ctx= director.ctx; -286 -287 for( i=0; i<nh; i++ ) { -288 for( j=0; j<nw; j++ ) { -289 director.ctx.drawImage( -290 this.image, -291 el.x, el.y, -292 el.width, el.height, -293 (x+xoff+j*el.width)>>0, (y+yoff+i*el.height)>>0, -294 el.width, el.height); -295 } -296 } -297 }, -298 -299 /** -300 * Draws the subimage pointed by imageIndex horizontally inverted. -301 * @param canvas a canvas context. -302 * @param imageIndex {number} a subimage index. -303 * @param x {number} x position in canvas to draw the image. -304 * @param y {number} y position in canvas to draw the image. -305 * -306 * @return this -307 */ -308 paintInvertedH : function(director, time, x, y) { -309 -310 this.setSpriteIndexAtTime(time); -311 -312 var el= this.mapInfo[this.spriteIndex]; -313 -314 var ctx= director.ctx; -315 ctx.save(); -316 //ctx.translate(((0.5 + x) | 0) + el.width, (0.5 + y) | 0); -317 ctx.translate( (x|0) + el.width, y|0 ); -318 ctx.scale(-1, 1); -319 +228 +229 var c = ((i % mod) >> 0); +230 var r = ((i / mod) >> 0); +231 +232 var u = xt + c * w; // esquina izq x +233 var v = yt + r * h; +234 +235 var u1 = u + w; +236 var v1 = v + h; +237 +238 helper= new CAAT.SpriteImageHelper(u,v,(u1-u),(v1-v),tp.width,tp.height).setGL( +239 u / tp.width, +240 v / tp.height, +241 u1 / tp.width, +242 v1 / tp.height ); +243 +244 this.mapInfo[i]= helper; +245 } +246 +247 } else { +248 for (i = 0; i < rows * columns; i++) { +249 sx0 = ((i % this.columns) | 0) * this.singleWidth; +250 sy0 = ((i / this.columns) | 0) * this.singleHeight; +251 +252 helper= new CAAT.SpriteImageHelper( sx0, sy0, this.singleWidth, this.singleHeight, image.width, image.height ); +253 this.mapInfo[i]= helper; +254 } +255 } +256 +257 return this; +258 }, +259 +260 /** +261 * Must be used to draw actor background and the actor should have setClip(true) so that the image tiles +262 * properly. +263 * @param director +264 * @param time +265 * @param x +266 * @param y +267 */ +268 paintTiled : function( director, time, x, y ) { +269 this.setSpriteIndexAtTime(time); +270 var el= this.mapInfo[this.spriteIndex]; +271 +272 var w= this.getWidth(); +273 var h= this.getHeight(); +274 var xoff= this.offsetX % w; +275 if ( xoff> 0 ) { +276 xoff= xoff-w; +277 } +278 var yoff= this.offsetY % h; +279 if ( yoff> 0 ) { +280 yoff= yoff-h; +281 } +282 +283 var nw= (((this.ownerActor.width-xoff)/w)>>0)+1; +284 var nh= (((this.ownerActor.height-yoff)/h)>>0)+1; +285 var i,j; +286 var ctx= director.ctx; +287 +288 for( i=0; i<nh; i++ ) { +289 for( j=0; j<nw; j++ ) { +290 director.ctx.drawImage( +291 this.image, +292 el.x, el.y, +293 el.width, el.height, +294 (x+xoff+j*el.width)>>0, (y+yoff+i*el.height)>>0, +295 el.width, el.height); +296 } +297 } +298 }, +299 +300 /** +301 * Draws the subimage pointed by imageIndex horizontally inverted. +302 * @param canvas a canvas context. +303 * @param imageIndex {number} a subimage index. +304 * @param x {number} x position in canvas to draw the image. +305 * @param y {number} y position in canvas to draw the image. +306 * +307 * @return this +308 */ +309 paintInvertedH : function(director, time, x, y) { +310 +311 this.setSpriteIndexAtTime(time); +312 +313 var el= this.mapInfo[this.spriteIndex]; +314 +315 var ctx= director.ctx; +316 ctx.save(); +317 //ctx.translate(((0.5 + x) | 0) + el.width, (0.5 + y) | 0); +318 ctx.translate( (x|0) + el.width, y|0 ); +319 ctx.scale(-1, 1); 320 -321 ctx.drawImage( -322 this.image, -323 el.x, el.y, -324 el.width, el.height, -325 this.offsetX>>0, this.offsetY>>0, -326 el.width, el.height ); -327 -328 ctx.restore(); -329 -330 return this; -331 }, -332 /** -333 * Draws the subimage pointed by imageIndex vertically inverted. -334 * @param canvas a canvas context. -335 * @param imageIndex {number} a subimage index. -336 * @param x {number} x position in canvas to draw the image. -337 * @param y {number} y position in canvas to draw the image. -338 * -339 * @return this -340 */ -341 paintInvertedV : function(director, time, x, y) { -342 -343 this.setSpriteIndexAtTime(time); -344 var el= this.mapInfo[this.spriteIndex]; -345 -346 var ctx= director.ctx; -347 ctx.save(); -348 //ctx.translate((x + 0.5) | 0, (0.5 + y + el.height) | 0); -349 ctx.translate( x|0, (y + el.height) | 0); -350 ctx.scale(1, -1); -351 -352 ctx.drawImage( -353 this.image, -354 el.x, el.y, -355 el.width, el.height, -356 this.offsetX>>0,this.offsetY>>0, -357 el.width, el.height); -358 -359 ctx.restore(); -360 -361 return this; -362 }, -363 /** -364 * Draws the subimage pointed by imageIndex both horizontal and vertically inverted. -365 * @param canvas a canvas context. -366 * @param imageIndex {number} a subimage index. -367 * @param x {number} x position in canvas to draw the image. -368 * @param y {number} y position in canvas to draw the image. -369 * -370 * @return this -371 */ -372 paintInvertedHV : function(director, time, x, y) { -373 -374 this.setSpriteIndexAtTime(time); -375 var el= this.mapInfo[this.spriteIndex]; -376 -377 var ctx= director.ctx; -378 ctx.save(); -379 //ctx.translate((x + 0.5) | 0, (0.5 + y + el.height) | 0); -380 ctx.translate( x | 0, (y + el.height) | 0); -381 ctx.scale(1, -1); -382 ctx.translate(el.width, 0); -383 ctx.scale(-1, 1); -384 -385 ctx.drawImage( -386 this.image, -387 el.x, el.y, -388 el.width, el.height, -389 this.offsetX>>0, this.offsetY>>0, -390 el.width, el.height); -391 -392 ctx.restore(); -393 -394 return this; -395 }, -396 /** -397 * Draws the subimage pointed by imageIndex. -398 * @param canvas a canvas context. -399 * @param imageIndex {number} a subimage index. -400 * @param x {number} x position in canvas to draw the image. -401 * @param y {number} y position in canvas to draw the image. -402 * -403 * @return this -404 */ -405 paintN : function(director, time, x, y) { -406 this.setSpriteIndexAtTime(time); -407 var el= this.mapInfo[this.spriteIndex]; -408 -409 director.ctx.drawImage( -410 this.image, -411 el.x, el.y, -412 el.width, el.height, -413 (this.offsetX+x)>>0, (this.offsetY+y)>>0, -414 el.width, el.height); -415 -416 return this; -417 }, -418 /** -419 * Draws the subimage pointed by imageIndex scaled to the size of w and h. -420 * @param canvas a canvas context. -421 * @param imageIndex {number} a subimage index. -422 * @param x {number} x position in canvas to draw the image. -423 * @param y {number} y position in canvas to draw the image. -424 * @param w {number} new width of the subimage. -425 * @param h {number} new height of the subimage. -426 * -427 * @return this -428 */ -429 paintScaled : function(director, time, x, y) { -430 this.setSpriteIndexAtTime(time); -431 var el= this.mapInfo[this.spriteIndex]; -432 -433 director.ctx.drawImage( -434 this.image, -435 el.x, el.y, -436 el.width, el.height, -437 (this.offsetX+x)>>0, (this.offsetY+y)>>0, -438 this.ownerActor.width, this.ownerActor.height ); -439 -440 return this; -441 }, -442 getCurrentSpriteImageCSSPosition : function() { -443 var el= this.mapInfo[this.spriteIndex]; -444 -445 return '-'+(el.x-this.offsetX)+'px '+ -446 '-'+(el.y-this.offsetY)+'px '+ -447 (this.transformation===this.TR_TILE ? '' : 'no-repeat'); -448 }, -449 /** -450 * Get the number of subimages in this compoundImage -451 * @return {number} -452 */ -453 getNumImages : function() { -454 return this.rows * this.columns; -455 }, -456 /** -457 * TODO: set mapping coordinates for different transformations. -458 * @param imageIndex -459 * @param uvBuffer -460 * @param uvIndex -461 */ -462 setUV : function(uvBuffer, uvIndex) { -463 var im = this.image; -464 -465 if (!im.__texturePage) { -466 return; -467 } -468 -469 var index = uvIndex; -470 var sIndex= this.spriteIndex; -471 var el= this.mapInfo[this.spriteIndex]; -472 -473 var u= el.u; -474 var v= el.v; -475 var u1= el.u1; -476 var v1= el.v1; -477 if ( this.offsetX || this.offsetY ) { -478 var w= this.ownerActor.width; -479 var h= this.ownerActor.height; -480 -481 var tp= im.__texturePage; -482 -483 var _u= -this.offsetX / tp.width; -484 var _v= -this.offsetY / tp.height; -485 var _u1=(w-this.offsetX) / tp.width; -486 var _v1=(h-this.offsetY) / tp.height; -487 -488 u= _u + im.__u; -489 v= _v + im.__v; -490 u1= _u1 + im.__u; -491 v1= _v1 + im.__v; -492 } -493 -494 if (im.inverted) { -495 uvBuffer[index++] = u1; -496 uvBuffer[index++] = v; -497 -498 uvBuffer[index++] = u1; -499 uvBuffer[index++] = v1; -500 -501 uvBuffer[index++] = u; -502 uvBuffer[index++] = v1; -503 -504 uvBuffer[index++] = u; -505 uvBuffer[index++] = v; -506 } else { -507 uvBuffer[index++] = u; -508 uvBuffer[index++] = v; -509 -510 uvBuffer[index++] = u1; -511 uvBuffer[index++] = v; -512 -513 uvBuffer[index++] = u1; -514 uvBuffer[index++] = v1; -515 -516 uvBuffer[index++] = u; -517 uvBuffer[index++] = v1; -518 } -519 }, -520 /** -521 * Set the elapsed time needed to change the image index. -522 * @param fps an integer indicating the time in milliseconds to change. -523 * @return this -524 */ -525 setChangeFPS : function(fps) { -526 this.changeFPS= fps; -527 return this; -528 }, -529 /** -530 * Set the transformation to apply to the Sprite image. -531 * Any value of -532 * <li>TR_NONE -533 * <li>TR_FLIP_HORIZONTAL -534 * <li>TR_FLIP_VERTICAL -535 * <li>TR_FLIP_ALL -536 * -537 * @param transformation an integer indicating one of the previous values. -538 * @return this -539 */ -540 setSpriteTransformation : function( transformation ) { -541 this.transformation= transformation; -542 switch(transformation) { -543 case this.TR_FLIP_HORIZONTAL: -544 this.paint= this.paintInvertedH; -545 break; -546 case this.TR_FLIP_VERTICAL: -547 this.paint= this.paintInvertedV; -548 break; -549 case this.TR_FLIP_ALL: -550 this.paint= this.paintInvertedHV; -551 break; -552 case this.TR_FIXED_TO_SIZE: -553 this.paint= this.paintScaled; -554 break; -555 case this.TR_TILE: -556 this.paint= this.paintTiled; -557 break; -558 default: -559 this.paint= this.paintN; -560 } -561 return this; -562 }, -563 -564 /** -565 * Set the sprite animation images index. This method accepts an array of objects which define indexes to -566 * subimages inside this sprite image. -567 * If the SpriteImage is instantiated by calling the method initialize( image, rows, cols ), the value of -568 * aAnimationImageIndex should be an array of numbers, which define the indexes into an array of subimages -569 * with size rows*columns. -570 * If the method InitializeFromMap( image, map ) is called, the value for aAnimationImageIndex is expected -571 * to be an array of strings which are the names of the subobjects contained in the map object. -572 * -573 * @param aAnimationImageIndex an array indicating the Sprite's frames. -574 */ -575 setAnimationImageIndex : function( aAnimationImageIndex ) { -576 this.animationImageIndex= aAnimationImageIndex; -577 this.spriteIndex= aAnimationImageIndex[0]; -578 -579 return this; -580 }, -581 setSpriteIndex : function(index) { -582 this.spriteIndex= index; -583 return this; -584 }, -585 -586 /** -587 * Draws the sprite image calculated and stored in spriteIndex. -588 * -589 * @param director the CAAT.Director object instance that contains the Scene the Actor is in. -590 * @param time an integer indicating the Scene time when the bounding box is to be drawn. -591 */ -592 setSpriteIndexAtTime : function(time) { -593 -594 if ( this.animationImageIndex.length>1 ) { -595 if ( this.prevAnimationTime===-1 ) { -596 this.prevAnimationTime= time; -597 this.spriteIndex=0; -598 } -599 else { -600 var ttime= time; -601 ttime-= this.prevAnimationTime; -602 ttime/= this.changeFPS; -603 ttime%= this.animationImageIndex.length; -604 this.spriteIndex= this.animationImageIndex[Math.floor(ttime)]; -605 } -606 } -607 }, -608 -609 /** -610 * This method takes the output generated from the tool at http://labs.hyperandroid.com/static/texture/spriter.html -611 * and creates a map into that image. -612 * @param image {Image|HTMLImageElement|Canvas} an image -613 * @param map {object} the map into the image to define subimages. -614 */ -615 initializeFromMap : function( image, map ) { -616 this.initialize( image, 1, 1 ); -617 -618 var key; -619 var helper; -620 var count=0; -621 -622 for( key in map ) { -623 var value= map[key]; -624 -625 helper= new CAAT.SpriteImageHelper( -626 value.x, -627 value.y, -628 value.width, -629 value.height -630 ); -631 -632 this.mapInfo[key]= helper; -633 -634 // set a default spriteIndex -635 if ( !count ) { -636 this.setAnimationImageIndex( [key] ); -637 } -638 -639 count++; -640 } +321 +322 ctx.drawImage( +323 this.image, +324 el.x, el.y, +325 el.width, el.height, +326 this.offsetX>>0, this.offsetY>>0, +327 el.width, el.height ); +328 +329 ctx.restore(); +330 +331 return this; +332 }, +333 /** +334 * Draws the subimage pointed by imageIndex vertically inverted. +335 * @param canvas a canvas context. +336 * @param imageIndex {number} a subimage index. +337 * @param x {number} x position in canvas to draw the image. +338 * @param y {number} y position in canvas to draw the image. +339 * +340 * @return this +341 */ +342 paintInvertedV : function(director, time, x, y) { +343 +344 this.setSpriteIndexAtTime(time); +345 var el= this.mapInfo[this.spriteIndex]; +346 +347 var ctx= director.ctx; +348 ctx.save(); +349 //ctx.translate((x + 0.5) | 0, (0.5 + y + el.height) | 0); +350 ctx.translate( x|0, (y + el.height) | 0); +351 ctx.scale(1, -1); +352 +353 ctx.drawImage( +354 this.image, +355 el.x, el.y, +356 el.width, el.height, +357 this.offsetX>>0,this.offsetY>>0, +358 el.width, el.height); +359 +360 ctx.restore(); +361 +362 return this; +363 }, +364 /** +365 * Draws the subimage pointed by imageIndex both horizontal and vertically inverted. +366 * @param canvas a canvas context. +367 * @param imageIndex {number} a subimage index. +368 * @param x {number} x position in canvas to draw the image. +369 * @param y {number} y position in canvas to draw the image. +370 * +371 * @return this +372 */ +373 paintInvertedHV : function(director, time, x, y) { +374 +375 this.setSpriteIndexAtTime(time); +376 var el= this.mapInfo[this.spriteIndex]; +377 +378 var ctx= director.ctx; +379 ctx.save(); +380 //ctx.translate((x + 0.5) | 0, (0.5 + y + el.height) | 0); +381 ctx.translate( x | 0, (y + el.height) | 0); +382 ctx.scale(1, -1); +383 ctx.translate(el.width, 0); +384 ctx.scale(-1, 1); +385 +386 ctx.drawImage( +387 this.image, +388 el.x, el.y, +389 el.width, el.height, +390 this.offsetX>>0, this.offsetY>>0, +391 el.width, el.height); +392 +393 ctx.restore(); +394 +395 return this; +396 }, +397 /** +398 * Draws the subimage pointed by imageIndex. +399 * @param canvas a canvas context. +400 * @param imageIndex {number} a subimage index. +401 * @param x {number} x position in canvas to draw the image. +402 * @param y {number} y position in canvas to draw the image. +403 * +404 * @return this +405 */ +406 paintN : function(director, time, x, y) { +407 this.setSpriteIndexAtTime(time); +408 var el= this.mapInfo[this.spriteIndex]; +409 +410 director.ctx.drawImage( +411 this.image, +412 el.x, el.y, +413 el.width, el.height, +414 (this.offsetX+x)>>0, (this.offsetY+y)>>0, +415 el.width, el.height); +416 +417 return this; +418 }, +419 /** +420 * Draws the subimage pointed by imageIndex scaled to the size of w and h. +421 * @param canvas a canvas context. +422 * @param imageIndex {number} a subimage index. +423 * @param x {number} x position in canvas to draw the image. +424 * @param y {number} y position in canvas to draw the image. +425 * @param w {number} new width of the subimage. +426 * @param h {number} new height of the subimage. +427 * +428 * @return this +429 */ +430 paintScaled : function(director, time, x, y) { +431 this.setSpriteIndexAtTime(time); +432 var el= this.mapInfo[this.spriteIndex]; +433 +434 director.ctx.drawImage( +435 this.image, +436 el.x, el.y, +437 el.width, el.height, +438 (this.offsetX+x)>>0, (this.offsetY+y)>>0, +439 this.ownerActor.width, this.ownerActor.height ); +440 +441 return this; +442 }, +443 getCurrentSpriteImageCSSPosition : function() { +444 var el= this.mapInfo[this.spriteIndex]; +445 +446 return '-'+(el.x-this.offsetX)+'px '+ +447 '-'+(el.y-this.offsetY)+'px '+ +448 (this.transformation===this.TR_TILE ? '' : 'no-repeat'); +449 }, +450 /** +451 * Get the number of subimages in this compoundImage +452 * @return {number} +453 */ +454 getNumImages : function() { +455 return this.rows * this.columns; +456 }, +457 /** +458 * TODO: set mapping coordinates for different transformations. +459 * @param imageIndex +460 * @param uvBuffer +461 * @param uvIndex +462 */ +463 setUV : function(uvBuffer, uvIndex) { +464 var im = this.image; +465 +466 if (!im.__texturePage) { +467 return; +468 } +469 +470 var index = uvIndex; +471 var sIndex= this.spriteIndex; +472 var el= this.mapInfo[this.spriteIndex]; +473 +474 var u= el.u; +475 var v= el.v; +476 var u1= el.u1; +477 var v1= el.v1; +478 if ( this.offsetX || this.offsetY ) { +479 var w= this.ownerActor.width; +480 var h= this.ownerActor.height; +481 +482 var tp= im.__texturePage; +483 +484 var _u= -this.offsetX / tp.width; +485 var _v= -this.offsetY / tp.height; +486 var _u1=(w-this.offsetX) / tp.width; +487 var _v1=(h-this.offsetY) / tp.height; +488 +489 u= _u + im.__u; +490 v= _v + im.__v; +491 u1= _u1 + im.__u; +492 v1= _v1 + im.__v; +493 } +494 +495 if (im.inverted) { +496 uvBuffer[index++] = u1; +497 uvBuffer[index++] = v; +498 +499 uvBuffer[index++] = u1; +500 uvBuffer[index++] = v1; +501 +502 uvBuffer[index++] = u; +503 uvBuffer[index++] = v1; +504 +505 uvBuffer[index++] = u; +506 uvBuffer[index++] = v; +507 } else { +508 uvBuffer[index++] = u; +509 uvBuffer[index++] = v; +510 +511 uvBuffer[index++] = u1; +512 uvBuffer[index++] = v; +513 +514 uvBuffer[index++] = u1; +515 uvBuffer[index++] = v1; +516 +517 uvBuffer[index++] = u; +518 uvBuffer[index++] = v1; +519 } +520 }, +521 /** +522 * Set the elapsed time needed to change the image index. +523 * @param fps an integer indicating the time in milliseconds to change. +524 * @return this +525 */ +526 setChangeFPS : function(fps) { +527 this.changeFPS= fps; +528 return this; +529 }, +530 /** +531 * Set the transformation to apply to the Sprite image. +532 * Any value of +533 * <li>TR_NONE +534 * <li>TR_FLIP_HORIZONTAL +535 * <li>TR_FLIP_VERTICAL +536 * <li>TR_FLIP_ALL +537 * +538 * @param transformation an integer indicating one of the previous values. +539 * @return this +540 */ +541 setSpriteTransformation : function( transformation ) { +542 this.transformation= transformation; +543 switch(transformation) { +544 case this.TR_FLIP_HORIZONTAL: +545 this.paint= this.paintInvertedH; +546 break; +547 case this.TR_FLIP_VERTICAL: +548 this.paint= this.paintInvertedV; +549 break; +550 case this.TR_FLIP_ALL: +551 this.paint= this.paintInvertedHV; +552 break; +553 case this.TR_FIXED_TO_SIZE: +554 this.paint= this.paintScaled; +555 break; +556 case this.TR_TILE: +557 this.paint= this.paintTiled; +558 break; +559 default: +560 this.paint= this.paintN; +561 } +562 return this; +563 }, +564 +565 /** +566 * Set the sprite animation images index. This method accepts an array of objects which define indexes to +567 * subimages inside this sprite image. +568 * If the SpriteImage is instantiated by calling the method initialize( image, rows, cols ), the value of +569 * aAnimationImageIndex should be an array of numbers, which define the indexes into an array of subimages +570 * with size rows*columns. +571 * If the method InitializeFromMap( image, map ) is called, the value for aAnimationImageIndex is expected +572 * to be an array of strings which are the names of the subobjects contained in the map object. +573 * +574 * @param aAnimationImageIndex an array indicating the Sprite's frames. +575 */ +576 setAnimationImageIndex : function( aAnimationImageIndex ) { +577 this.animationImageIndex= aAnimationImageIndex; +578 this.spriteIndex= aAnimationImageIndex[0]; +579 +580 return this; +581 }, +582 setSpriteIndex : function(index) { +583 this.spriteIndex= index; +584 return this; +585 }, +586 +587 /** +588 * Draws the sprite image calculated and stored in spriteIndex. +589 * +590 * @param director the CAAT.Director object instance that contains the Scene the Actor is in. +591 * @param time an integer indicating the Scene time when the bounding box is to be drawn. +592 */ +593 setSpriteIndexAtTime : function(time) { +594 +595 if ( this.animationImageIndex.length>1 ) { +596 if ( this.prevAnimationTime===-1 ) { +597 this.prevAnimationTime= time; +598 this.spriteIndex=0; +599 } +600 else { +601 var ttime= time; +602 ttime-= this.prevAnimationTime; +603 ttime/= this.changeFPS; +604 ttime%= this.animationImageIndex.length; +605 this.spriteIndex= this.animationImageIndex[Math.floor(ttime)]; +606 } +607 } +608 }, +609 +610 /** +611 * This method takes the output generated from the tool at http://labs.hyperandroid.com/static/texture/spriter.html +612 * and creates a map into that image. +613 * @param image {Image|HTMLImageElement|Canvas} an image +614 * @param map {object} the map into the image to define subimages. +615 */ +616 initializeFromMap : function( image, map ) { +617 this.initialize( image, 1, 1 ); +618 +619 var key; +620 var helper; +621 var count=0; +622 +623 for( key in map ) { +624 var value= map[key]; +625 +626 helper= new CAAT.SpriteImageHelper( +627 value.x, +628 value.y, +629 value.width, +630 value.height, +631 image.width, +632 image.height +633 ); +634 +635 this.mapInfo[key]= helper; +636 +637 // set a default spriteIndex +638 if ( !count ) { +639 this.setAnimationImageIndex( [key] ); +640 } 641 -642 return this; -643 } +642 count++; +643 } 644 -645 -646 }; -647 })(); -648 \ No newline at end of file +645 return this; +646 }, +647 +648 /** +649 * +650 * @param image +651 * @param map +652 */ +653 initializeAsFontMap : function( image, map ) { +654 this.initialize( image, 1, 1 ); +655 +656 var key; +657 var helper; +658 var count=0; +659 +660 for( key in map ) { +661 var value= map[key]; +662 +663 helper= new CAAT.SpriteImageHelper( +664 value.x, +665 value.y, +666 value.width, +667 value.height, +668 image.width, +669 image.height +670 ); +671 +672 helper.xoffset= typeof value.xoffset==='undefined' ? 0 : value.xoffset; +673 helper.yoffset= typeof value.yoffset==='undefined' ? 0 : value.yoffset; +674 helper.xadvance= typeof value.xadvance==='undefined' ? value.width : value.xadvance; +675 +676 this.mapInfo[key]= helper; +677 +678 // set a default spriteIndex +679 if ( !count ) { +680 this.setAnimationImageIndex( [key] ); +681 } +682 +683 count++; +684 } +685 +686 return this; +687 }, +688 +689 stringWidth : function( str ) { +690 var i,l,w=0,charInfo; +691 +692 for( i=0, l=str.length; i<l; i++ ) { +693 charInfo= this.mapInfo[ str.charAt(i) ]; +694 if ( charInfo ) { +695 w+= charInfo.xadvance; +696 } +697 } +698 +699 return w; +700 }, +701 +702 drawString : function( ctx, str, x, y ) { +703 var i, l, charInfo, w; +704 +705 for( i=0, l=str.length; i<l; i++ ) { +706 charInfo= this.mapInfo[ str.charAt(i) ]; +707 if ( charInfo ) { +708 w= charInfo.width; +709 ctx.drawImage( +710 this.image, +711 charInfo.x, charInfo.y, +712 w, charInfo.height, +713 +714 x + charInfo.xoffset, y + charInfo.yoffset, +715 w, charInfo.height ); +716 +717 x+= charInfo.xadvance; +718 } +719 } +720 } +721 +722 +723 }; +724 })(); +725 \ No newline at end of file diff --git a/src/math/rectangle.js b/src/math/rectangle.js index 921db9f2..807b0e6c 100644 --- a/src/math/rectangle.js +++ b/src/math/rectangle.js @@ -123,6 +123,22 @@ this.union( rectangle.x, rectangle.y1 ); this.union( rectangle.x1, rectangle.y1 ); return this; + }, + intersects : function( r ) { + if ( r.x1< this.x ) { + return false; + } + if ( r.x > this.x1 ) { + return false; + } + if ( r.y1< this.y ) { + return false; + } + if ( r.y> this.y1 ) { + return false; + } + + return true; } }; })(); \ No newline at end of file diff --git a/src/model/actor.js b/src/model/actor.js index e5c6e363..66fdf22b 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -41,7 +41,6 @@ ]; this.scaleAnchor= this.ANCHOR_CENTER; - this.rotateAnchor= this.ANCHOR_CENTER; this.modelViewMatrix= new CAAT.Matrix(); this.worldModelViewMatrix= new CAAT.Matrix(); @@ -146,6 +145,11 @@ __d_ay: -1, gestureEnabled: false, + invalid : true, + + invalidate : function() { + this.invalid= true; + }, setGestureEnabled : function( enable ) { this.gestureEnabled= !!enable; }, @@ -369,48 +373,6 @@ this.lifecycleListenerList[i].actorLifeCycleEvent(this, sEventType, time); } }, - /** - * Calculates the 2D bounding box in canvas coordinates of the Actor. - * This bounding box takes into account the transformations applied hierarchically for - * each Scene Actor. - * - * @private - * - */ - setScreenBounds : function() { - - this.viewVertices[0].set(0, 0); - this.viewVertices[1].set(this.width, 0); - this.viewVertices[2].set(this.width, this.height); - this.viewVertices[3].set(0, this.height); - - this.modelToView( this.viewVertices ); - - var xmin= Number.MAX_VALUE, xmax=Number.MIN_VALUE; - var ymin= Number.MAX_VALUE, ymax=Number.MIN_VALUE; - - for( var i=0; i<4; i++ ) { - if ( this.viewVertices[i].x < xmin ) { - xmin=this.viewVertices[i].x; - } - if ( this.viewVertices[i].x > xmax ) { - xmax=this.viewVertices[i].x; - } - if ( this.viewVertices[i].y < ymin ) { - ymin=this.viewVertices[i].y; - } - if ( this.viewVertices[i].y > ymax ) { - ymax=this.viewVertices[i].y; - } - } - - this.AABB.x= xmin; - this.AABB.y= ymin; - this.AABB.width= (xmax-xmin); - this.AABB.height= (ymax-ymin); - - return this; - }, /** * Sets this Actor as Expired. * If this is a Container, all the contained Actors won't be nor drawn nor will receive @@ -489,7 +451,6 @@ */ resetTransform : function () { this.rotationAngle=0; - this.rotateAnchor=0; this.rotationX=.5; this.rotationY=.5; this.scaleX=1; @@ -865,13 +826,25 @@ * */ modelToView : function(point) { + + var tm= this.worldModelViewMatrix.matrix; + if ( point instanceof Array ) { for( var i=0; i xmax ) { + xmax=vv[i].x; + } + if ( vv[i].y < ymin ) { + ymin=vv[i].y; + } + if ( vv[i].y > ymax ) { + ymax=vv[i].y; + } + } + + var AABB= this.AABB; + AABB.x= xmin; + AABB.y= ymin; + AABB.x1= xmax; + AABB.y1= ymax; + AABB.width= (xmax-xmin); + AABB.height= (ymax-ymin); return this; }, @@ -1304,6 +1319,9 @@ this.frameAlpha= this.parent ? this.parent.frameAlpha*this.alpha : 1; ctx.globalAlpha= this.frameAlpha; + director.modelViewMatrix.transformRenderingContextSet( ctx ); + ctx.save(); + this.worldModelViewMatrix.transformRenderingContext(ctx); if ( this.clip ) { @@ -1318,6 +1336,8 @@ this.paint(director, time); + ctx.restore(); + return true; }, /** @@ -1731,10 +1751,6 @@ } var ctx= director.ctx; - var dmvm= director.modelViewMatrix; - - ctx.save(); -// dmvm.transformRenderingContextSet( ctx ); CAAT.ActorContainer.superclass.paintActor.call(this,director,time); if ( !this.isGlobalAlpha ) { @@ -1743,13 +1759,9 @@ for( var actor= this.activeChildren; actor; actor=actor.__next ) { if ( actor.visible ) { - dmvm.transformRenderingContextSet( ctx ); - ctx.save(); actor.paintActor(director,time); - ctx.restore(); } } - ctx.restore(); return true; }, @@ -1854,7 +1866,11 @@ } for( i=0, l=markDelete.length; i=this.dirtyRects.length ) { + for( i=0; i<32; i++ ) { + this.dirtyRects.push( new CAAT.Rectangle() ); + } + } + + var r= this.dirtyRects[ this.dirtyRectsIndex ]; + + r.x= rectangle.x; + r.y= rectangle.y; + r.x1= rectangle.x1; + r.y1= rectangle.y1; + r.width= rectangle.width; + r.height= rectangle.height; + + this.cDirtyRects.push( r ); + + }, /** * This method draws an Scene to an offscreen canvas. This offscreen canvas is also a child of * another Scene (transitionScene). So instead of drawing two scenes while transitioning from @@ -1228,6 +1321,9 @@ */ setClear : function(clear) { this.clear = clear; + if ( this.clear===CAAT.Director.CLEAR_DIRTY_RECTS ) { + this.dirtyRectsEnabled= true; + } return this; }, /**