mirror of https://github.com/axmolengine/axmol.git
fix coding style
This commit is contained in:
parent
402dc9f9ce
commit
e76feceada
|
@ -65,7 +65,7 @@ void SpriteFrameCache::destroyInstance()
|
||||||
CC_SAFE_RELEASE_NULL(_sharedSpriteFrameCache);
|
CC_SAFE_RELEASE_NULL(_sharedSpriteFrameCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpriteFrameCache::init(void)
|
bool SpriteFrameCache::init()
|
||||||
{
|
{
|
||||||
_spriteFrames.reserve(20);
|
_spriteFrames.reserve(20);
|
||||||
_spriteFramesAliases.reserve(20);
|
_spriteFramesAliases.reserve(20);
|
||||||
|
@ -73,7 +73,7 @@ bool SpriteFrameCache::init(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteFrameCache::~SpriteFrameCache(void)
|
SpriteFrameCache::~SpriteFrameCache()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(_loadedFileNames);
|
CC_SAFE_DELETE(_loadedFileNames);
|
||||||
}
|
}
|
||||||
|
@ -200,18 +200,18 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist, Texture2D *pobTexture)
|
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, Texture2D *texture)
|
||||||
{
|
{
|
||||||
if (_loadedFileNames->find(pszPlist) != _loadedFileNames->end())
|
if (_loadedFileNames->find(plist) != _loadedFileNames->end())
|
||||||
{
|
{
|
||||||
return; // We already added it
|
return; // We already added it
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(pszPlist);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist);
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
||||||
|
|
||||||
addSpriteFramesWithDictionary(dict, pobTexture);
|
addSpriteFramesWithDictionary(dict, texture);
|
||||||
_loadedFileNames->insert(pszPlist);
|
_loadedFileNames->insert(plist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const std::string& textureFileName)
|
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const std::string& textureFileName)
|
||||||
|
@ -229,13 +229,13 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist)
|
void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist)
|
||||||
{
|
{
|
||||||
CCASSERT(pszPlist.size()>0, "plist filename should not be nullptr");
|
CCASSERT(plist.size()>0, "plist filename should not be nullptr");
|
||||||
|
|
||||||
if (_loadedFileNames->find(pszPlist) == _loadedFileNames->end())
|
if (_loadedFileNames->find(plist) == _loadedFileNames->end())
|
||||||
{
|
{
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(pszPlist);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist);
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
||||||
|
|
||||||
string texturePath("");
|
string texturePath("");
|
||||||
|
@ -250,12 +250,12 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist)
|
||||||
if (!texturePath.empty())
|
if (!texturePath.empty())
|
||||||
{
|
{
|
||||||
// build texture path relative to plist file
|
// build texture path relative to plist file
|
||||||
texturePath = FileUtils::getInstance()->fullPathFromRelativeFile(texturePath.c_str(), pszPlist);
|
texturePath = FileUtils::getInstance()->fullPathFromRelativeFile(texturePath.c_str(), plist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// build texture path by replacing file extension
|
// build texture path by replacing file extension
|
||||||
texturePath = pszPlist;
|
texturePath = plist;
|
||||||
|
|
||||||
// remove .xxx
|
// remove .xxx
|
||||||
size_t startPos = texturePath.find_last_of(".");
|
size_t startPos = texturePath.find_last_of(".");
|
||||||
|
@ -272,7 +272,7 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& pszPlist)
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
addSpriteFramesWithDictionary(dict, texture);
|
addSpriteFramesWithDictionary(dict, texture);
|
||||||
_loadedFileNames->insert(pszPlist);
|
_loadedFileNames->insert(plist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ class CC_DLL SpriteFrameCache : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Returns the shared instance of the Sprite Frame cache */
|
/** Returns the shared instance of the Sprite Frame cache */
|
||||||
static SpriteFrameCache* getInstance(void);
|
static SpriteFrameCache* getInstance();
|
||||||
|
|
||||||
/** @deprecated Use getInstance() instead */
|
/** @deprecated Use getInstance() instead */
|
||||||
CC_DEPRECATED_ATTRIBUTE static SpriteFrameCache* sharedSpriteFrameCache() { return SpriteFrameCache::getInstance(); }
|
CC_DEPRECATED_ATTRIBUTE static SpriteFrameCache* sharedSpriteFrameCache() { return SpriteFrameCache::getInstance(); }
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual ~SpriteFrameCache();
|
virtual ~SpriteFrameCache();
|
||||||
bool init(void);
|
bool init();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Adds multiple Sprite Frames from a plist file.
|
/** Adds multiple Sprite Frames from a plist file.
|
||||||
|
|
Loading…
Reference in New Issue