mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #501 from pandamicro/v1.0
Fix sprite frame can't be inited with a single texture in JSB
This commit is contained in:
@@ -120,6 +120,28 @@ cc.TextureCache.prototype.addImage = function(url, cb, target) {
|
||||
}
|
||||
};
|
||||
|
||||
// cc.SpriteFrame
|
||||
cc.SpriteFrame.prototype._ctor = function (filename, rect, rotated, offset, originalSize) {
|
||||
if (originalSize !== undefined) {
|
||||
if(filename instanceof cc.Texture2D) {
|
||||
this.initWithTexture(filename, rect, rotated, offset, originalSize);
|
||||
}
|
||||
else {
|
||||
this.initWithTexture(filename, rect, rotated, offset, originalSize);
|
||||
}
|
||||
} else if (rect !== undefined) {
|
||||
if(filename instanceof cc.Texture2D) {
|
||||
this.initWithTexture(filename, rect);
|
||||
}
|
||||
else {
|
||||
this.initWithTextureFilename(filename, rect);
|
||||
}
|
||||
} else if (filename instanceof cc.Texture2D) {
|
||||
rect = cc.rect(0, 0, filename.getPixelWidth(), filename.getPixelHeight());
|
||||
this.initWithTexture(filename, rect);
|
||||
}
|
||||
};
|
||||
|
||||
// ccsg
|
||||
window._ccsg = {
|
||||
Node: cc.Node,
|
||||
|
||||
Reference in New Issue
Block a user