mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4642 from dumganhar/deprecate-ccstring
Don’t use ‘String::createWithFormat’ in our codes, use StringUtils::format() instead.
This commit is contained in:
commit
30eb05b600
|
@ -1038,7 +1038,7 @@ CC_DEPRECATED_ATTRIBUTE typedef __Integer CCInteger;
|
|||
CC_DEPRECATED_ATTRIBUTE typedef __Bool Bool;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __Bool CCBool;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __String CCString;
|
||||
//CC_DEPRECATED_ATTRIBUTE typedef __String String;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __String String;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __RGBAProtocol RGBAProtocol;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __NodeRGBA NodeRGBA;
|
||||
|
|
|
@ -154,18 +154,18 @@ bool GLProgram::initWithVertexShaderByteArray(const GLchar* vShaderByteArray, co
|
|||
|
||||
bool GLProgram::initWithVertexShaderFilename(const char* vShaderFilename, const char* fShaderFilename)
|
||||
{
|
||||
const GLchar * vertexSource = (GLchar*) String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(vShaderFilename).c_str())->getCString();
|
||||
const GLchar * fragmentSource = (GLchar*) String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(fShaderFilename).c_str())->getCString();
|
||||
std::string vertexSource = FileUtils::getInstance()->getStringFromFile(FileUtils::getInstance()->fullPathForFilename(vShaderFilename).c_str());
|
||||
std::string fragmentSource = FileUtils::getInstance()->getStringFromFile(FileUtils::getInstance()->fullPathForFilename(fShaderFilename).c_str());
|
||||
|
||||
return initWithVertexShaderByteArray(vertexSource, fragmentSource);
|
||||
return initWithVertexShaderByteArray(vertexSource.c_str(), fragmentSource.c_str());
|
||||
}
|
||||
|
||||
std::string GLProgram::getDescription() const
|
||||
{
|
||||
return String::createWithFormat("<GLProgram = "
|
||||
return StringUtils::format("<GLProgram = "
|
||||
CC_FORMAT_PRINTF_SIZE_T
|
||||
" | Program = %i, VertexShader = %i, FragmentShader = %i>",
|
||||
(size_t)this, _program, _vertShader, _fragShader)->getCString();
|
||||
(size_t)this, _program, _vertShader, _fragShader);
|
||||
}
|
||||
|
||||
bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source)
|
||||
|
|
|
@ -673,7 +673,7 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat
|
|||
|
||||
std::string Texture2D::getDescription() const
|
||||
{
|
||||
return String::createWithFormat("<Texture2D | Name = %u | Dimensions = %ld x %ld | Coordinates = (%.2f, %.2f)>", _name, (long)_pixelsWide, (long)_pixelsHigh, _maxS, _maxT)->getCString();
|
||||
return StringUtils::format("<Texture2D | Name = %u | Dimensions = %ld x %ld | Coordinates = (%.2f, %.2f)>", _name, (long)_pixelsWide, (long)_pixelsHigh, _maxS, _maxT);
|
||||
}
|
||||
|
||||
// implementation Texture2D (Image)
|
||||
|
|
|
@ -224,7 +224,7 @@ void TextureAtlas::listenBackToForeground(Object *obj)
|
|||
|
||||
std::string TextureAtlas::getDescription() const
|
||||
{
|
||||
return String::createWithFormat("<TextureAtlas | totalQuads = %zd>", _totalQuads)->getCString();
|
||||
return StringUtils::format("<TextureAtlas | totalQuads = %zd>", _totalQuads);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void TextureCache::purgeSharedTextureCache()
|
|||
|
||||
std::string TextureCache::getDescription() const
|
||||
{
|
||||
return String::createWithFormat("<TextureCache | Number of textures = %lu>", _textures.size() )->getCString();
|
||||
return StringUtils::format("<TextureCache | Number of textures = %lu>", _textures.size());
|
||||
}
|
||||
|
||||
void TextureCache::addImageAsync(const std::string &path, Object *target, SEL_CallFuncO selector)
|
||||
|
|
|
@ -205,7 +205,7 @@ public: virtual void set##funName(varType var) \
|
|||
#define CC_BREAK_IF(cond) if(cond) break
|
||||
|
||||
#define __CCLOGWITHFUNCTION(s, ...) \
|
||||
log("%s : %s",__FUNCTION__, String::createWithFormat(s, ##__VA_ARGS__)->getCString())
|
||||
log("%s : %s",__FUNCTION__, StringUtils::format(s, ##__VA_ARGS__).c_str())
|
||||
|
||||
// cocos2d debug
|
||||
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
|
||||
|
|
|
@ -239,9 +239,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef __String String;
|
||||
|
||||
// end of data_structure group
|
||||
/// @}
|
||||
|
||||
|
|
Loading…
Reference in New Issue