Btw.: if your png file has the same name as your atlas config file, you don’t need to pass it as param:
cc.SpriteFrameCache:getInstance():addSpriteFrames("assets.plist", "assets.png")
It’s enough to just call:
cc.SpriteFrameCache:getInstance():addSpriteFrames("assets.plist")
Do you get an error message about not finding the sprite from CSLoader? If so, which is it?
Is the cache filled with the atlas asset key “assets/background/background.png”?
This method is not called for loading a node.
You have to set a breakpoint in Node* CSLoader::nodeWithFlatBuffersFile(const std::string &fileName)
where it’s adding the textures into the cache:
for (int i = 0; i < textureSize; ++i)
{
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(textures->Get(i)->c_str());
}
Check which texture keys were added by the atlas loader and compare them to the keys in the code above.
After digging through some source code:
First, this will work work CS 1.x out of the box.
As you are working with CS 2.x:
The file format supports textures, which are loaded into the cache. This is the atlas feature of 2.x.
What you have to do in 2.x, is to create/import your atlas and use those references in the editor.
The editor will only generate a file with atlas support, if you defined one in the editor. Unfortunately you can only import non-encrypted, non-compressed atlas files. But that does not matter, as you are pre-loading the real atlas files in the engine anyway.
Sorry for that bogus I just use CS 1.x more than CS 2.x.
I think, that this is some big missing feature.