issue #2397: sharedSpriteFrameCache --> getInstance, purgeSharedSpriteFrameCache --> destroyInstance.

This commit is contained in:
James Chen 2013-07-12 14:12:58 +08:00
parent f30ae2ef31
commit 6038d69183
8 changed files with 49 additions and 44 deletions

View File

@ -581,7 +581,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame)
bool Scale9Sprite::initWithSpriteFrameName(const char* spriteFrameName, Rect capInsets) bool Scale9Sprite::initWithSpriteFrameName(const char* spriteFrameName, Rect capInsets)
{ {
CCAssert((SpriteFrameCache::getInstance()) != NULL, "sharedSpriteFrameCache must be non-NULL"); CCAssert((SpriteFrameCache::getInstance()) != NULL, "SpriteFrameCache::getInstance() must be non-NULL");
SpriteFrame *frame = SpriteFrameCache::getInstance()->spriteFrameByName(spriteFrameName); SpriteFrame *frame = SpriteFrameCache::getInstance()->spriteFrameByName(spriteFrameName);
CCAssert(frame != NULL, "CCSpriteFrame must be non-NULL"); CCAssert(frame != NULL, "CCSpriteFrame must be non-NULL");

View File

@ -1 +1 @@
9aaefef976e0db10d9c5b473fed588a0f1f9feb2 6ece549f30445e73362dd4a81e44557bb087a528

View File

@ -253,7 +253,7 @@ local function SpriteProgressWithSpriteFrame()
local to = CCProgressTo:create(6, 100) local to = CCProgressTo:create(6, 100)
CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("zwoptex/grossini.plist") CCSpriteFrameCache:getInstance():addSpriteFramesWithFile("zwoptex/grossini.plist")
local left = CCProgressTimer:create(CCSprite:createWithSpriteFrameName("grossini_dance_01.png")) local left = CCProgressTimer:create(CCSprite:createWithSpriteFrameName("grossini_dance_01.png"))
left:setType(kCCProgressTimerTypeBar) left:setType(kCCProgressTimerTypeBar)

View File

@ -234,7 +234,7 @@ end
-- label2:setVertexZ(0) -- label2:setVertexZ(0)
-- label3:setVertexZ(-50) -- label3:setVertexZ(-50)
-- CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("Images/bugs/circle.plist") -- CCSpriteFrameCache:getInstance():addSpriteFramesWithFile("Images/bugs/circle.plist")
-- mgr = CCSpriteBatchNode:create("Images/bugs/circle.png", 9) -- mgr = CCSpriteBatchNode:create("Images/bugs/circle.png", 9)
-- this:addChild(mgr) -- this:addChild(mgr)
-- sp1 = CCSprite:createWithSpriteFrameName("circle.png") -- sp1 = CCSprite:createWithSpriteFrameName("circle.png")

View File

@ -241,7 +241,7 @@ SpriteFrameTest.m_nCounter = 0
function SpriteFrameTest.onEnter() function SpriteFrameTest.onEnter()
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -295,7 +295,7 @@ function SpriteFrameTest.onEnter()
end end
function SpriteFrameTest.onExit() function SpriteFrameTest.onExit()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
cache:removeSpriteFramesFromFile("animations/grossini_blue.plist") cache:removeSpriteFramesFromFile("animations/grossini_blue.plist")
@ -362,7 +362,7 @@ SpriteFrameAliasNameTest.__index = SpriteFrameAliasNameTest
function SpriteFrameAliasNameTest.onEnter() function SpriteFrameAliasNameTest.onEnter()
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini-aliases.plist", "animations/grossini-aliases.png") cache:addSpriteFramesWithFile("animations/grossini-aliases.plist", "animations/grossini-aliases.png")
local sprite = CCSprite:createWithSpriteFrameName("grossini_dance_01.png") local sprite = CCSprite:createWithSpriteFrameName("grossini_dance_01.png")
@ -386,7 +386,7 @@ function SpriteFrameAliasNameTest.onEnter()
end end
function SpriteFrameAliasNameTest.onExit() function SpriteFrameAliasNameTest.onExit()
CCSpriteFrameCache:sharedSpriteFrameCache():removeSpriteFramesFromFile("animations/grossini-aliases.plist") CCSpriteFrameCache:getInstance():removeSpriteFramesFromFile("animations/grossini-aliases.plist")
end end
function SpriteFrameAliasNameTest.onEnterOrExit(tag) function SpriteFrameAliasNameTest.onEnterOrExit(tag)
@ -522,7 +522,7 @@ SpriteOffsetAnchorRotation.__index = SpriteOffsetAnchorRotation
function SpriteOffsetAnchorRotation.initLayer(layer) function SpriteOffsetAnchorRotation.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -567,7 +567,7 @@ end
function SpriteOffsetAnchorRotation.eventHandler(tag) function SpriteOffsetAnchorRotation.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -597,7 +597,7 @@ function SpriteBatchNodeOffsetAnchorRotation.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -645,7 +645,7 @@ end
function SpriteBatchNodeOffsetAnchorRotation.eventHandler(tag) function SpriteBatchNodeOffsetAnchorRotation.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -674,7 +674,7 @@ SpriteOffsetAnchorScale.__index = SpriteOffsetAnchorScale
function SpriteOffsetAnchorScale.initLayer(layer) function SpriteOffsetAnchorScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -723,7 +723,7 @@ end
function SpriteOffsetAnchorScale.eventHandler(tag) function SpriteOffsetAnchorScale.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -751,7 +751,7 @@ local SpriteBatchNodeOffsetAnchorScale = {}
function SpriteBatchNodeOffsetAnchorScale.initLayer(layer) function SpriteBatchNodeOffsetAnchorScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -801,7 +801,7 @@ function SpriteBatchNodeOffsetAnchorScale.initLayer(layer)
end end
function SpriteBatchNodeOffsetAnchorScale.onExit() function SpriteBatchNodeOffsetAnchorScale.onExit()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -836,7 +836,7 @@ function SpriteOffsetAnchorSkew.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -892,7 +892,7 @@ end
function SpriteOffsetAnchorSkew.eventHandler(tag) function SpriteOffsetAnchorSkew.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -919,7 +919,7 @@ function SpriteOffsetAnchorRotationalSkew.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -974,7 +974,7 @@ end
function SpriteOffsetAnchorRotationalSkew.eventHandler(tag) function SpriteOffsetAnchorRotationalSkew.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1003,7 +1003,7 @@ function SpriteBatchNodeOffsetAnchorSkew.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1062,7 +1062,7 @@ end
function SpriteBatchNodeOffsetAnchorSkew.eventHandler(tag) function SpriteBatchNodeOffsetAnchorSkew.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1090,7 +1090,7 @@ function SpriteBatchNodeOffsetAnchorRotationalSkew.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1151,7 +1151,7 @@ end
-- remove resources -- remove resources
function SpriteBatchNodeOffsetAnchorRotationalSkew.eventHandler(tag) function SpriteBatchNodeOffsetAnchorRotationalSkew.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1177,7 +1177,7 @@ local SpriteOffsetAnchorSkewScale = {}
function SpriteOffsetAnchorSkewScale.initLayer(layer) function SpriteOffsetAnchorSkewScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1238,7 +1238,7 @@ end
function SpriteOffsetAnchorSkewScale.eventHandler(tag) function SpriteOffsetAnchorSkewScale.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1263,7 +1263,7 @@ local SpriteOffsetAnchorRotationalSkewScale = {}
function SpriteOffsetAnchorRotationalSkewScale.initLayer(layer) function SpriteOffsetAnchorRotationalSkewScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1324,7 +1324,7 @@ end
function SpriteOffsetAnchorRotationalSkewScale.eventHandler(tag) function SpriteOffsetAnchorRotationalSkewScale.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1349,7 +1349,7 @@ local SpriteBatchNodeOffsetAnchorSkewScale = {}
function SpriteBatchNodeOffsetAnchorSkewScale.initLayer(layer) function SpriteBatchNodeOffsetAnchorSkewScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1413,7 +1413,7 @@ end
function SpriteBatchNodeOffsetAnchorSkewScale.eventHandler(tag) function SpriteBatchNodeOffsetAnchorSkewScale.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1437,7 +1437,7 @@ local SpriteBatchNodeOffsetAnchorRotationalSkewScale = {}
function SpriteBatchNodeOffsetAnchorRotationalSkewScale.initLayer(layer) function SpriteBatchNodeOffsetAnchorRotationalSkewScale.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1500,7 +1500,7 @@ end
function SpriteBatchNodeOffsetAnchorRotationalSkewScale.eventHandler(tag) function SpriteBatchNodeOffsetAnchorRotationalSkewScale.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end
@ -1524,7 +1524,7 @@ local SpriteOffsetAnchorFlip = {}
function SpriteOffsetAnchorFlip.initLayer(layer) function SpriteOffsetAnchorFlip.initLayer(layer)
local s = CCDirector:getInstance():getWinSize() local s = CCDirector:getInstance():getWinSize()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:addSpriteFramesWithFile("animations/grossini.plist") cache:addSpriteFramesWithFile("animations/grossini.plist")
cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png") cache:addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png")
@ -1576,7 +1576,7 @@ end
function SpriteOffsetAnchorFlip.eventHandler(tag) function SpriteOffsetAnchorFlip.eventHandler(tag)
if tag == "exit" then if tag == "exit" then
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("animations/grossini.plist") cache:removeSpriteFramesFromFile("animations/grossini.plist")
cache:removeSpriteFramesFromFile("animations/grossini_gray.plist") cache:removeSpriteFramesFromFile("animations/grossini_gray.plist")
end end

View File

@ -16,14 +16,14 @@ local function ZwoptexGenericTest()
local sprite2 = nil local sprite2 = nil
local function onEnter() local function onEnter()
CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("zwoptex/grossini.plist") CCSpriteFrameCache:getInstance():addSpriteFramesWithFile("zwoptex/grossini.plist")
CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("zwoptex/grossini-generic.plist") CCSpriteFrameCache:getInstance():addSpriteFramesWithFile("zwoptex/grossini-generic.plist")
local layer1 = CCLayerColor:create(Color4B(255, 0, 0, 255), 85, 121) local layer1 = CCLayerColor:create(Color4B(255, 0, 0, 255), 85, 121)
layer1:setPosition(ccp(s.width/2-80 - (85.0 * 0.5), s.height/2 - (121.0 * 0.5))) layer1:setPosition(ccp(s.width/2-80 - (85.0 * 0.5), s.height/2 - (121.0 * 0.5)))
ret:addChild(layer1) ret:addChild(layer1)
sprite1 = CCSprite:createWithSpriteFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName("grossini_dance_01.png")) sprite1 = CCSprite:createWithSpriteFrame(CCSpriteFrameCache:getInstance():spriteFrameByName("grossini_dance_01.png"))
sprite1:setPosition(ccp( s.width/2-80, s.height/2)) sprite1:setPosition(ccp( s.width/2-80, s.height/2))
ret:addChild(sprite1) ret:addChild(sprite1)
@ -34,7 +34,7 @@ local function ZwoptexGenericTest()
layer2:setPosition(ccp(s.width/2+80 - (85.0 * 0.5), s.height/2 - (121.0 * 0.5))) layer2:setPosition(ccp(s.width/2+80 - (85.0 * 0.5), s.height/2 - (121.0 * 0.5)))
ret:addChild(layer2) ret:addChild(layer2)
sprite2 = CCSprite:createWithSpriteFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName("grossini_dance_generic_01.png")) sprite2 = CCSprite:createWithSpriteFrame(CCSpriteFrameCache:getInstance():spriteFrameByName("grossini_dance_generic_01.png"))
sprite2:setPosition(ccp( s.width/2 + 80, s.height/2)) sprite2:setPosition(ccp( s.width/2 + 80, s.height/2))
ret:addChild(sprite2) ret:addChild(sprite2)
@ -74,8 +74,8 @@ local function ZwoptexGenericTest()
local str1 = string.format("grossini_dance_%02d.png", spriteFrameIndex) local str1 = string.format("grossini_dance_%02d.png", spriteFrameIndex)
local str2 = string.format("grossini_dance_generic_%02d.png", spriteFrameIndex) local str2 = string.format("grossini_dance_generic_%02d.png", spriteFrameIndex)
sprite1:setDisplayFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName(str1)) sprite1:setDisplayFrame(CCSpriteFrameCache:getInstance():spriteFrameByName(str1))
sprite2:setDisplayFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName(str2)) sprite2:setDisplayFrame(CCSpriteFrameCache:getInstance():spriteFrameByName(str2))
end end
sprite1:retain() sprite1:retain()
@ -97,7 +97,7 @@ local function ZwoptexGenericTest()
end end
sprite1:release() sprite1:release()
sprite2:release() sprite2:release()
local cache = CCSpriteFrameCache:sharedSpriteFrameCache() local cache = CCSpriteFrameCache:getInstance()
cache:removeSpriteFramesFromFile("zwoptex/grossini.plist") cache:removeSpriteFramesFromFile("zwoptex/grossini.plist")
cache:removeSpriteFramesFromFile("zwoptex/grossini-generic.plist") cache:removeSpriteFramesFromFile("zwoptex/grossini-generic.plist")
end end

