Merge pull request #119 from pandamicro/master

Added _ccsg.Node._requestDirtyFlag
This commit is contained in:
pandamicro
2015-12-24 16:48:12 +08:00
2 changed files with 26 additions and 3 deletions
+2 -1
View File
@@ -92,7 +92,8 @@ cc._LogInfos = {
runAction: "cc.Node.runAction(): action must be non-null",
schedule: "callback function must be non-null",
schedule_2: "interval must be positive",
initWithTexture: "cocos2d: Could not initialize cc.AtlasNode. Invalid Texture."
initWithTexture: "cocos2d: Could not initialize cc.AtlasNode. Invalid Texture.",
_requestDirtyFlag: "_ccsg.Node._requestDirtyFlag: failed to satisfy the request, key (%s) for flag have already been taken"
},
AtlasNode: {
@@ -35,8 +35,30 @@ cc.CustomRenderCmd = function (target, func) {
}
};
_ccsg.Node._dirtyFlags = {transformDirty: 1 << 0, visibleDirty: 1 << 1, colorDirty: 1 << 2, opacityDirty: 1 << 3, cacheDirty: 1 << 4,
orderDirty: 1 << 5, textDirty: 1 << 6, gradientDirty:1 << 7, all: (1 << 8) - 1};
_ccsg.Node._dirtyFlags = {
transformDirty: 1 << 0,
visibleDirty: 1 << 1,
colorDirty: 1 << 2,
opacityDirty: 1 << 3,
cacheDirty: 1 << 4,
orderDirty: 1 << 5,
textDirty: 1 << 6,
gradientDirty:1 << 7,
COUNT: 8
};
cc.js.get(_ccsg.Node._dirtyFlags, 'all', function () {
var count = _ccsg.Node._dirtyFlags.COUNT;
return (1 << count) - 1;
}, false);
_ccsg.Node._requestDirtyFlag = function (key) {
cc.assert(!_ccsg.Node._dirtyFlags[key], cc._LogInfos.Node._requestDirtyFlag, key);
var count = _ccsg.Node._dirtyFlags.COUNT;
var value = 1 << count;
_ccsg.Node._dirtyFlags[key] = value;
_ccsg.Node._dirtyFlags.COUNT++;
return value;
};
//-------------------------Base -------------------------
_ccsg.Node.RenderCmd = function(renderable){