mirror of https://github.com/axmolengine/axmol.git
issue #1324: Added create() for static member functions that new an autorelease object, updated cocoa folder.
This commit is contained in:
parent
3f7b44fc23
commit
23574172ff
|
@ -46,7 +46,7 @@ CCCamera::~CCCamera(void)
|
|||
|
||||
const char* CCCamera::description(void)
|
||||
{
|
||||
return CCString::stringWithFormat("<CCCamera | center = (%.2f,%.2f,%.2f)>", m_fCenterX, m_fCenterY, m_fCenterZ)->getCString();
|
||||
return CCString::createWithFormat("<CCCamera | center = (%.2f,%.2f,%.2f)>", m_fCenterX, m_fCenterY, m_fCenterZ)->getCString();
|
||||
}
|
||||
|
||||
void CCCamera::init(void)
|
||||
|
|
|
@ -604,7 +604,7 @@ unsigned int CCScheduler::scheduleScriptFunc(unsigned int nHandler, float fInter
|
|||
CCSchedulerScriptHandlerEntry* pEntry = CCSchedulerScriptHandlerEntry::entryWithHandler(nHandler, fInterval, bPaused);
|
||||
if (!m_pScriptHandlerEntries)
|
||||
{
|
||||
m_pScriptHandlerEntries = CCArray::arrayWithCapacity(20);
|
||||
m_pScriptHandlerEntries = CCArray::create(20);
|
||||
m_pScriptHandlerEntries->retain();
|
||||
}
|
||||
m_pScriptHandlerEntries->addObject(pEntry);
|
||||
|
|
|
@ -64,7 +64,7 @@ CCAction* CCAction::create()
|
|||
|
||||
const char* CCAction::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCAction | Tag = %d>", m_nTag)->getCString();
|
||||
return CCString::createWithFormat("<CCAction | Tag = %d>", m_nTag)->getCString();
|
||||
}
|
||||
|
||||
CCObject* CCAction::copyWithZone(CCZone *pZone)
|
||||
|
|
|
@ -2531,7 +2531,7 @@ void CCAnimate::update(float t)
|
|||
CCActionInterval* CCAnimate::reverse(void)
|
||||
{
|
||||
CCArray* pOldArray = m_pAnimation->getFrames();
|
||||
CCArray* pNewArray = CCArray::arrayWithCapacity(pOldArray->count());
|
||||
CCArray* pNewArray = CCArray::create(pOldArray->count());
|
||||
|
||||
CCARRAY_VERIFY_TYPE(pOldArray, CCAnimationFrame*);
|
||||
|
||||
|
|
|
@ -462,13 +462,13 @@ void CCNode::cleanup()
|
|||
|
||||
const char* CCNode::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCNode | Tag = %d>", m_nTag)->getCString();
|
||||
return CCString::createWithFormat("<CCNode | Tag = %d>", m_nTag)->getCString();
|
||||
}
|
||||
|
||||
// lazy allocs
|
||||
void CCNode::childrenAlloc(void)
|
||||
{
|
||||
m_pChildren = CCArray::arrayWithCapacity(4);
|
||||
m_pChildren = CCArray::create(4);
|
||||
m_pChildren->retain();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,12 @@ CCArray::CCArray(unsigned int capacity)
|
|||
initWithCapacity(capacity);
|
||||
}
|
||||
|
||||
CCArray* CCArray::array()
|
||||
// CCArray* CCArray::array()
|
||||
// {
|
||||
// return CCArray::create();
|
||||
// }
|
||||
|
||||
CCArray* CCArray::create()
|
||||
{
|
||||
CCArray* pArray = new CCArray();
|
||||
|
||||
|
@ -56,7 +61,12 @@ CCArray* CCArray::array()
|
|||
return pArray;
|
||||
}
|
||||
|
||||
CCArray* CCArray::arrayWithObject(CCObject* pObject)
|
||||
// CCArray* CCArray::arrayWithObject(CCObject* pObject)
|
||||
// {
|
||||
// return CCArray::createWithObject(pObject);
|
||||
// }
|
||||
|
||||
CCArray* CCArray::createWithObject(CCObject* pObject)
|
||||
{
|
||||
CCArray* pArray = new CCArray();
|
||||
|
||||
|
@ -72,12 +82,38 @@ CCArray* CCArray::arrayWithObject(CCObject* pObject)
|
|||
return pArray;
|
||||
}
|
||||
|
||||
CCArray* CCArray::arrayWithObjects(CCObject* pObject, ...)
|
||||
// CCArray* CCArray::arrayWithObjects(CCObject* pObject, ...)
|
||||
// {
|
||||
// va_list args;
|
||||
// va_start(args,pObject);
|
||||
//
|
||||
// CCArray* pArray = create();
|
||||
// if (pArray && pObject)
|
||||
// {
|
||||
// pArray->addObject(pObject);
|
||||
// CCObject *i = va_arg(args, CCObject*);
|
||||
// while(i)
|
||||
// {
|
||||
// pArray->addObject(i);
|
||||
// i = va_arg(args, CCObject*);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CC_SAFE_DELETE(pArray);
|
||||
// }
|
||||
//
|
||||
// va_end(args);
|
||||
//
|
||||
// return pArray;
|
||||
// }
|
||||
|
||||
CCArray* CCArray::create(CCObject* pObject, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args,pObject);
|
||||
|
||||
CCArray* pArray = array();
|
||||
|
||||
CCArray* pArray = create();
|
||||
if (pArray && pObject)
|
||||
{
|
||||
pArray->addObject(pObject);
|
||||
|
@ -94,11 +130,16 @@ CCArray* CCArray::arrayWithObjects(CCObject* pObject, ...)
|
|||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
|
||||
// CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
|
||||
// {
|
||||
// return CCArray::create(capacity);
|
||||
// }
|
||||
|
||||
CCArray* CCArray::create(unsigned int capacity)
|
||||
{
|
||||
CCArray* pArray = new CCArray();
|
||||
|
||||
|
@ -114,16 +155,26 @@ CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
|
|||
return pArray;
|
||||
}
|
||||
|
||||
CCArray* CCArray::arrayWithArray(CCArray* otherArray)
|
||||
// CCArray* CCArray::arrayWithArray(CCArray* otherArray)
|
||||
// {
|
||||
// return CCArray::create(otherArray);
|
||||
// }
|
||||
|
||||
CCArray* CCArray::create(CCArray* otherArray)
|
||||
{
|
||||
CCArray* pRet = (CCArray*)otherArray->copy();
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName)
|
||||
// CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName)
|
||||
// {
|
||||
// return CCArray::createWithContentsOfFile(pFileName);
|
||||
// }
|
||||
|
||||
CCArray* CCArray::createWithContentsOfFile(const char* pFileName)
|
||||
{
|
||||
CCArray* pRet = arrayWithContentsOfFileThreadSafe(pFileName);
|
||||
CCArray* pRet = createWithContentsOfFileThreadSafe(pFileName);
|
||||
if (pRet != NULL)
|
||||
{
|
||||
pRet->autorelease();
|
||||
|
@ -133,7 +184,12 @@ CCArray* CCArray::arrayWithContentsOfFile(const char* pFileName)
|
|||
|
||||
extern CCArray* ccFileUtils_arrayWithContentsOfFileThreadSafe(const char* pFileName);
|
||||
|
||||
CCArray* CCArray::arrayWithContentsOfFileThreadSafe(const char* pFileName)
|
||||
// CCArray* CCArray::arrayWithContentsOfFileThreadSafe(const char* pFileName)
|
||||
// {
|
||||
// return CCArray::createWithContentsOfFileThreadSafe(pFileName);
|
||||
// }
|
||||
|
||||
CCArray* CCArray::createWithContentsOfFileThreadSafe(const char* pFileName)
|
||||
{
|
||||
return ccFileUtils_arrayWithContentsOfFileThreadSafe(pFileName);
|
||||
}
|
||||
|
|
|
@ -110,28 +110,63 @@ public:
|
|||
~CCArray();
|
||||
|
||||
/* static functions */
|
||||
/** Create an array
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* array();
|
||||
/** Create an array with one object
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithObject(CCObject* pObject);
|
||||
/** Create an array with some objects
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithObjects(CCObject* pObject, ...);
|
||||
/** Create an array with capacity
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||
/** Create an array with an existing array
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithArray(CCArray* otherArray);
|
||||
/**
|
||||
@brief Generate a CCArray pointer by file
|
||||
@param pFileName The file name of *.plist file
|
||||
@return The CCArray pointer generated from the file
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithContentsOfFile(const char* pFileName);
|
||||
|
||||
/*
|
||||
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||
invoker should call release().
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCArray* arrayWithContentsOfFileThreadSafe(const char* pFileName);
|
||||
|
||||
/** Create an array */
|
||||
static CCArray* array();
|
||||
static CCArray* create();
|
||||
/** Create an array with one object */
|
||||
static CCArray* arrayWithObject(CCObject* pObject);
|
||||
static CCArray* createWithObject(CCObject* pObject);
|
||||
/** Create an array with some objects */
|
||||
static CCArray* arrayWithObjects(CCObject* pObject, ...);
|
||||
static CCArray* create(CCObject* pObject, ...);
|
||||
/** Create an array with capacity */
|
||||
static CCArray* arrayWithCapacity(unsigned int capacity);
|
||||
static CCArray* create(unsigned int capacity);
|
||||
/** Create an array with an existing array */
|
||||
static CCArray* arrayWithArray(CCArray* otherArray);
|
||||
static CCArray* create(CCArray* otherArray);
|
||||
/**
|
||||
@brief Generate a CCArray pointer by file
|
||||
@param pFileName The file name of *.plist file
|
||||
@return The CCArray pointer generated from the file
|
||||
*/
|
||||
static CCArray* arrayWithContentsOfFile(const char* pFileName);
|
||||
static CCArray* createWithContentsOfFile(const char* pFileName);
|
||||
|
||||
/*
|
||||
@brief The same meaning as arrayWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||
invoker should call release().
|
||||
*/
|
||||
static CCArray* arrayWithContentsOfFileThreadSafe(const char* pFileName);
|
||||
static CCArray* createWithContentsOfFileThreadSafe(const char* pFileName);
|
||||
|
||||
/** Initializes an array */
|
||||
bool init();
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "CCData.h"
|
||||
#include "CCFileUtils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
CCData::CCData(void)
|
||||
: m_pData(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CCData::~CCData(void)
|
||||
{
|
||||
CC_SAFE_DELETE_ARRAY(m_pData);
|
||||
}
|
||||
|
||||
CCData* CCData::dataWithContentsOfFile(const string &strPath)
|
||||
{
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(strPath.c_str(), "rb", &nSize);
|
||||
|
||||
if (! pBuffer)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCData *pRet = new CCData();
|
||||
pRet->m_pData = new char[nSize];
|
||||
memcpy(pRet->m_pData, pBuffer, nSize);
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
void* CCData::bytes(void)
|
||||
{
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
//@todo implement
|
||||
CCData* CCData::dataWithBytes(unsigned char *pBytes, int size)
|
||||
{
|
||||
CC_UNUSED_PARAM(pBytes);
|
||||
CC_UNUSED_PARAM(size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NS_CC_END
|
|
@ -1,51 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCDATA_H__
|
||||
#define __CCDATA_H__
|
||||
|
||||
#include "CCObject.h"
|
||||
#include <string>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL CCData : public CCObject
|
||||
{
|
||||
public:
|
||||
CCData(void);
|
||||
~CCData(void);
|
||||
|
||||
void* bytes(void);
|
||||
|
||||
public:
|
||||
static CCData* dataWithBytes(unsigned char *pBytes, int size);
|
||||
static CCData* dataWithContentsOfFile(const std::string &strPath);
|
||||
|
||||
private:
|
||||
char *m_pData;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif //__CCDATA_H__
|
|
@ -28,7 +28,8 @@ CCArray* CCDictionary::allKeys()
|
|||
{
|
||||
int iKeyCount = this->count();
|
||||
if (iKeyCount <= 0) return NULL;
|
||||
CCArray* pArray = CCArray::arrayWithCapacity(iKeyCount);
|
||||
|
||||
CCArray* pArray = CCArray::create(iKeyCount);
|
||||
|
||||
CCDictElement *pElement, *tmp;
|
||||
if (m_eDictType == kCCDictStr)
|
||||
|
@ -57,7 +58,7 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object)
|
|||
{
|
||||
int iKeyCount = this->count();
|
||||
if (iKeyCount <= 0) return NULL;
|
||||
CCArray* pArray = CCArray::array();
|
||||
CCArray* pArray = CCArray::create();
|
||||
|
||||
CCDictElement *pElement, *tmp;
|
||||
|
||||
|
@ -68,8 +69,8 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object)
|
|||
if (object == pElement->m_pObject)
|
||||
{
|
||||
CCString* pOneKey = new CCString(pElement->m_szKey);
|
||||
pOneKey->autorelease();
|
||||
pArray->addObject(pOneKey);
|
||||
pOneKey->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +81,8 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object)
|
|||
if (object == pElement->m_pObject)
|
||||
{
|
||||
CCInteger* pOneKey = new CCInteger(pElement->m_iKey);
|
||||
pOneKey->autorelease();
|
||||
pArray->addObject(pOneKey);
|
||||
pOneKey->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +124,7 @@ const CCString* CCDictionary::valueForKey(const std::string& key)
|
|||
CCString* pStr = (CCString*)objectForKey(key);
|
||||
if (pStr == NULL)
|
||||
{
|
||||
pStr = CCString::stringWithCString("");
|
||||
pStr = CCString::create("");
|
||||
}
|
||||
return pStr;
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ const CCString* CCDictionary::valueForKey(int key)
|
|||
CCString* pStr = (CCString*)objectForKey(key);
|
||||
if (pStr == NULL)
|
||||
{
|
||||
pStr = CCString::stringWithCString("");
|
||||
pStr = CCString::create("");
|
||||
}
|
||||
return pStr;
|
||||
}
|
||||
|
@ -291,7 +292,12 @@ CCObject* CCDictionary::copyWithZone(CCZone* pZone)
|
|||
return pNewDict;
|
||||
}
|
||||
|
||||
CCDictionary* CCDictionary::dictionary()
|
||||
// CCDictionary* CCDictionary::dictionary()
|
||||
// {
|
||||
// return CCDictionary::create();
|
||||
// }
|
||||
|
||||
CCDictionary* CCDictionary::create()
|
||||
{
|
||||
CCDictionary* pRet = new CCDictionary();
|
||||
if (pRet != NULL)
|
||||
|
@ -301,7 +307,12 @@ CCDictionary* CCDictionary::dictionary()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict)
|
||||
// CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict)
|
||||
// {
|
||||
// return CCDictionary::createWithDictionary(srcDict);
|
||||
// }
|
||||
|
||||
CCDictionary* CCDictionary::createWithDictionary(CCDictionary* srcDict)
|
||||
{
|
||||
CCDictionary* pNewDict = (CCDictionary*)srcDict->copy();
|
||||
pNewDict->autorelease();
|
||||
|
@ -310,14 +321,24 @@ CCDictionary* CCDictionary::dictionaryWithDictionary(CCDictionary* srcDict)
|
|||
|
||||
extern CCDictionary* ccFileUtils_dictionaryWithContentsOfFileThreadSafe(const char *pFileName);
|
||||
|
||||
CCDictionary* CCDictionary::dictionaryWithContentsOfFileThreadSafe(const char *pFileName)
|
||||
// CCDictionary* CCDictionary::dictionaryWithContentsOfFileThreadSafe(const char *pFileName)
|
||||
// {
|
||||
// return CCDictionary::createWithContentsOfFileThreadSafe(pFileName);
|
||||
// }
|
||||
|
||||
CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFileName)
|
||||
{
|
||||
return ccFileUtils_dictionaryWithContentsOfFileThreadSafe(pFileName);
|
||||
}
|
||||
|
||||
CCDictionary* CCDictionary::dictionaryWithContentsOfFile(const char *pFileName)
|
||||
// CCDictionary* CCDictionary::dictionaryWithContentsOfFile(const char *pFileName)
|
||||
// {
|
||||
// return CCDictionary::createWithContentsOfFile(pFileName);
|
||||
// }
|
||||
|
||||
CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName)
|
||||
{
|
||||
CCDictionary* pRet = dictionaryWithContentsOfFileThreadSafe(pFileName);
|
||||
CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
|
|
@ -136,21 +136,40 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
/* static functions */
|
||||
static CCDictionary* dictionary();
|
||||
//@warning: This interface will be deprecated in future.
|
||||
//static CCDictionary* dictionary();
|
||||
|
||||
static CCDictionary* dictionaryWithDictionary(CCDictionary* srcDict);
|
||||
//static CCDictionary* dictionaryWithDictionary(CCDictionary* srcDict);
|
||||
/**
|
||||
@brief Generate a CCDictionary pointer by file
|
||||
@param pFileName The file name of *.plist file
|
||||
@return The CCDictionary pointer generated from the file
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCDictionary* dictionaryWithContentsOfFile(const char *pFileName);
|
||||
|
||||
/*
|
||||
@brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||
invoker should call release().
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCDictionary* dictionaryWithContentsOfFileThreadSafe(const char *pFileName);
|
||||
|
||||
static CCDictionary* create();
|
||||
|
||||
static CCDictionary* createWithDictionary(CCDictionary* srcDict);
|
||||
/**
|
||||
@brief Generate a CCDictionary pointer by file
|
||||
@param pFileName The file name of *.plist file
|
||||
@return The CCDictionary pointer generated from the file
|
||||
*/
|
||||
static CCDictionary* dictionaryWithContentsOfFile(const char *pFileName);
|
||||
static CCDictionary* createWithContentsOfFile(const char *pFileName);
|
||||
|
||||
/*
|
||||
@brief The same meaning as dictionaryWithContentsOfFile(), but it doesn't call autorelease, so the
|
||||
invoker should call release().
|
||||
*/
|
||||
static CCDictionary* dictionaryWithContentsOfFileThreadSafe(const char *pFileName);
|
||||
static CCDictionary* createWithContentsOfFileThreadSafe(const char *pFileName);
|
||||
|
||||
private:
|
||||
void setObjectUnSafe(CCObject* pObject, const std::string& key);
|
||||
|
|
|
@ -12,7 +12,13 @@ public:
|
|||
: m_nValue(v) {}
|
||||
int getValue() const {return m_nValue;}
|
||||
|
||||
static CCInteger* integerWithInt(int v)
|
||||
// @warning: This interface will be deprecated in future.
|
||||
// static CCInteger* integerWithInt(int v)
|
||||
// {
|
||||
// return CCInteger::create(v);
|
||||
// }
|
||||
|
||||
static CCInteger* create(int v)
|
||||
{
|
||||
CCInteger* pRet = new CCInteger(v);
|
||||
pRet->autorelease();
|
||||
|
|
|
@ -145,14 +145,24 @@ bool CCString::isEqual(const CCObject* pObject)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
CCString* CCString::stringWithCString(const char* pStr)
|
||||
// CCString* CCString::stringWithCString(const char* pStr)
|
||||
// {
|
||||
// return CCString::create(pStr);
|
||||
// }
|
||||
|
||||
CCString* CCString::create(const char* pStr)
|
||||
{
|
||||
CCString* pRet = new CCString(pStr);
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCString* CCString::stringWithData(unsigned char* pData, unsigned long nLen)
|
||||
// CCString* CCString::stringWithData(unsigned char* pData, unsigned long nLen)
|
||||
// {
|
||||
// return CCString::createWithData(pData, nLen);
|
||||
// }
|
||||
|
||||
CCString* CCString::createWithData(unsigned char* pData, unsigned long nLen)
|
||||
{
|
||||
CCString* pRet = NULL;
|
||||
if (pData != NULL && nLen > 0)
|
||||
|
@ -162,16 +172,27 @@ CCString* CCString::stringWithData(unsigned char* pData, unsigned long nLen)
|
|||
{
|
||||
pStr[nLen] = '\0';
|
||||
memcpy(pStr, pData, nLen);
|
||||
pRet = CCString::stringWithCString(pStr);
|
||||
pRet = CCString::create(pStr);
|
||||
free(pStr);
|
||||
}
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCString* CCString::stringWithFormat(const char* format, ...)
|
||||
// CCString* CCString::stringWithFormat(const char* format, ...)
|
||||
// {
|
||||
// CCString* pRet = CCString::create("");
|
||||
// va_list ap;
|
||||
// va_start(ap, format);
|
||||
// pRet->initWithFormatAndValist(format, ap);
|
||||
// va_end(ap);
|
||||
//
|
||||
// return pRet;
|
||||
// }
|
||||
|
||||
CCString* CCString::createWithFormat(const char* format, ...)
|
||||
{
|
||||
CCString* pRet = CCString::stringWithCString("");
|
||||
CCString* pRet = CCString::create("");
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
pRet->initWithFormatAndValist(format, ap);
|
||||
|
@ -180,13 +201,18 @@ CCString* CCString::stringWithFormat(const char* format, ...)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
CCString* CCString::stringWithContentsOfFile(const char* pszFileName)
|
||||
// CCString* CCString::stringWithContentsOfFile(const char* pszFileName)
|
||||
// {
|
||||
// return CCString::createWithContentsOfFile(pszFileName);
|
||||
// }
|
||||
|
||||
CCString* CCString::createWithContentsOfFile(const char* pszFileName)
|
||||
{
|
||||
unsigned long size = 0;
|
||||
unsigned char* pData = 0;
|
||||
CCString* pRet = NULL;
|
||||
pData = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(pszFileName, "rb", &size);
|
||||
pRet = stringWithData(pData, size);
|
||||
pData = CCFileUtils::sharedFileUtils()->getFileData(pszFileName, "rb", &size);
|
||||
pRet = CCString::createWithData(pData, size);
|
||||
CC_SAFE_DELETE_ARRAY(pData);
|
||||
return pRet;
|
||||
}
|
||||
|
|
|
@ -74,27 +74,56 @@ public:
|
|||
/** create a string with c string
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
static CCString* stringWithCString(const char* pStr);
|
||||
//static CCString* stringWithCString(const char* pStr);
|
||||
|
||||
/** create a string with format, it's similar with the c function 'sprintf', the default buffer size is (1024*100) bytes,
|
||||
* if you want to change it, you should modify the kMaxStringLen macro in CCString.cpp file.
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCString* stringWithFormat(const char* format, ...);
|
||||
|
||||
/** create a string with binary data
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCString* stringWithData(unsigned char* pData, unsigned long nLen);
|
||||
|
||||
/** create a string with a file,
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
@warning: This interface will be deprecated in future.
|
||||
*/
|
||||
//static CCString* stringWithContentsOfFile(const char* pszFileName);
|
||||
|
||||
/** create a string with c string
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
*/
|
||||
static CCString* create(const char* pStr);
|
||||
|
||||
/** create a string with format, it's similar with the c function 'sprintf', the default buffer size is (1024*100) bytes,
|
||||
* if you want to change it, you should modify the kMaxStringLen macro in CCString.cpp file.
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
*/
|
||||
static CCString* stringWithFormat(const char* format, ...);
|
||||
static CCString* createWithFormat(const char* format, ...);
|
||||
|
||||
/** create a string with binary data
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
*/
|
||||
static CCString* stringWithData(unsigned char* pData, unsigned long nLen);
|
||||
static CCString* createWithData(unsigned char* pData, unsigned long nLen);
|
||||
|
||||
/** create a string with a file,
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
*/
|
||||
static CCString* stringWithContentsOfFile(const char* pszFileName);
|
||||
static CCString* createWithContentsOfFile(const char* pszFileName);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -105,7 +134,7 @@ public:
|
|||
std::string m_sString;
|
||||
};
|
||||
|
||||
#define CCStringMake(str) CCString::stringWithCString(str)
|
||||
#define CCStringMake(str) CCString::create(str)
|
||||
#define ccs CCStringMake
|
||||
|
||||
|
||||
|
|
|
@ -763,7 +763,7 @@ CCNode* CCBReader::nodeGraphFromFile(const char* file, CCNode* owner)
|
|||
ccbFileDir = ccbFilePath.substr(0, lastSlash) + "/";
|
||||
}
|
||||
|
||||
CCDictionary* dict = CCDictionary::dictionaryWithContentsOfFile(ccbFilePath.c_str());
|
||||
CCDictionary* dict = CCDictionary::createWithContentsOfFile(ccbFilePath.c_str());
|
||||
CCAssert(dict != NULL, "CCBReader: file not found");
|
||||
return nodeGraphFromDictionary(dict, NULL, ccbFileDir.c_str(), owner);
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ CCArray* CCControl::dispatchListforControlEvent(CCControlEvent controlEvent)
|
|||
// If the invocation list does not exist for the dispatch table, we create it
|
||||
if (invocationList == NULL)
|
||||
{
|
||||
invocationList = CCArray::arrayWithCapacity(1);
|
||||
invocationList = CCArray::create(1);
|
||||
dispatchTable->setObject(invocationList, controlEvent);
|
||||
}
|
||||
return invocationList;
|
||||
|
|
|
@ -99,7 +99,7 @@ bool CCControlButton::initWithLabelAndBackgroundSprite(CCNode* node, CCScale9Spr
|
|||
|
||||
// Initialize the dispatch table
|
||||
|
||||
CCString* tempString = CCString::stringWithCString(label->getString());
|
||||
CCString* tempString = CCString::create(label->getString());
|
||||
//tempString->autorelease();
|
||||
setTitleForState(tempString, CCControlStateNormal);
|
||||
setTitleColorForState(rgbaLabel->getColor(), CCControlStateNormal);
|
||||
|
|
|
@ -34,7 +34,7 @@ static CCNotificationCenter *s_sharedNotifCenter = NULL;
|
|||
|
||||
CCNotificationCenter::CCNotificationCenter()
|
||||
{
|
||||
m_observers = CCArray::arrayWithCapacity(3);
|
||||
m_observers = CCArray::create(3);
|
||||
m_observers->retain();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ THE SOFTWARE.
|
|||
#include "CCAutoreleasePool.h"
|
||||
#include "CCInteger.h"
|
||||
#include "CCString.h"
|
||||
#include "CCData.h"
|
||||
#include "CCNS.h"
|
||||
#include "CCZone.h"
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ CCKeypadDispatcher::CCKeypadDispatcher()
|
|||
, m_bToAdd(false)
|
||||
, m_bToRemove(false)
|
||||
{
|
||||
m_pDelegates = CCArray::array();
|
||||
m_pDelegates = CCArray::create();
|
||||
m_pDelegates->retain();
|
||||
|
||||
m_pHandlersToAdd = ccCArrayNew(8);
|
||||
|
|
|
@ -95,7 +95,7 @@ CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *fntFile)
|
|||
|
||||
bool CCLabelAtlas::initWithString(const char *theString, const char *fntFile)
|
||||
{
|
||||
CCDictionary *dict = CCDictionary::dictionaryWithContentsOfFile(CCFileUtils::sharedFileUtils()->sharedFileUtils()->fullPathFromRelativePath(fntFile));
|
||||
CCDictionary *dict = CCDictionary::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fntFile));
|
||||
|
||||
CCAssert(((CCString*)dict->objectForKey("version"))->intValue() == 1, "Unsupported version. Upgrade cocos2d version");
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ CCBMFontConfiguration::~CCBMFontConfiguration()
|
|||
|
||||
const char* CCBMFontConfiguration::description(void)
|
||||
{
|
||||
return CCString::stringWithFormat(
|
||||
return CCString::createWithFormat(
|
||||
"<CCBMFontConfiguration = %08X | Glphys:%d Kernings:%d | Image = %s>",
|
||||
this,
|
||||
HASH_COUNT(m_pFontDefDictionary),
|
||||
|
@ -486,7 +486,7 @@ void CCBMFontConfiguration::purgeFontDefDictionary()
|
|||
bool CCBMFontConfiguration::parseConfigFile(const char *controlFile)
|
||||
{
|
||||
std::string fullpath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(controlFile);
|
||||
CCString *contents = CCString::stringWithContentsOfFile(fullpath.c_str());
|
||||
CCString *contents = CCString::createWithContentsOfFile(fullpath.c_str());
|
||||
|
||||
CCAssert(contents, "CCBMFontConfiguration::parseConfigFile | Open file error.");
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ const char* CCLabelTTF::getString(void)
|
|||
|
||||
const char* CCLabelTTF::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCLabelTTF | FontName = %s, FontSize = %.1f>", m_pFontName->c_str(), m_fFontSize)->getCString();
|
||||
return CCString::createWithFormat("<CCLabelTTF | FontName = %s, FontSize = %.1f>", m_pFontName->c_str(), m_fFontSize)->getCString();
|
||||
}
|
||||
|
||||
CCTextAlignment CCLabelTTF::getHorizontalAlignment()
|
||||
|
|
|
@ -800,7 +800,7 @@ void CCLayerMultiplex::addLayer(CCLayer* layer)
|
|||
|
||||
bool CCLayerMultiplex::initWithLayer(CCLayer* layer)
|
||||
{
|
||||
m_pLayers = CCArray::array();
|
||||
m_pLayers = CCArray::create();
|
||||
m_pLayers->retain();
|
||||
m_pLayers->addObject(layer);
|
||||
m_nEnabledLayer = 0;
|
||||
|
@ -810,7 +810,7 @@ bool CCLayerMultiplex::initWithLayer(CCLayer* layer)
|
|||
|
||||
bool CCLayerMultiplex::initWithLayers(CCLayer *layer, va_list params)
|
||||
{
|
||||
m_pLayers = CCArray::arrayWithCapacity(5);
|
||||
m_pLayers = CCArray::create(5);
|
||||
m_pLayers->retain();
|
||||
|
||||
m_pLayers->addObject(layer);
|
||||
|
|
|
@ -128,7 +128,7 @@ bool CCMenu::initWithItems(CCMenuItem* item, va_list args)
|
|||
CCArray* pArray = NULL;
|
||||
if( item )
|
||||
{
|
||||
pArray = CCArray::arrayWithObject(item);
|
||||
pArray = CCArray::create(item, NULL);
|
||||
CCMenuItem *i = va_arg(args, CCMenuItem*);
|
||||
while(i)
|
||||
{
|
||||
|
|
|
@ -816,7 +816,7 @@ CCMenuItemToggle * CCMenuItemToggle::create(CCObject* target, SEL_MenuHandler se
|
|||
bool CCMenuItemToggle::initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args)
|
||||
{
|
||||
CCMenuItem::initWithTarget(target, selector);
|
||||
this->m_pSubItems = CCArray::array();
|
||||
this->m_pSubItems = CCArray::create();
|
||||
this->m_pSubItems->retain();
|
||||
int z = 0;
|
||||
CCMenuItem *i = item;
|
||||
|
@ -847,7 +847,7 @@ CCMenuItemToggle* CCMenuItemToggle::create(CCMenuItem *item)
|
|||
bool CCMenuItemToggle::initWithItem(CCMenuItem *item)
|
||||
{
|
||||
CCMenuItem::initWithTarget(NULL, NULL);
|
||||
this->m_pSubItems = CCArray::array();
|
||||
this->m_pSubItems = CCArray::create();
|
||||
this->m_pSubItems->retain();
|
||||
m_pSubItems->addObject(item);
|
||||
m_uSelectedIndex = UINT_MAX;
|
||||
|
|
|
@ -25,7 +25,6 @@ THE SOFTWARE.
|
|||
#ifndef __CCRENDER_TEXTURE_H__
|
||||
#define __CCRENDER_TEXTURE_H__
|
||||
|
||||
#include "CCData.h"
|
||||
#include "CCNode.h"
|
||||
#include "CCSprite.h"
|
||||
#include "kazmath/mat4.h"
|
||||
|
|
|
@ -156,7 +156,7 @@ bool CCParticleSystem::initWithFile(const char *plistFile)
|
|||
{
|
||||
bool bRet = false;
|
||||
m_sPlistFile = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plistFile);
|
||||
CCDictionary *dict = CCDictionary::dictionaryWithContentsOfFileThreadSafe(m_sPlistFile.c_str());
|
||||
CCDictionary *dict = CCDictionary::createWithContentsOfFileThreadSafe(m_sPlistFile.c_str());
|
||||
|
||||
CCAssert( dict != NULL, "Particles: file not found");
|
||||
bRet = this->initWithDictionary(dict);
|
||||
|
|
|
@ -97,7 +97,7 @@ bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = e
|
|||
CC_UNUSED_PARAM(eImgFmt);
|
||||
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(strPath), "rb", &nSize);
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(strPath), "rb", &nSize);
|
||||
|
||||
return initWithImageData(pBuffer, nSize, eImgFmt);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ bool CCImage::initWithImageFileThreadSafe(const char *fullpath, EImageFormat ima
|
|||
CC_UNUSED_PARAM(imageType);
|
||||
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(fullpath, "rb", &nSize);
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullpath, "rb", &nSize);
|
||||
|
||||
return initWithImageData(pBuffer, nSize, imageType);
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public: virtual void set##funName(varType var) \
|
|||
#define CC_BREAK_IF(cond) if(cond) break
|
||||
|
||||
#define __CCLOGWITHFUNCTION(s, ...) \
|
||||
CCLog("%s : %s",__FUNCTION__, CCString::stringWithFormat(s, ##__VA_ARGS__)->getCString())
|
||||
CCLog("%s : %s",__FUNCTION__, CCString::createWithFormat(s, ##__VA_ARGS__)->getCString())
|
||||
|
||||
// cocos2d debug
|
||||
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
|
||||
|
|
|
@ -84,7 +84,7 @@ bool CCSAXParser::parse(const char* pXMLData, unsigned int uDataLength)
|
|||
bool CCSAXParser::parse(const char *pszFile)
|
||||
{
|
||||
unsigned long size;
|
||||
char *pBuffer = (char*)CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(pszFile, "rt", &size);
|
||||
char *pBuffer = (char*)CCFileUtils::sharedFileUtils()->getFileData(pszFile, "rt", &size);
|
||||
|
||||
if (!pBuffer)
|
||||
{
|
||||
|
|
|
@ -231,14 +231,6 @@
|
|||
RelativePath="..\cocoa\CCAutoreleasePool.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\cocoa\CCData.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\cocoa\CCData.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\cocoa\CCDictionary.cpp"
|
||||
>
|
||||
|
|
|
@ -116,15 +116,15 @@ bool CCGLProgram::initWithVertexShaderByteArray(const GLchar* vShaderByteArray,
|
|||
|
||||
bool CCGLProgram::initWithVertexShaderFilename(const char* vShaderFilename, const char* fShaderFilename)
|
||||
{
|
||||
const GLchar * vertexSource = (GLchar*) CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(vShaderFilename))->getCString();
|
||||
const GLchar * fragmentSource = (GLchar*) CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fShaderFilename))->getCString();
|
||||
const GLchar * vertexSource = (GLchar*) CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(vShaderFilename))->getCString();
|
||||
const GLchar * fragmentSource = (GLchar*) CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(fShaderFilename))->getCString();
|
||||
|
||||
return initWithVertexShaderByteArray(vertexSource, fragmentSource);
|
||||
}
|
||||
|
||||
const char* CCGLProgram::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCGLProgram = %08X | Program = %i, VertexShader = %i, FragmentShader = %i>", this, m_uProgram, m_uVertShader, m_uFragShader)->getCString();
|
||||
return CCString::createWithFormat("<CCGLProgram = %08X | Program = %i, VertexShader = %i, FragmentShader = %i>", this, m_uProgram, m_uVertShader, m_uFragShader)->getCString();
|
||||
}
|
||||
|
||||
bool CCGLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source)
|
||||
|
@ -219,7 +219,7 @@ const char* CCGLProgram::logForOpenGLObject(GLuint object, GLInfoFunction infoFu
|
|||
char *logBytes = (char*)malloc(logLength);
|
||||
logFunc(object, logLength, &charsWritten, logBytes);
|
||||
|
||||
CCString* log = CCString::stringWithCString(logBytes);
|
||||
CCString* log = CCString::create(logBytes);
|
||||
|
||||
free(logBytes);
|
||||
return log->getCString();
|
||||
|
|
|
@ -133,7 +133,7 @@ bool CCAnimation::initWithSpriteFrames(CCArray *pFrames, float delay/* = 0.0f*/)
|
|||
|
||||
m_uLoops = 1;
|
||||
m_fDelayPerUnit = delay;
|
||||
CCArray* pTmpFrames = CCArray::array();
|
||||
CCArray* pTmpFrames = CCArray::create();
|
||||
setFrames(pTmpFrames);
|
||||
|
||||
if (pFrames != NULL)
|
||||
|
@ -161,7 +161,7 @@ bool CCAnimation::initWithAnimationFrames(CCArray* arrayOfAnimationFrames, float
|
|||
m_fDelayPerUnit = delayPerUnit;
|
||||
m_uLoops = loops;
|
||||
|
||||
setFrames(CCArray::arrayWithArray(arrayOfAnimationFrames));
|
||||
setFrames(CCArray::create(arrayOfAnimationFrames));
|
||||
|
||||
CCObject* pObj = NULL;
|
||||
CCARRAY_FOREACH(m_pFrames, pObj)
|
||||
|
|
|
@ -108,7 +108,7 @@ void CCAnimationCache::parseVersion1(CCDictionary* animations)
|
|||
continue;
|
||||
}
|
||||
|
||||
CCArray* frames = CCArray::arrayWithCapacity(frameNames->count());
|
||||
CCArray* frames = CCArray::create(frameNames->count());
|
||||
frames->retain();
|
||||
|
||||
CCObject* pObj = NULL;
|
||||
|
@ -164,7 +164,7 @@ void CCAnimationCache::parseVersion2(CCDictionary* animations)
|
|||
}
|
||||
|
||||
// Array of AnimationFrames
|
||||
CCArray* array = CCArray::arrayWithCapacity(frameArray->count());
|
||||
CCArray* array = CCArray::create(frameArray->count());
|
||||
array->retain();
|
||||
|
||||
CCObject* pObj = NULL;
|
||||
|
@ -245,7 +245,7 @@ void CCAnimationCache::addAnimationsWithFile(const char* plist)
|
|||
CCAssert( plist, "Invalid texture file name");
|
||||
|
||||
const char* path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plist);
|
||||
CCDictionary* dict = CCDictionary::dictionaryWithContentsOfFile(path);
|
||||
CCDictionary* dict = CCDictionary::createWithContentsOfFile(path);
|
||||
|
||||
CCAssert( dict, "CCAnimationCache: File could not be found");
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ void CCSpriteFrameCache::addSpriteFramesWithDictionary(CCDictionary* dictionary,
|
|||
void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist, CCTexture2D *pobTexture)
|
||||
{
|
||||
const char *pszPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pszPlist);
|
||||
CCDictionary *dict = CCDictionary::dictionaryWithContentsOfFileThreadSafe(pszPath);
|
||||
CCDictionary *dict = CCDictionary::createWithContentsOfFileThreadSafe(pszPath);
|
||||
|
||||
addSpriteFramesWithDictionary(dict, pobTexture);
|
||||
|
||||
|
@ -232,7 +232,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist)
|
|||
if (m_pLoadedFileNames->find(pszPlist) == m_pLoadedFileNames->end())
|
||||
{
|
||||
const char *pszPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pszPlist);
|
||||
CCDictionary *dict = CCDictionary::dictionaryWithContentsOfFileThreadSafe(pszPath);
|
||||
CCDictionary *dict = CCDictionary::createWithContentsOfFileThreadSafe(pszPath);
|
||||
|
||||
string texturePath("");
|
||||
|
||||
|
@ -343,7 +343,7 @@ void CCSpriteFrameCache::removeSpriteFrameByName(const char *pszName)
|
|||
void CCSpriteFrameCache::removeSpriteFramesFromFile(const char* plist)
|
||||
{
|
||||
const char* path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(plist);
|
||||
CCDictionary* dict = CCDictionary::dictionaryWithContentsOfFileThreadSafe(path);
|
||||
CCDictionary* dict = CCDictionary::createWithContentsOfFileThreadSafe(path);
|
||||
|
||||
removeSpriteFramesFromDictionary((CCDictionary*)dict);
|
||||
|
||||
|
@ -360,14 +360,14 @@ void CCSpriteFrameCache::removeSpriteFramesFromFile(const char* plist)
|
|||
void CCSpriteFrameCache::removeSpriteFramesFromDictionary(CCDictionary* dictionary)
|
||||
{
|
||||
CCDictionary* framesDict = (CCDictionary*)dictionary->objectForKey("frames");
|
||||
CCArray* keysToRemove = CCArray::array();
|
||||
CCArray* keysToRemove = CCArray::create();
|
||||
|
||||
CCDictElement* pElement = NULL;
|
||||
CCDICT_FOREACH(framesDict, pElement)
|
||||
{
|
||||
if (m_pSpriteFrames->objectForKey(pElement->getStrKey()))
|
||||
{
|
||||
keysToRemove->addObject(CCString::stringWithCString(pElement->getStrKey()));
|
||||
keysToRemove->addObject(CCString::create(pElement->getStrKey()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ void CCSpriteFrameCache::removeSpriteFramesFromDictionary(CCDictionary* dictiona
|
|||
|
||||
void CCSpriteFrameCache::removeSpriteFramesFromTexture(CCTexture2D* texture)
|
||||
{
|
||||
CCArray* keysToRemove = CCArray::array();
|
||||
CCArray* keysToRemove = CCArray::create();
|
||||
|
||||
CCDictElement* pElement = NULL;
|
||||
CCDICT_FOREACH(m_pSpriteFrames, pElement)
|
||||
|
@ -385,7 +385,7 @@ void CCSpriteFrameCache::removeSpriteFramesFromTexture(CCTexture2D* texture)
|
|||
CCSpriteFrame* frame = (CCSpriteFrame*)m_pSpriteFrames->objectForKey(key.c_str());
|
||||
if (frame && (frame->getTexture() == texture))
|
||||
{
|
||||
keysToRemove->addObject(CCString::stringWithCString(pElement->getStrKey()));
|
||||
keysToRemove->addObject(CCString::create(pElement->getStrKey()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ tImageTGA * tgaLoad(const char *pszFilename)
|
|||
tImageTGA *info = NULL;
|
||||
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(pszFilename, "rb", &nSize);
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(pszFilename, "rb", &nSize);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace cocos2d
|
|||
unsigned char *compressed = NULL;
|
||||
|
||||
int fileLen = 0;
|
||||
compressed = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(path, "rb", (unsigned long *)(&fileLen));
|
||||
compressed = CCFileUtils::sharedFileUtils()->getFileData(path, "rb", (unsigned long *)(&fileLen));
|
||||
// int fileLen = CCFileUtils::sharedFileUtils()->ccLoadFileIntoMemory( path, &compressed );
|
||||
|
||||
if( fileLen < 0 )
|
||||
|
|
|
@ -248,7 +248,7 @@ bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFor
|
|||
|
||||
const char* CCTexture2D::description(void)
|
||||
{
|
||||
return CCString::stringWithFormat("<CCTexture2D | Name = %u | Dimensions = %u x %u | Coordinates = (%.2f, %.2f)>", m_uName, m_uPixelsWide, m_uPixelsHigh, m_fMaxS, m_fMaxT)->getCString();
|
||||
return CCString::createWithFormat("<CCTexture2D | Name = %u | Dimensions = %u x %u | Coordinates = (%.2f, %.2f)>", m_uName, m_uPixelsWide, m_uPixelsHigh, m_fMaxS, m_fMaxT)->getCString();
|
||||
}
|
||||
|
||||
// implementation CCTexture2D (Image)
|
||||
|
|
|
@ -209,7 +209,7 @@ void CCTextureAtlas::listenBackToForeground(CCObject *obj)
|
|||
|
||||
const char* CCTextureAtlas::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCTextureAtlas | totalQuads = %u>", m_uTotalQuads)->getCString();
|
||||
return CCString::createWithFormat("<CCTextureAtlas | totalQuads = %u>", m_uTotalQuads)->getCString();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ THE SOFTWARE.
|
|||
#include "CCTextureCache.h"
|
||||
#include "CCTexture2D.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCData.h"
|
||||
#include "CCDirector.h"
|
||||
#include "platform/platform.h"
|
||||
#include "CCFileUtils.h"
|
||||
|
@ -235,7 +234,7 @@ void CCTextureCache::purgeSharedTextureCache()
|
|||
|
||||
const char* CCTextureCache::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCTextureCache | Number of textures = %u>", m_pTextures->count())->getCString();
|
||||
return CCString::createWithFormat("<CCTextureCache | Number of textures = %u>", m_pTextures->count())->getCString();
|
||||
}
|
||||
|
||||
CCDictionary* CCTextureCache::snapshotTextures()
|
||||
|
@ -440,7 +439,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
|||
|
||||
CCImage image;
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(fullpath.c_str(), "rb", &nSize);
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullpath.c_str(), "rb", &nSize);
|
||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, eImageFormat));
|
||||
|
||||
texture = new CCTexture2D();
|
||||
|
@ -488,10 +487,12 @@ CCTexture2D* CCTextureCache::addPVRTCImage(const char* path, int bpp, bool hasAl
|
|||
// Split up directory and filename
|
||||
std::string fullpath( CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(path) );
|
||||
|
||||
CCData * data = CCData::dataWithContentsOfFile(fullpath);
|
||||
unsigned long nLen = 0;
|
||||
unsigned char* pData = CCFileUtils::sharedFileUtils()->getFileData(fullpath.c_str(), "rb", &nLen);
|
||||
|
||||
texture = new CCTexture2D();
|
||||
|
||||
if( texture->initWithPVRTCData(data->bytes(), 0, bpp, hasAlpha, width,
|
||||
if( texture->initWithPVRTCData(pData, 0, bpp, hasAlpha, width,
|
||||
(bpp==2 ? kCCTexture2DPixelFormat_PVRTC2 : kCCTexture2DPixelFormat_PVRTC4)))
|
||||
{
|
||||
m_pTextures->setObject(texture, temp.c_str());
|
||||
|
@ -851,7 +852,7 @@ void VolatileTexture::reloadAllTextures()
|
|||
else
|
||||
{
|
||||
unsigned long nSize;
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(vt->m_strFileName.c_str(), "rb", &nSize);
|
||||
unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(vt->m_strFileName.c_str(), "rb", &nSize);
|
||||
|
||||
|
||||
if (image.initWithImageData((void*)pBuffer, nSize, vt->m_FmtImage))
|
||||
|
|
|
@ -27,7 +27,6 @@ THE SOFTWARE.
|
|||
#include "CCTexture2D.h"
|
||||
#include "CCTexturePVR.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCData.h"
|
||||
#include "CCConfiguration.h"
|
||||
#include "support/ccUtils.h"
|
||||
#include "CCStdC.h"
|
||||
|
@ -402,7 +401,7 @@ bool CCTexturePVR::initWithContentsOfFile(const char* path)
|
|||
}
|
||||
else
|
||||
{
|
||||
pvrdata = CCFileUtils::sharedFileUtils()->sharedFileUtils()->getFileData(path, "rb", (unsigned long *)(&pvrlen));
|
||||
pvrdata = CCFileUtils::sharedFileUtils()->getFileData(path, "rb", (unsigned long *)(&pvrlen));
|
||||
}
|
||||
|
||||
if (pvrlen < 0)
|
||||
|
|
|
@ -33,9 +33,6 @@ THE SOFTWARE.
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
//Forward definition for CCData
|
||||
class CCData;
|
||||
|
||||
/**
|
||||
@brief Structure which can tell where mimap begins and how long is it
|
||||
*/
|
||||
|
|
|
@ -75,7 +75,7 @@ bool CCTMXLayer::initWithTilesetInfo(CCTMXTilesetInfo *tilesetInfo, CCTMXLayerIn
|
|||
m_uMinGID = layerInfo->m_uMinGID;
|
||||
m_uMaxGID = layerInfo->m_uMaxGID;
|
||||
m_cOpacity = layerInfo->m_cOpacity;
|
||||
setProperties(CCDictionary::dictionaryWithDictionary(layerInfo->getProperties()));
|
||||
setProperties(CCDictionary::createWithDictionary(layerInfo->getProperties()));
|
||||
m_fContentScaleFactor = CCDirector::sharedDirector()->getContentScaleFactor();
|
||||
|
||||
// tilesetInfo
|
||||
|
|
|
@ -35,7 +35,7 @@ CCTMXObjectGroup::CCTMXObjectGroup()
|
|||
:m_tPositionOffset(CCPointZero)
|
||||
,m_sGroupName("")
|
||||
{
|
||||
m_pObjects = CCArray::array();
|
||||
m_pObjects = CCArray::create();
|
||||
m_pObjects->retain();
|
||||
m_pProperties = new CCDictionary();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ THE SOFTWARE.
|
|||
#include <map>
|
||||
#include "CCTMXXMLParser.h"
|
||||
#include "CCTMXTiledMap.h"
|
||||
#include "CCData.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCFileUtils.h"
|
||||
#include "support/zip_support/ZipUtils.h"
|
||||
|
@ -150,10 +149,10 @@ CCTMXMapInfo * CCTMXMapInfo::formatWithXML(const char* tmxString, const char* re
|
|||
|
||||
void CCTMXMapInfo::internalInit(const char* tmxFileName, const char* resourcePath)
|
||||
{
|
||||
m_pTilesets = CCArray::array();
|
||||
m_pTilesets = CCArray::create();
|
||||
m_pTilesets->retain();
|
||||
|
||||
m_pLayers = CCArray::array();
|
||||
m_pLayers = CCArray::create();
|
||||
m_pLayers->retain();
|
||||
|
||||
if (tmxFileName != NULL)
|
||||
|
@ -166,7 +165,7 @@ void CCTMXMapInfo::internalInit(const char* tmxFileName, const char* resourcePat
|
|||
m_sResources = resourcePath;
|
||||
}
|
||||
|
||||
m_pObjectGroups = CCArray::arrayWithCapacity(4);
|
||||
m_pObjectGroups = CCArray::create(4);
|
||||
m_pObjectGroups->retain();
|
||||
|
||||
m_pProperties = new CCDictionary();
|
||||
|
@ -284,13 +283,6 @@ bool CCTMXMapInfo::parseXMLString(const char *xmlString)
|
|||
return parser.parse(xmlString, len);
|
||||
}
|
||||
|
||||
bool CCTMXMapInfo::parseXMLData(const CCData* data)
|
||||
{
|
||||
//TODO: implementation.
|
||||
CCAssert(false, "not implement!");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCTMXMapInfo::parseXMLFile(const char *xmlFilename)
|
||||
{
|
||||
CCSAXParser parser;
|
||||
|
|
|
@ -37,7 +37,6 @@ THE SOFTWARE.
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CCData;
|
||||
class CCTMXObjectGroup;
|
||||
|
||||
/** @file
|
||||
|
@ -181,8 +180,6 @@ public:
|
|||
bool parseXMLFile(const char *xmlFilename);
|
||||
/* initalises parsing of an XML string, either a tmx (Map) string or tsx (Tileset) string */
|
||||
bool parseXMLString(const char *xmlString);
|
||||
/* handles the work of parsing for parseXMLFile: and parseXMLString: */
|
||||
bool parseXMLData(const CCData* data);
|
||||
|
||||
CCDictionary* getTileProperties();
|
||||
void setTileProperties(CCDictionary* tileProperties);
|
||||
|
|
|
@ -157,7 +157,7 @@ void CCTileMapAtlas::setTile(const ccColor3B& tile, const ccGridSize& position)
|
|||
|
||||
// XXX: this method consumes a lot of memory
|
||||
// XXX: a tree of something like that shall be impolemented
|
||||
CCInteger *num = (CCInteger*)m_pPosToAtlasIndex->objectForKey(CCString::stringWithFormat("%d,%d", position.x, position.y)->getCString());
|
||||
CCInteger *num = (CCInteger*)m_pPosToAtlasIndex->objectForKey(CCString::createWithFormat("%d,%d", position.x, position.y)->getCString());
|
||||
this->updateAtlasValueAt(position, tile, num->getValue());
|
||||
}
|
||||
}
|
||||
|
@ -251,8 +251,8 @@ void CCTileMapAtlas::updateAtlasValues()
|
|||
{
|
||||
this->updateAtlasValueAt(ccg(x,y), value, total);
|
||||
|
||||
CCString *key = CCString::stringWithFormat("%d,%d", x,y);
|
||||
CCInteger *num = CCInteger::integerWithInt(total);
|
||||
CCString *key = CCString::createWithFormat("%d,%d", x,y);
|
||||
CCInteger *num = CCInteger::create(total);
|
||||
m_pPosToAtlasIndex->setObject(num, key->getCString());
|
||||
|
||||
total++;
|
||||
|
|
|
@ -67,11 +67,11 @@ void CCTouchDispatcher::setDispatchEvents(bool bDispatchEvents)
|
|||
bool CCTouchDispatcher::init(void)
|
||||
{
|
||||
m_bDispatchEvents = true;
|
||||
m_pTargetedHandlers = CCArray::arrayWithCapacity(8);
|
||||
m_pTargetedHandlers = CCArray::create(8);
|
||||
m_pTargetedHandlers->retain();
|
||||
m_pStandardHandlers = CCArray::arrayWithCapacity(4);
|
||||
m_pStandardHandlers = CCArray::create(4);
|
||||
m_pStandardHandlers->retain();
|
||||
m_pHandlersToAdd = CCArray::arrayWithCapacity(8);
|
||||
m_pHandlersToAdd = CCArray::create(8);
|
||||
m_pHandlersToAdd->retain();
|
||||
m_pHandlersToRemove = ccCArrayNew(8);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ bool CCControlButtonTest_HelloVariableSize::init()
|
|||
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// Defines an array of title to create buttons dynamically
|
||||
CCArray *stringArray = CCArray::arrayWithObjects(
|
||||
CCArray *stringArray = CCArray::create(
|
||||
ccs("Hello"),
|
||||
ccs("Variable"),
|
||||
ccs("Size"),
|
||||
|
@ -151,42 +151,42 @@ bool CCControlButtonTest_Event::init()
|
|||
|
||||
void CCControlButtonTest_Event::touchDownAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Touch Down")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Touch Down")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchDragInsideAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Drag Inside")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Drag Inside")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchDragOutsideAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Drag Outside")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Drag Outside")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchDragEnterAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Drag Enter")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Drag Enter")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchDragExitAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Drag Exit")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Drag Exit")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchUpInsideAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Touch Up Inside.")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Touch Up Inside.")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchUpOutsideAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Touch Up Outside.")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Touch Up Outside.")->getCString());
|
||||
}
|
||||
|
||||
void CCControlButtonTest_Event::touchCancelAction(CCObject *sender)
|
||||
{
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Touch Cancel")->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Touch Cancel")->getCString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ bool CCControlButtonTest_Styling::init()
|
|||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
// Add the buttons
|
||||
CCControlButton *button = standardButtonWithTitle(CCString::stringWithFormat("%d",rand() % 30)->getCString());
|
||||
CCControlButton *button = standardButtonWithTitle(CCString::createWithFormat("%d",rand() % 30)->getCString());
|
||||
button->setAdjustBackgroundImage(false); // Tells the button that the background image must not be adjust
|
||||
// It'll use the prefered size of the background image
|
||||
button->setPosition(ccp (button->getContentSize().width / 2 + (button->getContentSize().width + space) * i,
|
||||
|
|
|
@ -90,7 +90,7 @@ CCControlColourPickerTest::~CCControlColourPickerTest()
|
|||
void CCControlColourPickerTest::colourValueChanged(CCObject *sender)
|
||||
{
|
||||
CCControlColourPicker* pPicker = (CCControlColourPicker*)sender;
|
||||
m_pColorLabel->setString(CCString::stringWithFormat("#%02X%02X%02X",pPicker->getColorValue().r, pPicker->getColorValue().g, pPicker->getColorValue().b)->getCString());
|
||||
m_pColorLabel->setString(CCString::createWithFormat("#%02X%02X%02X",pPicker->getColorValue().r, pPicker->getColorValue().g, pPicker->getColorValue().b)->getCString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,6 +69,6 @@ void CCControlSliderTest::valueChanged(CCObject *sender)
|
|||
{
|
||||
CCControlSlider* pSlider = (CCControlSlider*)sender;
|
||||
// Change value of label.
|
||||
m_pDisplayValueLabel->setString(CCString::stringWithFormat("Slider value = %.02f", pSlider->getValue())->getCString());
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Slider value = %.02f", pSlider->getValue())->getCString());
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ void LabelAtlasColorTest::step(float dt)
|
|||
m_time += dt;
|
||||
char string[12] = {0};
|
||||
sprintf(string, "%2.2f Test", m_time);
|
||||
//std::string string = std::string::stringWithFormat("%2.2f Test", m_time);
|
||||
//std::string string = std::string::createWithFormat("%2.2f Test", m_time);
|
||||
CCLabelAtlas* label1 = (CCLabelAtlas*)getChildByTag(kTagSprite1);
|
||||
label1->setString(string);
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ const char* LabelTTFTest::getCurrentAlignment()
|
|||
break;
|
||||
}
|
||||
|
||||
return CCString::stringWithFormat("Alignment %s %s", vertical, horizontal)->getCString();
|
||||
return CCString::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString();
|
||||
}
|
||||
|
||||
string LabelTTFTest::title()
|
||||
|
@ -1390,7 +1390,7 @@ std::string BMFontOneAtlas::subtitle()
|
|||
/// BMFontUnicode
|
||||
BMFontUnicode::BMFontUnicode()
|
||||
{
|
||||
CCDictionary *strings = CCDictionary::dictionaryWithContentsOfFile("fonts/strings.xml");
|
||||
CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/strings.xml");
|
||||
const char *chinese = ((CCString*)strings->objectForKey("chinese1"))->m_sString.c_str();
|
||||
const char *japanese = ((CCString*)strings->objectForKey("japanese"))->m_sString.c_str();
|
||||
const char *spanish = ((CCString*)strings->objectForKey("spanish"))->m_sString.c_str();
|
||||
|
|
|
@ -376,7 +376,7 @@ void AddSpriteSheet::update(float dt)
|
|||
|
||||
if( totalToAdd > 0 )
|
||||
{
|
||||
CCArray* sprites = CCArray::arrayWithCapacity(totalToAdd);
|
||||
CCArray* sprites = CCArray::create(totalToAdd);
|
||||
int *zs = new int[totalToAdd];
|
||||
|
||||
// Don't include the sprite creation time and random as part of the profiling
|
||||
|
@ -440,7 +440,7 @@ void RemoveSpriteSheet::update(float dt)
|
|||
|
||||
if( totalToAdd > 0 )
|
||||
{
|
||||
CCArray* sprites = CCArray::arrayWithCapacity(totalToAdd);
|
||||
CCArray* sprites = CCArray::create(totalToAdd);
|
||||
|
||||
// Don't include the sprite creation time as part of the profiling
|
||||
for(int i=0;i<totalToAdd;i++)
|
||||
|
@ -500,7 +500,7 @@ void ReorderSpriteSheet::update(float dt)
|
|||
|
||||
if( totalToAdd > 0 )
|
||||
{
|
||||
CCArray* sprites = CCArray::arrayWithCapacity(totalToAdd);
|
||||
CCArray* sprites = CCArray::create(totalToAdd);
|
||||
|
||||
// Don't include the sprite creation time as part of the profiling
|
||||
for(int i=0;i<totalToAdd;i++)
|
||||
|
|
|
@ -475,7 +475,7 @@ bool SpriteBlur::initWithTexture(CCTexture2D* texture, const CCRect& rect)
|
|||
blur_ = ccp(1/s.width, 1/s.height);
|
||||
sub_[0] = sub_[1] = sub_[2] = sub_[3] = 0;
|
||||
|
||||
GLchar * fragSource = (GLchar*) CCString::stringWithContentsOfFile(
|
||||
GLchar * fragSource = (GLchar*) CCString::createWithContentsOfFile(
|
||||
CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_Blur.fsh"))->getCString();
|
||||
CCGLProgram* pProgram = new CCGLProgram();
|
||||
pProgram->initWithVertexShaderByteArray(ccPositionTextureColor_vert, fragSource);
|
||||
|
@ -630,7 +630,7 @@ bool ShaderRetroEffect::init()
|
|||
{
|
||||
if( ShaderTestDemo::init() ) {
|
||||
|
||||
GLchar * fragSource = (GLchar*) CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString();
|
||||
GLchar * fragSource = (GLchar*) CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("Shaders/example_HorizontalColor.fsh"))->getCString();
|
||||
CCGLProgram *p = new CCGLProgram();
|
||||
p->initWithVertexShaderByteArray(ccPositionTexture_vert, fragSource);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
6824810bc1cfa5dd0dbf72f9966524b82ebe0a52
|
||||
23a3acf70514939732acc9dab32c55a9bfddbc46
|
|
@ -1254,7 +1254,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
|
|||
string resources = "TileMaps"; // partial paths are OK as resource paths.
|
||||
string file = resources + "/orthogonal-test1.tmx";
|
||||
|
||||
CCString* str = CCString::stringWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str()));
|
||||
CCString* str = CCString::createWithContentsOfFile(CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(file.c_str()));
|
||||
CCAssert(str != NULL, "Unable to open file");
|
||||
|
||||
CCTMXTiledMap *map = CCTMXTiledMap::create(str->getCString() ,resources.c_str());
|
||||
|
|
|
@ -54,7 +54,7 @@ PongLayer::PongLayer()
|
|||
|
||||
CCTexture2D* paddleTexture = CCTextureCache::sharedTextureCache()->addImage(s_Paddle);
|
||||
|
||||
CCArray *paddlesM = CCArray::arrayWithCapacity(4);
|
||||
CCArray *paddlesM = CCArray::create(4);
|
||||
|
||||
Paddle* paddle = Paddle::paddleWithTexture(paddleTexture);
|
||||
paddle->setPosition( CCPointMake(m_tWinSize.width/2, 15) );
|
||||
|
|
Loading…
Reference in New Issue