View File

@ -105,9 +105,10 @@ skip = Node::[^setPosition$ getGrid setGLServerState description getUserObject .
Camera::[getEyeXYZ getCenterXYZ getUpXYZ], Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
ShaderCache::[sharedShaderCache purgeSharedShaderCache], ShaderCache::[sharedShaderCache purgeSharedShaderCache],
AnimationCache::[sharedAnimationCache purgeSharedAnimationCache], AnimationCache::[sharedAnimationCache purgeSharedAnimationCache],
SpriteFrameCache::[sharedSpriteFrameCache purgeSharedSpriteFrameCache],
ccFontDefinition::[*] ccFontDefinition::[*]
rename_functions = SpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY], rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize fontSizeObj=fontSize fontNameObj=fontName], MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize fontSizeObj=fontSize fontNameObj=fontName],
ProgressTimer::[setReverseProgress=setReverseDirection], ProgressTimer::[setReverseProgress=setReverseDirection],
TextureCache::[sharedTextureCache=getInstance], TextureCache::[sharedTextureCache=getInstance],

View File

@ -16,6 +16,10 @@ class CCSpriteFrameCache : public CCObject
CCSpriteFrame* spriteFrameByName(const char *pszName); CCSpriteFrame* spriteFrameByName(const char *pszName);
static CCSpriteFrameCache* sharedSpriteFrameCache(void); // XXX deprecated
static void purgeSharedSpriteFrameCache(void); static CCSpriteFrameCache* sharedSpriteFrameCache();
static void purgeSharedSpriteFrameCache();
static CCSpriteFrameCache* getInstance();
static void destroyInstance();
}; };