diff --git a/cocos2d/base_nodes/CCAtlasNode.js b/cocos2d/base_nodes/CCAtlasNode.js index e1cd1e99e8..2b121fc010 100644 --- a/cocos2d/base_nodes/CCAtlasNode.js +++ b/cocos2d/base_nodes/CCAtlasNode.js @@ -71,8 +71,8 @@ cc.AtlasNode = cc.Node.extend(/** @lends cc.AtlasNode# */{ this._itemHeight = tileHeight; this._opacity = 255; - this._color = cc.WHITE(); - this._colorUnmodified = cc.WHITE(); + this._color = cc.white(); + this._colorUnmodified = cc.white(); this._isOpacityModifyRGB = true; this._blendFunc.src = cc.BLEND_SRC; diff --git a/cocos2d/label_nodes/CCLabelBMFont.js b/cocos2d/label_nodes/CCLabelBMFont.js index 9f35926d72..07ccf3d0b7 100644 --- a/cocos2d/label_nodes/CCLabelBMFont.js +++ b/cocos2d/label_nodes/CCLabelBMFont.js @@ -584,7 +584,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{ this._imageOffset = imageOffset || cc.PointZero(); this._width = width || cc.LabelAutomaticWidth; this._opacity = 255; - this._color = cc.WHITE(); + this._color = cc.white(); this._contentSize = cc.SizeZero(); this.setString(theString); this.setAnchorPoint(cc.p(0.5, 0.5)); diff --git a/cocos2d/label_nodes/CCLabelTTF.js b/cocos2d/label_nodes/CCLabelTTF.js index 9b224905fb..334f06122b 100644 --- a/cocos2d/label_nodes/CCLabelTTF.js +++ b/cocos2d/label_nodes/CCLabelTTF.js @@ -45,7 +45,7 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{ */ ctor:function () { this._super(); - this._color = cc.WHITE(); + this._color = cc.white(); this._opacityModifyRGB = false; this._fontStyleStr = ""; }, diff --git a/cocos2d/layers_scenes_transitions_nodes/CCTransition.js b/cocos2d/layers_scenes_transitions_nodes/CCTransition.js index defbd1933e..1870cb7de3 100644 --- a/cocos2d/layers_scenes_transitions_nodes/CCTransition.js +++ b/cocos2d/layers_scenes_transitions_nodes/CCTransition.js @@ -1328,7 +1328,7 @@ cc.TransitionFade = cc.TransitionScene.extend(/** @lends cc.TransitionFade# */{ */ initWithDuration:function (t, scene, color) { if ((color == 'undefined') || (color == null)) { - color = cc.BLACK(); + color = cc.black(); } if (this._super(t, scene)) { diff --git a/cocos2d/menu_nodes/CCMenuItem.js b/cocos2d/menu_nodes/CCMenuItem.js index a9b52ff495..9c7c6d78b9 100644 --- a/cocos2d/menu_nodes/CCMenuItem.js +++ b/cocos2d/menu_nodes/CCMenuItem.js @@ -292,7 +292,7 @@ cc.MenuItemLabel = cc.MenuItem.extend(/** @lends cc.MenuItemLabel# */{ initWithLabel:function (label, target, selector) { this.initWithCallback(target, selector); this._originalScale = 1.0; - this._colorBackup = cc.WHITE(); + this._colorBackup = cc.white(); this._disabledColor = cc.c3b(126, 126, 126); this.setLabel(label); return true; diff --git a/cocos2d/platform/CCTypes.js b/cocos2d/platform/CCTypes.js index f72ebe319c..6418448f5e 100644 --- a/cocos2d/platform/CCTypes.js +++ b/cocos2d/platform/CCTypes.js @@ -91,7 +91,7 @@ cc.c3 = cc.c3b; * @constant * @type {Number,Number,Number} */ -cc.WHITE = function () { +cc.white = function () { return new cc.Color3B(255, 255, 255); }; @@ -100,7 +100,7 @@ cc.WHITE = function () { * @constant * @type {Number,Number,Number} */ -cc.YELLOW = function () { +cc.yellow = function () { return new cc.Color3B(255, 255, 0); }; @@ -109,7 +109,7 @@ cc.YELLOW = function () { * @constant * @type {Number,Number,Number} */ -cc.BLUE = function () { +cc.blue = function () { return new cc.Color3B(0, 0, 255); }; @@ -118,7 +118,7 @@ cc.BLUE = function () { * @constant * @type {Number,Number,Number} */ -cc.GREEN = function () { +cc.green = function () { return new cc.Color3B(0, 255, 0); }; @@ -127,7 +127,7 @@ cc.GREEN = function () { * @constant * @type {Number,Number,Number} */ -cc.RED = function () { +cc.red = function () { return new cc.Color3B(255, 0, 0); }; @@ -136,7 +136,7 @@ cc.RED = function () { * @constant * @type {Number,Number,Number} */ -cc.MAGENTA = function () { +cc.magenta = function () { return new cc.Color3B(255, 0, 255); }; @@ -145,7 +145,7 @@ cc.MAGENTA = function () { * @constant * @type {Number,Number,Number} */ -cc.BLACK = function () { +cc.black = function () { return new cc.Color3B(0, 0, 0); }; @@ -154,7 +154,7 @@ cc.BLACK = function () { * @constant * @type {Number,Number,Number} */ -cc.ORANGE = function () { +cc.orange = function () { return new cc.Color3B(255, 127, 0); }; @@ -163,7 +163,7 @@ cc.ORANGE = function () { * @constant * @type {Number,Number,Number} */ -cc.GRAY = function () { +cc.gray = function () { return new cc.Color3B(166, 166, 166); } diff --git a/cocos2d/sprite_nodes/CCSprite.js b/cocos2d/sprite_nodes/CCSprite.js index b636924556..6145572f9c 100644 --- a/cocos2d/sprite_nodes/CCSprite.js +++ b/cocos2d/sprite_nodes/CCSprite.js @@ -248,7 +248,7 @@ cc.Sprite = cc.Node.extend(/** @lends cc.Sprite# */{ _blendFunc: {src:cc.BLEND_SRC, dst:cc.BLEND_DST}, _texture:null, _originalTexture:null, - _color:cc.WHITE(), + _color:cc.white(), // // Shared data // @@ -434,8 +434,8 @@ cc.Sprite = cc.Node.extend(/** @lends cc.Sprite# */{ this._opacityModifyRGB = true; this._opacity = 255; - this._color = cc.WHITE(); - this._colorUnmodified = cc.WHITE(); + this._color = cc.white(); + this._colorUnmodified = cc.white(); this._blendFunc.src = cc.BLEND_SRC; this._blendFunc.dst = cc.BLEND_DST; @@ -491,8 +491,8 @@ cc.Sprite = cc.Node.extend(/** @lends cc.Sprite# */{ this.setDirty(false); this._opacityModifyRGB = true; this._opacity = 255; - this._color = cc.WHITE(); - this._colorUnmodified = cc.WHITE(); + this._color = cc.white(); + this._colorUnmodified = cc.white(); this._blendFunc.src = cc.BLEND_SRC; this._blendFunc.dst = cc.BLEND_DST; diff --git a/cocos2d/tileMap_parallax_nodes/CCTileMapAtlas.js b/cocos2d/tileMap_parallax_nodes/CCTileMapAtlas.js index 1b7d1389ae..f7fc0e4ab7 100644 --- a/cocos2d/tileMap_parallax_nodes/CCTileMapAtlas.js +++ b/cocos2d/tileMap_parallax_nodes/CCTileMapAtlas.js @@ -129,7 +129,7 @@ cc.TileMapAtlas = cc.AtlasNode.extend(/** @lends cc.TileMapAtlas# */{ this._loadTGAfile(mapFile); this._calculateItemsToRender(); if (this.initWithTileFile(tile, tileWidth, tileHeight, this._itemsToRender)) { - this._color = cc.WHITE(); + this._color = cc.white(); this._posToAtlasIndex = new Object(); this._updateAtlasValues(); this.setContentSize(cc.size((this._GAInfo.width * this._itemWidth), diff --git a/tests/src/tests/ActionsTest/ActionsTest.js b/tests/src/tests/ActionsTest/ActionsTest.js index d6ec632b6b..af4183ad6f 100644 --- a/tests/src/tests/ActionsTest/ActionsTest.js +++ b/tests/src/tests/ActionsTest/ActionsTest.js @@ -293,7 +293,7 @@ var ActionManual = ActionsDemo.extend({ this._grossini.setColor(cc.c3b(255, 0, 0)); this._kathia.setPosition(cc.p(s.width - 100, s.height / 2)); - this._kathia.setColor(cc.BLUE()); + this._kathia.setColor(cc.blue()); }, subtitle:function () { return "Manual Transformation"; diff --git a/tests/src/tests/CocosNodeTest/CocosNodeTest.js b/tests/src/tests/CocosNodeTest/CocosNodeTest.js index 5dfc6d11c9..2cdff9de61 100644 --- a/tests/src/tests/CocosNodeTest/CocosNodeTest.js +++ b/tests/src/tests/CocosNodeTest/CocosNodeTest.js @@ -532,7 +532,7 @@ var CameraCenterTest = TestCocosNodeDemo.extend({ sprite.init(); this.addChild(sprite, 0); sprite.setPosition(cc.p(s.width / 5 * 1, s.height / 5 * 1)); - sprite.setColor(cc.RED()); + sprite.setColor(cc.red()); sprite.setTextureRect(cc.rect(0, 0, 120, 50)); var orbit = cc.OrbitCamera.create(10, 1, 0, 0, 360, 0, 0); sprite.runAction(cc.RepeatForever.create(orbit)); @@ -542,7 +542,7 @@ var CameraCenterTest = TestCocosNodeDemo.extend({ sprite.init(); this.addChild(sprite, 0, 40); sprite.setPosition(cc.p(s.width / 5 * 1, s.height / 5 * 4)); - sprite.setColor(cc.BLUE()); + sprite.setColor(cc.blue()); sprite.setTextureRect(cc.rect(0, 0, 120, 50)); orbit = cc.OrbitCamera.create(10, 1, 0, 0, 360, 0, 0); sprite.runAction(cc.RepeatForever.create(orbit)); @@ -552,7 +552,7 @@ var CameraCenterTest = TestCocosNodeDemo.extend({ sprite.init(); this.addChild(sprite, 0); sprite.setPosition(cc.p(s.width / 5 * 4, s.height / 5 * 1)); - sprite.setColor(cc.YELLOW()); + sprite.setColor(cc.yellow()); sprite.setTextureRect(cc.rect(0, 0, 120, 50)); orbit = cc.OrbitCamera.create(10, 1, 0, 0, 360, 0, 0); sprite.runAction(cc.RepeatForever.create(orbit)); @@ -562,7 +562,7 @@ var CameraCenterTest = TestCocosNodeDemo.extend({ sprite.init(); this.addChild(sprite, 0, 40); sprite.setPosition(cc.p(s.width / 5 * 4, s.height / 5 * 4)); - sprite.setColor(cc.GREEN()); + sprite.setColor(cc.green()); sprite.setTextureRect(cc.rect(0, 0, 120, 50)); orbit = cc.OrbitCamera.create(10, 1, 0, 0, 360, 0, 0); sprite.runAction(cc.RepeatForever.create(orbit)); @@ -572,7 +572,7 @@ var CameraCenterTest = TestCocosNodeDemo.extend({ sprite.init(); this.addChild(sprite, 0, 40); sprite.setPosition(cc.p(s.width / 2, s.height / 2)); - sprite.setColor(cc.WHITE()); + sprite.setColor(cc.white()); sprite.setTextureRect(cc.rect(0, 0, 120, 50)); orbit = cc.OrbitCamera.create(10, 1, 0, 0, 360, 0, 0); sprite.runAction(cc.RepeatForever.create(orbit)); diff --git a/tests/src/tests/LabelTest/LabelTest.js b/tests/src/tests/LabelTest/LabelTest.js index 71bb8f0ad5..f22281a70f 100644 --- a/tests/src/tests/LabelTest/LabelTest.js +++ b/tests/src/tests/LabelTest/LabelTest.js @@ -312,7 +312,7 @@ var LabelAtlasColorTest = AtlasDemo.extend({ var label2 = cc.LabelAtlas.create("0123456789", "res/fonts/tuffy_bold_italic-charmap.png", 48, 64, ' '); this.addChild(label2, 0, TAG_LABEL_SPRITE12); label2.setPosition(cc.p(10, 200)); - label2.setColor(cc.RED()); + label2.setColor(cc.red()); var fade = cc.FadeOut.create(1.0); var fade_in = fade.reverse(); @@ -373,7 +373,7 @@ var Atlas3 = AtlasDemo.extend({ var label2 = cc.LabelBMFont.create("Test", "res/fonts/bitmapFontTest2.fnt"); // testing anchors label2.setAnchorPoint(cc.p(0.5, 0.5)); - label2.setColor(cc.RED()); + label2.setColor(cc.red()); this.addChild(label2, 0, TAG_BITMAP_ATLAS2); label2.runAction(repeat.copy()); @@ -477,7 +477,7 @@ var Atlas4 = AtlasDemo.extend({ }, draw:function () { var s = cc.Director.getInstance().getWinSize(); - var c = cc.RED(); + var c = cc.red(); cc.renderContext.strokeStyle = "rgba(" + c.r + "," + c.g + "," + c.b + ",1)"; cc.drawingUtil.drawLine(cc.p(0, s.height / 2), cc.p(s.width, s.height / 2)); cc.drawingUtil.drawLine(cc.p(s.width / 2, 0), cc.p(s.width / 2, s.height)); @@ -564,7 +564,7 @@ var AtlasBitmapColor = AtlasDemo.extend({ var label = null; label = cc.LabelBMFont.create("Blue", "res/fonts/bitmapFontTest5.fnt"); - label.setColor(cc.BLUE()); + label.setColor(cc.blue()); this.addChild(label); label.setPosition(cc.p(s.width / 2, s.height / 4)); label.setAnchorPoint(cc.p(0.5, 0.5)); @@ -573,13 +573,13 @@ var AtlasBitmapColor = AtlasDemo.extend({ this.addChild(label); label.setPosition(cc.p(s.width / 2, 2 * s.height / 4)); label.setAnchorPoint(cc.p(0.5, 0.5)); - label.setColor(cc.RED()); + label.setColor(cc.red()); label = cc.LabelBMFont.create("G", "res/fonts/bitmapFontTest5.fnt"); this.addChild(label); label.setPosition(cc.p(s.width / 2, 3 * s.height / 4)); label.setAnchorPoint(cc.p(0.5, 0.5)); - label.setColor(cc.GREEN()); + label.setColor(cc.green()); label.setString("Green"); }, title:function () { @@ -999,7 +999,7 @@ var BitmapFontMultiLineAlignment = AtlasDemo.extend({ var stringMenu = cc.Menu.create(longSentences, lineBreaks, mixed); stringMenu.alignItemsVertically(); - longSentences.setColor(cc.RED()); + longSentences.setColor(cc.red()); this.lastSentenceItem = longSentences; longSentences.setTag(LongSentences); lineBreaks.setTag(LineBreaks); @@ -1013,7 +1013,7 @@ var BitmapFontMultiLineAlignment = AtlasDemo.extend({ var alignmentMenu = cc.Menu.create(left, center, right); alignmentMenu.alignItemsHorizontallyWithPadding(alignmentItemPadding); - center.setColor(cc.RED()); + center.setColor(cc.red()); this.lastAlignmentItem = center; left.setTag(LeftAlign); center.setTag(CenterAlign); @@ -1046,8 +1046,8 @@ var BitmapFontMultiLineAlignment = AtlasDemo.extend({ return ""; }, stringChanged:function (sender) { - sender.setColor(cc.RED()); - this.lastSentenceItem.setColor(cc.WHITE()); + sender.setColor(cc.red()); + this.lastSentenceItem.setColor(cc.white()); this.lastSentenceItem = sender; switch (sender.getTag()) { @@ -1069,8 +1069,8 @@ var BitmapFontMultiLineAlignment = AtlasDemo.extend({ }, alignmentChanged:function (sender) { var item = sender; - item.setColor(cc.RED()); - this.lastAlignmentItem.setColor(cc.WHITE()); + item.setColor(cc.red()); + this.lastAlignmentItem.setColor(cc.white()); this.lastAlignmentItem = item; switch (item.getTag()) { @@ -1138,7 +1138,7 @@ var LabelTTFA8Test = AtlasDemo.extend({ // cc.LabelBMFont var label1 = cc.LabelTTF.create("Testing A8 Format", "Arial", 48); this.addChild(label1); - label1.setColor(cc.RED()); + label1.setColor(cc.red()); label1.setPosition(cc.p(s.width / 2, s.height / 2)); var fadeOut = cc.FadeOut.create(2); diff --git a/tests/src/tests/MultiTouchTest/MultiTouchTest.js b/tests/src/tests/MultiTouchTest/MultiTouchTest.js index 6f0084ac10..deccac204c 100644 --- a/tests/src/tests/MultiTouchTest/MultiTouchTest.js +++ b/tests/src/tests/MultiTouchTest/MultiTouchTest.js @@ -25,11 +25,11 @@ ****************************************************************************/ var touchColors = [ - cc.YELLOW(), - cc.BLUE(), - cc.GREEN(), - cc.RED(), - cc.MAGENTA() + cc.yellow(), + cc.blue(), + cc.green(), + cc.red(), + cc.magenta() ]; var TouchPoint = cc.Node.extend({ diff --git a/tests/src/tests/ParticleTest/ParticleTest.js b/tests/src/tests/ParticleTest/ParticleTest.js index 767ed301d5..346126fdb4 100644 --- a/tests/src/tests/ParticleTest/ParticleTest.js +++ b/tests/src/tests/ParticleTest/ParticleTest.js @@ -865,7 +865,7 @@ var DemoParticleFromFile = ParticleDemo.extend({ onEnter:function () { this._super(); - this.setColor(cc.BLACK()); + this.setColor(cc.black()); this.removeChild(this._background, true); this._background = null; @@ -885,7 +885,7 @@ var RadiusMode1 = ParticleDemo.extend({ onEnter:function () { this._super(); - this.setColor(cc.BLACK()); + this.setColor(cc.black()); this.removeChild(this._background, true); this._background = null; @@ -964,7 +964,7 @@ var RadiusMode2 = ParticleDemo.extend({ onEnter:function () { this._super(); - this.setColor(cc.BLACK()); + this.setColor(cc.black()); this.removeChild(this._background, true); this._background = null; @@ -1043,7 +1043,7 @@ var Issue704 = ParticleDemo.extend({ onEnter:function () { this._super(); - this.setColor(cc.BLACK()); + this.setColor(cc.black()); this.removeChild(this._background, true); this._background = null; @@ -1128,7 +1128,7 @@ var Issue870 = ParticleDemo.extend({ onEnter:function () { this._super(); - this.setColor(cc.BLACK()); + this.setColor(cc.black()); this.removeChild(this._background, true); this._background = null; diff --git a/tests/src/tests/SpriteTest/SpriteTest.js b/tests/src/tests/SpriteTest/SpriteTest.js index 003c9b22b2..3a00bb511d 100644 --- a/tests/src/tests/SpriteTest/SpriteTest.js +++ b/tests/src/tests/SpriteTest/SpriteTest.js @@ -598,7 +598,7 @@ var SpriteZOrder = SpriteTestDemo.extend({ this.addChild(sprite, -1, TAG_SPRITE1); sprite.setPosition(cc.p(s.width / 2, s.height / 2 - 20)); sprite.setScaleX(10); - sprite.setColor(cc.RED()); + sprite.setColor(cc.red()); this.schedule(this.reorderSprite, 1); }, @@ -655,7 +655,7 @@ var SpriteBatchNodeZOrder = SpriteTestDemo.extend({ batch.addChild(sprite, -1, TAG_SPRITE1); sprite.setPosition(cc.p(s.width / 2, s.height / 2 - 20)); sprite.setScaleX(10); - sprite.setColor(cc.RED()); + sprite.setColor(cc.red()); this.schedule(this.reorderSprite, 1); }, @@ -3274,7 +3274,7 @@ var SpriteNilTexture = SpriteTestDemo.extend({ var sprite = new cc.Sprite(); sprite.init(); sprite.setTextureRect(cc.rect(0, 0, 300, 300)); - sprite.setColor(cc.RED()); + sprite.setColor(cc.red()); sprite.setOpacity(128); sprite.setPosition(cc.p(3 * s.width / 4, s.height / 2)); this.addChild(sprite, 100); @@ -3282,7 +3282,7 @@ var SpriteNilTexture = SpriteTestDemo.extend({ sprite = new cc.Sprite(); sprite.init(); sprite.setTextureRect(cc.rect(0, 0, 300, 300)); - sprite.setColor(cc.BLUE()); + sprite.setColor(cc.blue()); sprite.setOpacity(128); sprite.setPosition(cc.p(s.width / 4, s.height / 2)); this.addChild(sprite, 100); diff --git a/tests/src/tests/TransitionsTest/TransitionsTest.js b/tests/src/tests/TransitionsTest/TransitionsTest.js index 0d590d537c..bf94f13afe 100644 --- a/tests/src/tests/TransitionsTest/TransitionsTest.js +++ b/tests/src/tests/TransitionsTest/TransitionsTest.js @@ -349,7 +349,7 @@ var FadeTransition = function (t, s) { }; var FadeWhiteTransition = function (t, s) { - return cc.TransitionFade.create(t, s, cc.WHITE()); + return cc.TransitionFade.create(t, s, cc.white()); }; var FlipXLeftOver = function (t, s) {