mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #361 from knoxHuang/master
remove contentScaleFactor
This commit is contained in:
@@ -450,7 +450,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL#
|
||||
* @param {Number} pointSize
|
||||
*/
|
||||
setPointSize:function (pointSize) {
|
||||
this._pointSize = pointSize * cc.contentScaleFactor();
|
||||
this._pointSize = pointSize;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -685,8 +685,7 @@ cc.BMFontHelper = {
|
||||
var longestLine = 0;
|
||||
var letterRight = 0;
|
||||
|
||||
var contentScaleFactor = cc.contentScaleFactor();
|
||||
var lineSpacing = this._lineSpacing * contentScaleFactor;
|
||||
var lineSpacing = this._lineSpacing;
|
||||
var highestY = 0;
|
||||
var lowestY = 0;
|
||||
var letterDef = null;
|
||||
@@ -728,7 +727,7 @@ cc.BMFontHelper = {
|
||||
continue;
|
||||
}
|
||||
|
||||
var letterX = (nextLetterX + letterDef._offsetX * this._bmfontScale) / contentScaleFactor;
|
||||
var letterX = nextLetterX + letterDef._offsetX * this._bmfontScale;
|
||||
|
||||
if (this._isWrapText
|
||||
&& this._maxLineWidth > 0
|
||||
@@ -746,7 +745,7 @@ cc.BMFontHelper = {
|
||||
letterPosition.x = letterX;
|
||||
}
|
||||
|
||||
letterPosition.y = (nextTokenY - letterDef._offsetY * this._bmfontScale) / contentScaleFactor;
|
||||
letterPosition.y = nextTokenY - letterDef._offsetY * this._bmfontScale;
|
||||
this._recordLetterInfo(letterPosition, character, letterIndex, lineIndex);
|
||||
|
||||
if (letterIndex + 1 < this._horizontalKernings.length && letterIndex < textLen - 1) {
|
||||
@@ -788,7 +787,7 @@ cc.BMFontHelper = {
|
||||
this._linesWidth.push(letterRight);
|
||||
|
||||
this._numberOfLines = lineIndex + 1;
|
||||
this._textDesiredHeight = (this._numberOfLines * this._lineHeight * this._bmfontScale) / contentScaleFactor;
|
||||
this._textDesiredHeight = this._numberOfLines * this._lineHeight * this._bmfontScale;
|
||||
if (this._numberOfLines > 1) {
|
||||
this._textDesiredHeight += (this._numberOfLines - 1) * this._lineSpacing;
|
||||
}
|
||||
@@ -1001,7 +1000,7 @@ cc.BMFontHelper = {
|
||||
_updateBMFontScale: function() {
|
||||
if (this._labelType === _ccsg.Label.Type.BMFont) {
|
||||
var originalFontSize = this._fontAtlas._fontSize;
|
||||
this._bmfontScale = this._fontSize * cc.contentScaleFactor() / originalFontSize;
|
||||
this._bmfontScale = this._fontSize / originalFontSize;
|
||||
} else {
|
||||
this._bmfontScale = 1;
|
||||
}
|
||||
@@ -1047,8 +1046,6 @@ cc.BMFontHelper = {
|
||||
var letterDefinition = new cc.FontLetterDefinition();
|
||||
|
||||
var tempRect = locFontDict[fontDef].rect;
|
||||
cc.rectPointsToPixels(tempRect);
|
||||
|
||||
|
||||
letterDefinition._offsetX = locFontDict[fontDef].xOffset;
|
||||
letterDefinition._offsetY = locFontDict[fontDef].yOffset;
|
||||
|
||||
@@ -272,7 +272,7 @@ cc.LabelTTF = _ccsg.Sprite.extend(/** @lends cc.LabelTTF# */{
|
||||
* @return {cc.FontDefinition}
|
||||
*/
|
||||
getTextDefinition: function () {
|
||||
return this._prepareTextDefinition(false);
|
||||
return this._prepareTextDefinition();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -535,18 +535,12 @@ cc.LabelTTF = _ccsg.Sprite.extend(/** @lends cc.LabelTTF# */{
|
||||
this._renderCmd.setDirtyFlag(flags.colorDirty|flags.opacityDirty|flags.textDirty);
|
||||
},
|
||||
|
||||
_prepareTextDefinition: function (adjustForResolution) {
|
||||
_prepareTextDefinition: function () {
|
||||
var texDef = new cc.FontDefinition();
|
||||
|
||||
if (adjustForResolution) {
|
||||
texDef.fontSize = this._fontSize;
|
||||
texDef.boundingWidth = cc.contentScaleFactor() * this._dimensions.width;
|
||||
texDef.boundingHeight = cc.contentScaleFactor() * this._dimensions.height;
|
||||
} else {
|
||||
texDef.fontSize = this._fontSize;
|
||||
texDef.boundingWidth = this._dimensions.width;
|
||||
texDef.boundingHeight = this._dimensions.height;
|
||||
}
|
||||
texDef.fontSize = this._fontSize;
|
||||
texDef.boundingWidth = this._dimensions.width;
|
||||
texDef.boundingHeight = this._dimensions.height;
|
||||
|
||||
texDef.fontName = this._fontName;
|
||||
texDef.textAlign = this._hAlignment;
|
||||
@@ -567,8 +561,8 @@ cc.LabelTTF = _ccsg.Sprite.extend(/** @lends cc.LabelTTF# */{
|
||||
texDef.shadowBlur = this._shadowBlur;
|
||||
texDef.shadowOpacity = this._shadowOpacity;
|
||||
|
||||
texDef.shadowOffsetX = (adjustForResolution ? cc.contentScaleFactor() : 1) * this._shadowOffset.x;
|
||||
texDef.shadowOffsetY = (adjustForResolution ? cc.contentScaleFactor() : 1) * this._shadowOffset.y;
|
||||
texDef.shadowOffsetX = this._shadowOffset.x;
|
||||
texDef.shadowOffsetY = this._shadowOffset.y;
|
||||
} else
|
||||
texDef._shadowEnabled = false;
|
||||
|
||||
@@ -735,8 +729,7 @@ cc.LabelTTF = _ccsg.Sprite.extend(/** @lends cc.LabelTTF# */{
|
||||
},
|
||||
|
||||
setTextureRect: function (rect, rotated, untrimmedSize) {
|
||||
//set needConvert to false
|
||||
_ccsg.Sprite.prototype.setTextureRect.call(this, rect, rotated, untrimmedSize, false);
|
||||
_ccsg.Sprite.prototype.setTextureRect.call(this, rect, rotated, untrimmedSize);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -344,14 +344,6 @@ cc.EGLView = cc._Class.extend(/** @lends cc.view# */{
|
||||
}
|
||||
},
|
||||
|
||||
// RenderTexture hacker
|
||||
_setScaleXYForRenderTexture: function () {
|
||||
//hack for RenderTexture on canvas mode when adapting multiple resolution resources
|
||||
var scaleFactor = cc.contentScaleFactor();
|
||||
this._scaleX = scaleFactor;
|
||||
this._scaleY = scaleFactor;
|
||||
},
|
||||
|
||||
// Other helper functions
|
||||
_resetScale: function () {
|
||||
this._scaleX = this._originalScaleX;
|
||||
|
||||
@@ -234,104 +234,6 @@ cc.incrementGLDraws = function (addNumber) {
|
||||
*/
|
||||
cc.FLT_EPSILON = 0.0000001192092896;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* On Mac it returns 1;<br/>
|
||||
* On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1
|
||||
* </p>
|
||||
* @return {Number}
|
||||
* @method contentScaleFactor
|
||||
*/
|
||||
cc.contentScaleFactor = cc.IS_RETINA_DISPLAY_SUPPORTED ? function () {
|
||||
return cc.director.getContentScaleFactor();
|
||||
} : function () {
|
||||
return 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Point in points to pixels
|
||||
* @param {Vec2} points
|
||||
* @return {Vec2}
|
||||
* @method pointPointsToPixels
|
||||
*/
|
||||
cc.pointPointsToPixels = function (points) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.p(points.x * scale, points.y * scale);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Point in pixels to points
|
||||
* @param {Rect} pixels
|
||||
* @return {Vec2}
|
||||
* @method pointPixelsToPoints
|
||||
*/
|
||||
cc.pointPixelsToPoints = function (pixels) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.p(pixels.x / scale, pixels.y / scale);
|
||||
};
|
||||
|
||||
cc._pointPixelsToPointsOut = function(pixels, outPoint){
|
||||
var scale = cc.contentScaleFactor();
|
||||
outPoint.x = pixels.x / scale;
|
||||
outPoint.y = pixels.y / scale;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a Size in points to pixels
|
||||
* @param {Size} sizeInPoints
|
||||
* @return {Size}
|
||||
* @method sizePointsToPixels
|
||||
*/
|
||||
cc.sizePointsToPixels = function (sizeInPoints) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.size(sizeInPoints.width * scale, sizeInPoints.height * scale);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a size in pixels to points
|
||||
* @param {Size} sizeInPixels
|
||||
* @return {Size}
|
||||
* @method sizePixelsToPoints
|
||||
*/
|
||||
cc.sizePixelsToPoints = function (sizeInPixels) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.size(sizeInPixels.width / scale, sizeInPixels.height / scale);
|
||||
};
|
||||
|
||||
cc._sizePixelsToPointsOut = function (sizeInPixels, outSize) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
outSize.width = sizeInPixels.width / scale;
|
||||
outSize.height = sizeInPixels.height / scale;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a rect in pixels to points
|
||||
* @param {Rect} pixel
|
||||
* @return {Rect}
|
||||
* @method rectPixelsToPoints
|
||||
*/
|
||||
cc.rectPixelsToPoints = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (pixel) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.rect(pixel.x / scale, pixel.y / scale,
|
||||
pixel.width / scale, pixel.height / scale);
|
||||
} : function (p) {
|
||||
return cc.rect(p);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a rect in points to pixels
|
||||
* @param {Rect} point
|
||||
* @return {Rect}
|
||||
* @method rectPointsToPixels
|
||||
*/
|
||||
cc.rectPointsToPixels = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (point) {
|
||||
var scale = cc.contentScaleFactor();
|
||||
return cc.rect(point.x * scale, point.y * scale,
|
||||
point.width * scale, point.height * scale);
|
||||
} : function (p) {
|
||||
return cc.rect(p);
|
||||
};
|
||||
|
||||
//some gl constant variable
|
||||
/**
|
||||
* @property {Number} ONE
|
||||
|
||||
@@ -78,7 +78,6 @@ cc.LoaderScene = _ccsg.Scene.extend({
|
||||
texture2d.initWithElement(img);
|
||||
texture2d.handleLoadedTexture();
|
||||
var logo = self._logo = new _ccsg.Sprite(texture2d);
|
||||
logo.setScale(cc.contentScaleFactor());
|
||||
logo.x = centerPos.x;
|
||||
logo.y = centerPos.y;
|
||||
self._bgLayer.addChild(logo, 10);
|
||||
|
||||
@@ -758,15 +758,14 @@ _ccsg.Sprite = _ccsg.Node.extend({
|
||||
* @param {cc.Rect} rect a rect of texture
|
||||
* @param {Boolean} [rotated] Whether or not the texture is rotated
|
||||
* @param {cc.Size} [untrimmedSize] The original pixels size of the texture
|
||||
* @param {Boolean} [needConvert] contentScaleFactor switch
|
||||
*/
|
||||
setTextureRect: function (rect, rotated, untrimmedSize, needConvert) {
|
||||
setTextureRect: function (rect, rotated, untrimmedSize) {
|
||||
var _t = this;
|
||||
_t._rectRotated = rotated || false;
|
||||
_t.setContentSize(untrimmedSize || rect);
|
||||
|
||||
_t.setVertexRect(rect);
|
||||
_t._renderCmd._setTextureCoords(rect, needConvert);
|
||||
_t._renderCmd._setTextureCoords(rect);
|
||||
|
||||
var relativeOffsetX = _t._unflippedOffsetPositionFromCenter.x, relativeOffsetY = _t._unflippedOffsetPositionFromCenter.y;
|
||||
if (_t._flippedX)
|
||||
@@ -897,10 +896,10 @@ _ccsg.Sprite = _ccsg.Node.extend({
|
||||
*/
|
||||
getSpriteFrame: function () {
|
||||
return new cc.SpriteFrame(this._texture,
|
||||
cc.rectPointsToPixels(this._rect),
|
||||
this._rect,
|
||||
this._rectRotated,
|
||||
cc.pointPointsToPixels(this._unflippedOffsetPositionFromCenter),
|
||||
cc.sizePointsToPixels(this._contentSize));
|
||||
this._unflippedOffsetPositionFromCenter,
|
||||
this._contentSize);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -277,15 +277,12 @@
|
||||
node.emit("load");
|
||||
};
|
||||
|
||||
proto._setTextureCoords = function (rect, needConvert) {
|
||||
if (needConvert === undefined)
|
||||
needConvert = true;
|
||||
var locTextureRect = this._textureCoord,
|
||||
scaleFactor = needConvert ? cc.contentScaleFactor() : 1;
|
||||
locTextureRect.renderX = locTextureRect.x = 0 | (rect.x * scaleFactor);
|
||||
locTextureRect.renderY = locTextureRect.y = 0 | (rect.y * scaleFactor);
|
||||
locTextureRect.width = 0 | (rect.width * scaleFactor);
|
||||
locTextureRect.height = 0 | (rect.height * scaleFactor);
|
||||
proto._setTextureCoords = function (rect) {
|
||||
var locTextureRect = this._textureCoord;
|
||||
locTextureRect.renderX = locTextureRect.x = 0 | rect.x;
|
||||
locTextureRect.renderY = locTextureRect.y = 0 | rect.y;
|
||||
locTextureRect.width = 0 | rect.width;
|
||||
locTextureRect.height = 0 | rect.height;
|
||||
locTextureRect.validRect = !(locTextureRect.width === 0 || locTextureRect.height === 0 || locTextureRect.x < 0 || locTextureRect.y < 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -143,11 +143,7 @@
|
||||
node.emit("load");
|
||||
};
|
||||
|
||||
proto._setTextureCoords = function (rect, needConvert) {
|
||||
if (needConvert === undefined)
|
||||
needConvert = true;
|
||||
if (needConvert)
|
||||
rect = cc.rectPointsToPixels(rect);
|
||||
proto._setTextureCoords = function (rect) {
|
||||
var node = this._node;
|
||||
|
||||
var tex = node._batchNode ? node.textureAtlas.texture : node._texture;
|
||||
|
||||
@@ -125,7 +125,7 @@ var simpleQuadGenerator = {
|
||||
var atlasWidth = spriteFrame._texture.getPixelWidth();
|
||||
var atlasHeight = spriteFrame._texture.getPixelHeight();
|
||||
|
||||
var textureRect = cc.rectPointsToPixels(spriteFrame.getRect());
|
||||
var textureRect = spriteFrame.getRect();
|
||||
|
||||
//uv computation should take spritesheet into account.
|
||||
var u0, u3;
|
||||
@@ -255,7 +255,7 @@ var scale9QuadGenerator = {
|
||||
bottomHeight = insetBottom;
|
||||
centerHeight = rect.height - topHeight - bottomHeight;
|
||||
|
||||
var textureRect = cc.rectPointsToPixels(spriteFrame.getRect());
|
||||
var textureRect = spriteFrame.getRect();
|
||||
|
||||
//uv computation should take spritesheet into account.
|
||||
var u0, u1, u2, u3;
|
||||
@@ -346,7 +346,7 @@ var tiledQuadGenerator = {
|
||||
var atlasWidth = spriteFrame._texture.getPixelWidth();
|
||||
var atlasHeight = spriteFrame._texture.getPixelHeight();
|
||||
|
||||
var textureRect = cc.rectPointsToPixels(spriteFrame.getRect());
|
||||
var textureRect = spriteFrame.getRect();
|
||||
|
||||
//uv computation should take spritesheet into account.
|
||||
var u0, u3;
|
||||
@@ -494,7 +494,7 @@ var fillQuadGeneratorBar = {
|
||||
var atlasWidth = spriteFrame._texture.getPixelWidth();
|
||||
var atlasHeight = spriteFrame._texture.getPixelHeight();
|
||||
|
||||
var textureRect = cc.rectPointsToPixels(spriteFrame.getRect());
|
||||
var textureRect = spriteFrame.getRect();
|
||||
|
||||
//uv computation should take spritesheet into account.
|
||||
var u0, u3;
|
||||
@@ -843,7 +843,7 @@ var fillQuadGeneratorRadial = {
|
||||
var atlasWidth = spriteFrame._texture.getPixelWidth();
|
||||
var atlasHeight = spriteFrame._texture.getPixelHeight();
|
||||
|
||||
var textureRect = cc.rectPointsToPixels(spriteFrame.getRect());
|
||||
var textureRect = spriteFrame.getRect();
|
||||
|
||||
//uv computation should take spritesheet into account.
|
||||
var u0, u3;
|
||||
|
||||
@@ -90,15 +90,12 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
|
||||
// the location of the sprite on rendering texture
|
||||
this._rect = null;
|
||||
this._rectInPixels = null;
|
||||
|
||||
// for trimming
|
||||
this._offset = null;
|
||||
this._offsetInPixels = null;
|
||||
|
||||
// for trimming
|
||||
this._originalSize = null;
|
||||
this._originalSizeInPixels = null;
|
||||
|
||||
this._rotated = false;
|
||||
|
||||
@@ -170,34 +167,6 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
this.once("load", callback, target);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the rect of the frame in the texture.
|
||||
* @method getRectInPixels
|
||||
* @return {Rect}
|
||||
*/
|
||||
getRectInPixels: function () {
|
||||
return cc.rect(this._rectInPixels);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the rect of the frame in the texture.
|
||||
* @method setRectInPixels
|
||||
* @param {Rect} rectInPixels
|
||||
*/
|
||||
setRectInPixels: function (rectInPixels) {
|
||||
if (!this._rectInPixels) {
|
||||
this._rectInPixels = cc.rect(rectInPixels);
|
||||
} else {
|
||||
var rect = this._rectInPixels;
|
||||
rect.x = rectInPixels.x;
|
||||
rect.y = rectInPixels.y;
|
||||
rect.width = rectInPixels.width;
|
||||
rect.height = rectInPixels.height;
|
||||
}
|
||||
|
||||
this._rect = cc.rectPixelsToPoints(rectInPixels);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns whether the sprite frame is rotated in the texture.
|
||||
* @method isRotated
|
||||
@@ -231,66 +200,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
* @param {Rect} rect
|
||||
*/
|
||||
setRect: function (rect) {
|
||||
if (!this._rect) {
|
||||
this._rect = cc.rect(rect);
|
||||
} else {
|
||||
var locRect = this._rect;
|
||||
locRect.x = rect.x;
|
||||
locRect.y = rect.y;
|
||||
locRect.width = rect.width;
|
||||
locRect.height = rect.height;
|
||||
}
|
||||
this._rectInPixels = cc.rectPointsToPixels(rect);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the offset of the sprite frame in the texture in pixel.
|
||||
* @method getOffsetInPixels
|
||||
* @return {Vec2}
|
||||
*/
|
||||
getOffsetInPixels: function () {
|
||||
return cc.v2(this._offsetInPixels);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the offset of the sprite frame in the texture in pixel.
|
||||
* @method setOffsetInPixels
|
||||
* @param {Vec2} offsetInPixels
|
||||
*/
|
||||
setOffsetInPixels: function (offsetInPixels) {
|
||||
if (!this._offsetInPixels) {
|
||||
this._offsetInPixels = cc.v2(offsetInPixels);
|
||||
} else {
|
||||
this._offsetInPixels.x = offsetInPixels.x;
|
||||
this._offsetInPixels.y = offsetInPixels.y;
|
||||
}
|
||||
|
||||
this._offset = cc.pointPixelsToPoints(offsetInPixels);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the original size of the trimmed image.
|
||||
* @method getOriginalSizeInPixels
|
||||
* @return {Size}
|
||||
*/
|
||||
getOriginalSizeInPixels: function () {
|
||||
return cc.size(this._originalSizeInPixels);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the original size of the trimmed image.
|
||||
* @method setOriginalSizeInPixels
|
||||
* @param {Size} sizeInPixels
|
||||
*/
|
||||
setOriginalSizeInPixels: function (sizeInPixels) {
|
||||
if (!this._originalSizeInPixels) {
|
||||
this._originalSizeInPixels = cc.size(sizeInPixels);
|
||||
} else {
|
||||
this._originalSizeInPixels.width = sizeInPixels.width;
|
||||
this._originalSizeInPixels.height = sizeInPixels.height;
|
||||
}
|
||||
|
||||
this._originalSize = cc.sizePixelsToPoints(sizeInPixels);
|
||||
this._rect = rect;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -314,8 +224,6 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
this._originalSize.width = size.width;
|
||||
this._originalSize.height = size.height;
|
||||
}
|
||||
|
||||
this._originalSizeInPixels = cc.sizePointsToPixels(size);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -388,13 +296,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
* @param {Vec2} offsets
|
||||
*/
|
||||
setOffset: function (offsets) {
|
||||
if (!this._offset) {
|
||||
this._offset = cc.v2(offsets);
|
||||
} else {
|
||||
this._offset.x = offsets.x;
|
||||
this._offset.y = offsets.y;
|
||||
}
|
||||
this._offsetInPixels = cc.pointPointsToPixels(offsets);
|
||||
this._offset = cc.v2(offsets);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -403,7 +305,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
* @return {SpriteFrame}
|
||||
*/
|
||||
clone: function () {
|
||||
return new cc.SpriteFrame(this._textureFilename, this._rectInPixels, this._rotated, this._offsetInPixels, this._originalSizeInPixels);
|
||||
return new cc.SpriteFrame(this._textureFilename, this._rect, this._rotated, this._offset, this._originalSize);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -424,21 +326,21 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
setTexture: function (textureOrTextureFile, rect, rotated, offset, originalSize) {
|
||||
|
||||
if (rect) {
|
||||
this.setRectInPixels(rect);
|
||||
this.setRect(rect);
|
||||
} else {
|
||||
this._rect = this._rectInPixels = null;
|
||||
this._rect = null;
|
||||
}
|
||||
|
||||
if (offset) {
|
||||
this.setOffsetInPixels(offset);
|
||||
this.setOffset(offset);
|
||||
} else {
|
||||
this._offset = this._offsetInPixels = null;
|
||||
this._offset = null;
|
||||
}
|
||||
|
||||
if (originalSize) {
|
||||
this.setOriginalSizeInPixels(originalSize);
|
||||
this.setOriginalSize(originalSize);
|
||||
} else {
|
||||
this._originalSize = this._originalSizeInPixels = null;
|
||||
this._originalSize = null;
|
||||
}
|
||||
|
||||
this._rotated = rotated || false;
|
||||
@@ -463,7 +365,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
|
||||
},
|
||||
|
||||
_checkRect: function (texture) {
|
||||
var rect = this._rectInPixels;
|
||||
var rect = this._rect;
|
||||
var maxX = rect.x, maxY = rect.y;
|
||||
if (this._rotated) {
|
||||
maxX += rect.height;
|
||||
|
||||
@@ -185,7 +185,7 @@ cc.spriteFrameCache = /** @lends cc.spriteFrameCache# */{
|
||||
var locTexture = spriteFrame.getTexture();
|
||||
if (locTexture.isLoaded()) {
|
||||
var tempElement = spriteFrame.getTexture().getHtmlElementObj();
|
||||
tempElement = _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, spriteFrame.getRectInPixels());
|
||||
tempElement = _ccsg.Sprite.CanvasRenderCmd._cutRotateImageToCanvas(tempElement, spriteFrame.getRect());
|
||||
var tempTexture = new cc.Texture2D();
|
||||
tempTexture.initWithElement(tempElement);
|
||||
tempTexture.handleLoadedTexture();
|
||||
|
||||
@@ -194,15 +194,14 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{
|
||||
* @returns {Size}
|
||||
*/
|
||||
getContentSize: function () {
|
||||
var locScaleFactor = cc.contentScaleFactor();
|
||||
return cc.size(this._contentSize.width / locScaleFactor, this._contentSize.height / locScaleFactor);
|
||||
return cc.size(this._contentSize.width, this._contentSize.height);
|
||||
},
|
||||
|
||||
_getWidth: function () {
|
||||
return this._contentSize.width / cc.contentScaleFactor();
|
||||
return this._contentSize.width;
|
||||
},
|
||||
_getHeight: function () {
|
||||
return this._contentSize.height / cc.contentScaleFactor();
|
||||
return this._contentSize.height;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -124,9 +124,8 @@ cc.LabelAtlas = cc.AtlasNode.extend(/** @lends cc.LabelAtlas# */{
|
||||
}
|
||||
|
||||
textureFilename = cc.path.changeBasename(charMapFile, dict["textureFilename"]);
|
||||
var locScaleFactor = cc.contentScaleFactor();
|
||||
width = parseInt(dict["itemWidth"], 10) / locScaleFactor;
|
||||
height = parseInt(dict["itemHeight"], 10) / locScaleFactor;
|
||||
width = parseInt(dict["itemWidth"], 10);
|
||||
height = parseInt(dict["itemHeight"], 10);
|
||||
startChar = String.fromCharCode(parseInt(dict["firstChar"], 10));
|
||||
} else {
|
||||
textureFilename = charMapFile;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
var locString = node._string || "";
|
||||
var n = locString.length;
|
||||
var texture = this._textureToRender;
|
||||
var locItemWidth = node._itemWidth , locItemHeight = node._itemHeight; //needn't multiply cc.contentScaleFactor(), because sprite's draw will do this
|
||||
var locItemWidth = node._itemWidth , locItemHeight = node._itemHeight;
|
||||
|
||||
for (var i = 0, cr = -1; i < n; i++) {
|
||||
var a = locString.charCodeAt(i) - node._mapStartChar.charCodeAt(0);
|
||||
|
||||
@@ -62,12 +62,8 @@
|
||||
var texture = locTextureAtlas.texture;
|
||||
var textureWide = texture.getPixelWidth();
|
||||
var textureHigh = texture.getPixelHeight();
|
||||
var itemWidthInPixels = node._itemWidth;
|
||||
var itemHeightInPixels = node._itemHeight;
|
||||
if (!node._ignoreContentScaleFactor) {
|
||||
itemWidthInPixels = node._itemWidth * cc.contentScaleFactor();
|
||||
itemHeightInPixels = node._itemHeight * cc.contentScaleFactor();
|
||||
}
|
||||
var itemWidth = node._itemWidth;
|
||||
var itemHeight = node._itemHeight;
|
||||
if (n > locTextureAtlas.getCapacity())
|
||||
cc.log("cc.LabelAtlas._updateAtlasValues(): Invalid String length");
|
||||
var quads = locTextureAtlas.quads;
|
||||
@@ -88,15 +84,15 @@
|
||||
var left, right, top, bottom;
|
||||
if (cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL) {
|
||||
// Issue #938. Don't use texStepX & texStepY
|
||||
left = (2 * row * itemWidthInPixels + 1) / (2 * textureWide);
|
||||
right = left + (itemWidthInPixels * 2 - 2) / (2 * textureWide);
|
||||
top = (2 * col * itemHeightInPixels + 1) / (2 * textureHigh);
|
||||
bottom = top + (itemHeightInPixels * 2 - 2) / (2 * textureHigh);
|
||||
left = (2 * row * itemWidth + 1) / (2 * textureWide);
|
||||
right = left + (itemWidth * 2 - 2) / (2 * textureWide);
|
||||
top = (2 * col * itemHeight + 1) / (2 * textureHigh);
|
||||
bottom = top + (itemHeight * 2 - 2) / (2 * textureHigh);
|
||||
} else {
|
||||
left = row * itemWidthInPixels / textureWide;
|
||||
right = left + itemWidthInPixels / textureWide;
|
||||
top = col * itemHeightInPixels / textureHigh;
|
||||
bottom = top + itemHeightInPixels / textureHigh;
|
||||
left = row * itemWidth / textureWide;
|
||||
right = left + itemWidth / textureWide;
|
||||
top = col * itemHeight / textureHigh;
|
||||
bottom = top + itemHeight / textureHigh;
|
||||
}
|
||||
var quad = quads[i];
|
||||
var locQuadTL = quad.tl, locQuadTR = quad.tr, locQuadBL = quad.bl, locQuadBR = quad.br;
|
||||
|
||||
@@ -345,7 +345,6 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
|
||||
}
|
||||
|
||||
var rect = cc.rect(fontDef.rect.x, fontDef.rect.y, fontDef.rect.width, fontDef.rect.height);
|
||||
rect = cc.rectPixelsToPoints(rect);
|
||||
rect.x += self._imageOffset.x;
|
||||
rect.y += self._imageOffset.y;
|
||||
|
||||
@@ -366,8 +365,8 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
|
||||
|
||||
var yOffset = locCfg.commonHeight - fontDef.yOffset;
|
||||
var fontPos = cc.p(nextFontPositionX + fontDef.xOffset + fontDef.rect.width * 0.5 + kerningAmount,
|
||||
nextFontPositionY + yOffset - rect.height * 0.5 * cc.contentScaleFactor());
|
||||
fontChar.setPosition(cc.pointPixelsToPoints(fontPos));
|
||||
nextFontPositionY + yOffset - rect.height * 0.5);
|
||||
fontChar.setPosition(fontPos);
|
||||
|
||||
// update kerning
|
||||
nextFontPositionX += fontDef.xAdvance + kerningAmount;
|
||||
@@ -384,7 +383,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
|
||||
else
|
||||
tmpSize.width = longestLine;
|
||||
tmpSize.height = totalHeight;
|
||||
self.setContentSize(cc.sizePixelsToPoints(tmpSize));
|
||||
self.setContentSize(tmpSize);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -1953,7 +1953,7 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
|
||||
if (!spriteFrame)
|
||||
return;
|
||||
|
||||
var locOffset = spriteFrame.getOffsetInPixels();
|
||||
var locOffset = spriteFrame.getOffset();
|
||||
if (locOffset.x !== 0 || locOffset.y !== 0)
|
||||
cc.log("_ccsg.ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets");
|
||||
|
||||
|
||||
@@ -209,13 +209,6 @@
|
||||
proto.initTexCoordsWithRect = function(pointRect){
|
||||
var node = this._node;
|
||||
var texture = node.texture;
|
||||
var scaleFactor = cc.contentScaleFactor();
|
||||
// convert to pixels coords
|
||||
var rect = cc.rect(
|
||||
pointRect.x * scaleFactor,
|
||||
pointRect.y * scaleFactor,
|
||||
pointRect.width * scaleFactor,
|
||||
pointRect.height * scaleFactor);
|
||||
|
||||
var wide = pointRect.width;
|
||||
var high = pointRect.height;
|
||||
@@ -227,15 +220,15 @@
|
||||
|
||||
var left, bottom, right, top;
|
||||
if (cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL) {
|
||||
left = (rect.x * 2 + 1) / (wide * 2);
|
||||
bottom = (rect.y * 2 + 1) / (high * 2);
|
||||
right = left + (rect.width * 2 - 2) / (wide * 2);
|
||||
top = bottom + (rect.height * 2 - 2) / (high * 2);
|
||||
left = (pointRect.x * 2 + 1) / (wide * 2);
|
||||
bottom = (pointRect.y * 2 + 1) / (high * 2);
|
||||
right = left + (pointRect.width * 2 - 2) / (wide * 2);
|
||||
top = bottom + (pointRect.height * 2 - 2) / (high * 2);
|
||||
} else {
|
||||
left = rect.x / wide;
|
||||
bottom = rect.y / high;
|
||||
right = left + rect.width / wide;
|
||||
top = bottom + rect.height / high;
|
||||
left = pointRect.x / wide;
|
||||
bottom = pointRect.y / high;
|
||||
right = left + pointRect.width / wide;
|
||||
top = bottom + pointRect.height / high;
|
||||
}
|
||||
|
||||
// Important. Texture in cocos2d are inverted, so the Y component should be inverted
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
|
||||
proto.initWithWidthAndHeight = function(width, height, format, depthStencilFormat){
|
||||
var node = this._node;
|
||||
var locCacheCanvas = this._cacheCanvas, locScaleFactor = cc.contentScaleFactor();
|
||||
locCacheCanvas.width = 0 | (width * locScaleFactor);
|
||||
locCacheCanvas.height = 0 | (height * locScaleFactor);
|
||||
var locCacheCanvas = this._cacheCanvas;
|
||||
locCacheCanvas.width = 0 | width;
|
||||
locCacheCanvas.height = 0 | height;
|
||||
|
||||
var texture = new cc.Texture2D();
|
||||
texture.initWithElement(locCacheCanvas);
|
||||
@@ -86,8 +86,7 @@
|
||||
proto.end = function(){
|
||||
var node = this._node;
|
||||
|
||||
var scale = cc.contentScaleFactor();
|
||||
cc.renderer._renderingToCacheCanvas(this._cacheContext, node.__instanceId, scale, scale);
|
||||
cc.renderer._renderingToCacheCanvas(this._cacheContext, node.__instanceId);
|
||||
};
|
||||
|
||||
proto.clearRect = function(x, y, width, height){
|
||||
|
||||
@@ -133,12 +133,12 @@
|
||||
if(format === cc.Texture2D.PIXEL_FORMAT_A8)
|
||||
cc.log( "cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");
|
||||
|
||||
var gl = cc._renderContext, locScaleFactor = cc.contentScaleFactor();
|
||||
var gl = cc._renderContext;
|
||||
this._fullRect = new cc.Rect(0,0, width, height);
|
||||
this._fullViewport = new cc.Rect(0,0, width, height);
|
||||
|
||||
width = 0 | (width * locScaleFactor);
|
||||
height = 0 | (height * locScaleFactor);
|
||||
width = 0 | width;
|
||||
height = 0 | height;
|
||||
|
||||
this._oldFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
|
||||
|
||||
@@ -329,11 +329,11 @@
|
||||
/* var size = director.getWinSizeInPixels();
|
||||
|
||||
// restore viewport
|
||||
gl.viewport(0, 0, size.width * cc.contentScaleFactor(), size.height * cc.contentScaleFactor());
|
||||
gl.viewport(0, 0, size.width, size.height);
|
||||
|
||||
// special viewport for 3d projection + retina display
|
||||
if (director.getProjection() == cc.Director.PROJECTION_3D && cc.contentScaleFactor() != 1) {
|
||||
gl.viewport((-size.width / 2), (-size.height / 2), (size.width * cc.contentScaleFactor()), (size.height * cc.contentScaleFactor()));
|
||||
if (director.getProjection() == cc.Director.PROJECTION_3D) {
|
||||
gl.viewport((-size.width / 2), (-size.height / 2), size.width, size.height));
|
||||
}
|
||||
|
||||
director.setProjection(director.getProjection());*/
|
||||
|
||||
@@ -285,11 +285,11 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
|
||||
// offset (after layer orientation is set);
|
||||
var offset = this._calculateLayerOffset(layerInfo.offset);
|
||||
this.setPosition(cc.pointPixelsToPoints(offset));
|
||||
this.setPosition(offset);
|
||||
|
||||
this._atlasIndexArray = [];
|
||||
this.setContentSize(cc.sizePixelsToPoints(cc.size(this._layerSize.width * this._mapTileSize.width,
|
||||
this._layerSize.height * this._mapTileSize.height)));
|
||||
this.setContentSize(cc.size(this._layerSize.width * this._mapTileSize.width,
|
||||
this._layerSize.height * this._mapTileSize.height));
|
||||
this._useAutomaticVertexZ = false;
|
||||
this._vertexZvalue = 0;
|
||||
return true;
|
||||
@@ -344,7 +344,6 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
// tile not created yet. create it
|
||||
if (!tile) {
|
||||
var rect = this.tileset.rectForGID(gid);
|
||||
rect = cc.rectPixelsToPoints(rect);
|
||||
|
||||
tile = new _ccsg.Sprite();
|
||||
tile.initWithTexture(this.texture, rect);
|
||||
@@ -464,7 +463,6 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
var sprite = this.getChildByTag(z);
|
||||
if (sprite) {
|
||||
var rect = this.tileset.rectForGID(gid);
|
||||
rect = cc.rectPixelsToPoints(rect);
|
||||
|
||||
sprite.setTextureRect(rect, false);
|
||||
if (flags != null)
|
||||
@@ -552,7 +550,7 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
ret = this._positionForHexAt(pos);
|
||||
break;
|
||||
}
|
||||
return cc.pointPixelsToPoints(ret);
|
||||
return ret;
|
||||
},
|
||||
// XXX: Deprecated. For backward compatibility only
|
||||
// positionAt:getPositionAt,
|
||||
@@ -687,7 +685,6 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
|
||||
_appendTileForGID:function (gid, pos) {
|
||||
var rect = this.tileset.rectForGID(gid);
|
||||
rect = cc.rectPixelsToPoints(rect);
|
||||
|
||||
var z = 0 | (pos.x + pos.y * this._layerSize.width);
|
||||
var tile = this._renderCmd._reusedTileWithRect(rect);
|
||||
@@ -708,7 +705,6 @@ _ccsg.TMXLayer = cc.SpriteBatchNode.extend(/** @lends _ccsg.TMXLayer# */{
|
||||
|
||||
_insertTileForGID:function (gid, pos) {
|
||||
var rect = this.tileset.rectForGID(gid);
|
||||
rect = cc.rectPixelsToPoints(rect);
|
||||
|
||||
var z = 0 | (pos.x + pos.y * this._layerSize.width);
|
||||
var tile = this._renderCmd._reusedTileWithRect(rect);
|
||||
|
||||
@@ -106,14 +106,13 @@
|
||||
proto._updateCacheContext = function(size, height){
|
||||
var node = this._node,
|
||||
locContentSize = node._contentSize,
|
||||
locCanvas = this._cacheCanvas,
|
||||
scaleFactor = cc.contentScaleFactor();
|
||||
locCanvas.width = 0 | (locContentSize.width * 1.5 * scaleFactor);
|
||||
locCanvas.height = 0 | (locContentSize.height * 1.5 * scaleFactor);
|
||||
locCanvas = this._cacheCanvas;
|
||||
locCanvas.width = 0 | (locContentSize.width * 1.5);
|
||||
locCanvas.height = 0 | (locContentSize.height * 1.5);
|
||||
|
||||
//todo: need change the wrapper's height
|
||||
if(node.layerOrientation === cc.TMX_ORIENTATION_HEX)
|
||||
this._cacheContext.setOffset(0, -node._mapTileSize.height * 0.5); //translate for hexagonal
|
||||
this._cacheContext.setOffset(0, -node._mapTileSize.height * 0.5); //translate for hexagonal
|
||||
else
|
||||
this._cacheContext.setOffset(0, 0);
|
||||
var locTexContentSize = this._cacheTexture._contentSize;
|
||||
|
||||
@@ -76,9 +76,6 @@ cc.SpriteFrame.prototype.initWithTexture = function (texture, rect, rotated, off
|
||||
}
|
||||
}
|
||||
|
||||
if(arguments.length === 2)
|
||||
rect = cc.rectPointsToPixels(rect);
|
||||
|
||||
offset = offset || cc.p(0, 0);
|
||||
originalSize = originalSize || rect;
|
||||
rotated = rotated || false;
|
||||
@@ -142,7 +139,7 @@ cc.SpriteFrame.prototype._deserialize = function (data, handle) {
|
||||
this.initWithTexture(null, rect, rotated, offset, size, textureUuid);
|
||||
};
|
||||
cc.SpriteFrame.prototype._checkRect = function (texture) {
|
||||
var rect = this.getRectInPixels();
|
||||
var rect = this.getRect();
|
||||
var maxX = rect.x, maxY = rect.y;
|
||||
if (this._rotated) {
|
||||
maxX += rect.height;
|
||||
|
||||
@@ -55,9 +55,6 @@ cc.SpriteFrame.prototype.initWithTexture = function (texture, rect, rotated, off
|
||||
}
|
||||
}
|
||||
|
||||
if(arguments.length === 2)
|
||||
rect = cc.rectPointsToPixels(rect);
|
||||
|
||||
offset = cc.p(0, 0);
|
||||
originalSize = originalSize || rect;
|
||||
rotated = rotated || false;
|
||||
|
||||
@@ -4914,113 +4914,6 @@ var SpriteSkewNegativeScaleChildren = SpriteTestDemo.extend({
|
||||
}
|
||||
});
|
||||
|
||||
var DoubleSprite = _ccsg.Sprite.extend({
|
||||
HD:false,
|
||||
|
||||
ctor:function (fileName) {
|
||||
this._super(fileName);
|
||||
//var resolutionType = texture.getResolutionType();
|
||||
//this.HD = ( resolutionType == cc.kCCResolutioniPhoneRetinaDisplay || resolutionType == kCCResolutioniPadRetinaDisplay );
|
||||
},
|
||||
|
||||
setContentSize:function (size) {
|
||||
var newSize = cc.size(size.width, size.height);
|
||||
// If Retina Display and Texture is in HD then scale the vertex rect
|
||||
if (cc.contentScaleFactor() == 2 && !this.HD) {
|
||||
newSize.width *= 2;
|
||||
newSize.height *= 2;
|
||||
}
|
||||
this._super(newSize);
|
||||
},
|
||||
_setWidth:function (value) {
|
||||
// If Retina Display and Texture is in HD then scale the vertex rect
|
||||
if (cc.contentScaleFactor() == 2 && !this.HD) {
|
||||
value *= 2;
|
||||
}
|
||||
this._super(value);
|
||||
},
|
||||
_setHeight:function (value) {
|
||||
// If Retina Display and Texture is in HD then scale the vertex rect
|
||||
if (cc.contentScaleFactor() == 2 && !this.HD) {
|
||||
value *= 2;
|
||||
}
|
||||
this._super(value);
|
||||
},
|
||||
|
||||
setVertexRect:function (rect) {
|
||||
// If Retina Display and Texture is in HD then scale the vertex rect
|
||||
if (cc.contentScaleFactor() == 2 && !this.HD) {
|
||||
rect.width *= 2;
|
||||
rect.height *= 2;
|
||||
}
|
||||
this._super(rect);
|
||||
}
|
||||
});
|
||||
|
||||
cc.defineGetterSetter(DoubleSprite.prototype, "width", DoubleSprite.prototype._getWidth, DoubleSprite.prototype._setWidth);
|
||||
cc.defineGetterSetter(DoubleSprite.prototype, "height", DoubleSprite.prototype._getHeight, DoubleSprite.prototype._setHeight);
|
||||
|
||||
var SpriteDoubleResolution = SpriteTestDemo.extend({
|
||||
|
||||
_title:"Sprite Double resolution",
|
||||
_subtitle:"Retina Display. SD (left) should be equal to HD (right)",
|
||||
|
||||
ctor:function () {
|
||||
//----start52----ctor
|
||||
this._super();
|
||||
|
||||
//
|
||||
// LEFT: SD sprite
|
||||
//
|
||||
// there is no HD resolution file of grossini_dance_08.
|
||||
var spriteSD = new DoubleSprite(s_grossiniDance08);
|
||||
this.addChild(spriteSD);
|
||||
spriteSD.x = winSize.width / 4;
|
||||
spriteSD.y = winSize.height / 2;
|
||||
|
||||
var child1_left = new DoubleSprite(s_grossiniDance08);
|
||||
spriteSD.addChild(child1_left);
|
||||
child1_left.x = -30;
|
||||
child1_left.y = 0;
|
||||
|
||||
var child1_right = new _ccsg.Sprite(s_pathGrossini);
|
||||
spriteSD.addChild(child1_right);
|
||||
child1_left.x = spriteSD.height;
|
||||
child1_left.y = 0;
|
||||
|
||||
//
|
||||
// RIGHT: HD sprite
|
||||
//
|
||||
// there is an HD version of grossini.png
|
||||
var spriteHD = new _ccsg.Sprite(s_pathGrossini);
|
||||
this.addChild(spriteHD);
|
||||
spriteHD.x = winSize.width / 4 * 3;
|
||||
spriteHD.y = winSize.height / 2;
|
||||
|
||||
var child2_left = new DoubleSprite(s_grossiniDance08);
|
||||
spriteHD.addChild(child2_left);
|
||||
child2_left.x = -30;
|
||||
child2_left.y = 0;
|
||||
|
||||
var child2_right = new _ccsg.Sprite(s_pathGrossini);
|
||||
spriteHD.addChild(child2_right);
|
||||
child2_left.x = spriteHD.height;
|
||||
child2_left.y = 0;
|
||||
|
||||
|
||||
// Actions
|
||||
var scale = cc.scaleBy(2, 0.5);
|
||||
var scale_back = scale.reverse();
|
||||
var seq = cc.sequence(scale, scale_back);
|
||||
|
||||
var seq_copy = seq.clone();
|
||||
|
||||
spriteSD.runAction(seq);
|
||||
spriteHD.runAction(seq_copy);
|
||||
//----end52----
|
||||
}
|
||||
});
|
||||
|
||||
var SpriteFrameAnimationCacheFile = SpriteTestDemo.extend({
|
||||
|
||||
_title:"SpriteFrameAnimationCache - Load file",
|
||||
|
||||
Reference in New Issue
Block a user