More best practices fixes and other bug fixes

- Adds `CC_REQUIRES_NULL_TERMINATION` to methods that require a NULL at the end
- Removes more Hungarian notations in samples
- s/sprite/scene: fix from previous commit
- `CCLog` -> `log`
- `getLayerNamed` -> `getLayer`
- `getPropertyNamed` -> `getProperty`
- and other small fixes
This commit is contained in:
Ricardo Quesada 2013-07-23 15:20:22 -07:00
parent 2013f841ad
commit 1f37d4d00a
83 changed files with 663 additions and 633 deletions

View File

@ -92,7 +92,7 @@ class CC_DLL Sequence : public ActionInterval
{
public:
/** helper constructor to create an array of sequenceable actions */
static Sequence* create(FiniteTimeAction *pAction1, ...);
static Sequence* create(FiniteTimeAction *pAction1, ...) CC_REQUIRES_NULL_TERMINATION;
/** helper constructor to create an array of sequenceable actions given an array */
static Sequence* create(Array *arrayOfActions);
/** helper constructor to create an array of sequence-able actions */
@ -221,7 +221,7 @@ class CC_DLL Spawn : public ActionInterval
{
public:
/** helper constructor to create an array of spawned actions */
static Spawn* create(FiniteTimeAction *pAction1, ...);
static Spawn* create(FiniteTimeAction *pAction1, ...) CC_REQUIRES_NULL_TERMINATION;
/** helper constructor to create an array of spawned actions */
static Spawn* createWithVariableList(FiniteTimeAction *pAction1, va_list args);

View File

@ -117,7 +117,7 @@ public:
/** Create an array */
static Array* create();
/** Create an array with some objects */
static Array* create(Object* pObject, ...);
static Array* create(Object* pObject, ...) CC_REQUIRES_NULL_TERMINATION;
/** Create an array with one object */
static Array* createWithObject(Object* pObject);
/** Create an array with capacity */
@ -142,7 +142,7 @@ public:
/** Initializes an array with one object */
bool initWithObject(Object* pObject);
/** Initializes an array with some objects */
bool initWithObjects(Object* pObject, ...);
bool initWithObjects(Object* pObject, ...) CC_REQUIRES_NULL_TERMINATION;
/** Initializes an array with capacity */
bool initWithCapacity(unsigned int capacity);
/** Initializes an array with an existing array */

View File

@ -162,9 +162,9 @@ public:
*
* // Get the object for key
* String* pStr1 = (String*)pDict->objectForKey("key1");
* CCLog("{ key1: %s }", pStr1->getCString());
* log("{ key1: %s }", pStr1->getCString());
* Integer* pInteger = (Integer*)pDict->objectForKey("key3");
* CCLog("{ key3: %d }", pInteger->getValue());
* log("{ key3: %d }", pInteger->getValue());
* @endcode
*
*/

View File

@ -40,7 +40,7 @@ extern bool CC_DLL cc_assert_script_compatible(const char *msg);
#define CCASSERT(cond, msg) do { \
if (!(cond)) { \
if (!cc_assert_script_compatible(msg) && strlen(msg)) \
cocos2d::CCLog("Assert failed: %s", msg); \
cocos2d::log("Assert failed: %s", msg); \
CC_ASSERT(cond); \
} \
} while (0)
@ -238,7 +238,7 @@ It should work same as apples CFSwapInt32LittleToHost(..)
do { \
GLenum __error = glGetError(); \
if(__error) { \
CCLog("OpenGL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \
cocos2d::log("OpenGL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \
} \
} while (false)
#endif

View File

@ -60,7 +60,7 @@ public:
static Menu* create();
/** creates a Menu with MenuItem objects */
static Menu* create(MenuItem* item, ...);
static Menu* create(MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION;
/** creates a Menu with a Array of MenuItem objects */
static Menu* createWithArray(Array* pArrayOfItems);
@ -98,12 +98,12 @@ public:
void alignItemsHorizontallyWithPadding(float padding);
/** align items in rows of columns */
void alignItemsInColumns(int columns, ...);
void alignItemsInColumns(int columns, ...) CC_REQUIRES_NULL_TERMINATION;
void alignItemsInColumns(int columns, va_list args);
void alignItemsInColumnsWithArray(Array* rows);
/** align items in columns of rows */
void alignItemsInRows(int rows, ...);
void alignItemsInRows(int rows, ...) CC_REQUIRES_NULL_TERMINATION;
void alignItemsInRows(int rows, va_list args);
void alignItemsInRowsWithArray(Array* columns);

View File

@ -381,7 +381,7 @@ public:
/** creates a menu item from a Array with a callable object */
static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, Array* menuItems);
/** creates a menu item from a list of items with a callable object */
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...);
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION;
/** creates a menu item with no target/selector and no items */
static MenuItemToggle* create();
/** creates a menu item with a item */
@ -389,7 +389,7 @@ public:
/** creates a menu item from a Array with a target selector */
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
/** creates a menu item from a list of items with a target/selector */
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...);
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...)CC_REQUIRES_NULL_TERMINATION;
MenuItemToggle()
: _selectedIndex(0)

View File

@ -40,7 +40,10 @@ static const int kMaxLogLen = 16*1024;
/**
@brief Output Debug message.
*/
void CC_DLL CCLog(const char * pszFormat, ...) CC_FORMAT_PRINTF(1, 2);
void CC_DLL log(const char * pszFormat, ...) CC_FORMAT_PRINTF(1, 2);
/** use log() instead */
CC_DEPRECATED_ATTRIBUTE void CC_DLL CCLog(const char * pszFormat, ...) CC_FORMAT_PRINTF(1, 2);
/**
* lua can not deal with ...

View File

@ -306,7 +306,7 @@ bool Image::_initWithJpgData(void * data, int nSize)
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
*/
CCLog("%d", bRet);
log("%d", bRet);
jpeg_destroy_decompress(&cinfo);
break;
}

View File

@ -205,7 +205,7 @@ public: virtual void set##funName(varType var) \
#define CC_BREAK_IF(cond) if(cond) break
#define __CCLOGWITHFUNCTION(s, ...) \
CCLog("%s : %s",__FUNCTION__, String::createWithFormat(s, ##__VA_ARGS__)->getCString())
log("%s : %s",__FUNCTION__, String::createWithFormat(s, ##__VA_ARGS__)->getCString())
// cocos2d debug
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
@ -215,15 +215,15 @@ public: virtual void set##funName(varType var) \
#define CCLOGWARN(...) do {} while (0)
#elif COCOS2D_DEBUG == 1
#define CCLOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define CCLOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...) cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGINFO(format,...) do {} while (0)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#elif COCOS2D_DEBUG > 1
#define CCLOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define CCLOGINFO(format,...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define CCLOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGERROR(format,...) cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGINFO(format,...) cocos2d::log(format, ##__VA_ARGS__)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#endif // COCOS2D_DEBUG
@ -231,7 +231,7 @@ public: virtual void set##funName(varType var) \
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 || CC_LUA_ENGINE_DEBUG == 0
#define LUALOG(...)
#else
#define LUALOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__)
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
#endif // Lua engine debug
#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
@ -285,4 +285,17 @@ private: \
#define CC_UNUSED
#endif
//
// CC_REQUIRES_NULL_TERMINATION
//
#if !defined(CC_REQUIRES_NULL_TERMINATION)
#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 5549)
#define CC_REQUIRES_NULL_TERMINATION __attribute__((sentinel(0,1)))
#elif defined(__GNUC__)
#define CC_REQUIRES_NULL_TERMINATION __attribute__((sentinel))
#else
#define CC_REQUIRES_NULL_TERMINATION
#endif
#endif
#endif // __CC_PLATFORM_MACROS_H__

View File

@ -53,14 +53,14 @@ private:
bool XmlSaxHander::VisitEnter( const tinyxml2::XMLElement& element, const tinyxml2::XMLAttribute* firstAttribute )
{
//CCLog(" VisitEnter %s",element.Value());
//log(" VisitEnter %s",element.Value());
std::vector<const char*> attsVector;
for( const tinyxml2::XMLAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
{
//CCLog("%s", attrib->Name());
//log("%s", attrib->Name());
attsVector.push_back(attrib->Name());
//CCLog("%s",attrib->Value());
//log("%s",attrib->Value());
attsVector.push_back(attrib->Value());
}
@ -73,7 +73,7 @@ bool XmlSaxHander::VisitEnter( const tinyxml2::XMLElement& element, const tinyxm
}
bool XmlSaxHander::VisitExit( const tinyxml2::XMLElement& element )
{
//CCLog("VisitExit %s",element.Value());
//log("VisitExit %s",element.Value());
SAXParser::endElement(_ccsaxParserImp, (const CC_XML_CHAR *)element.Value());
return true;
@ -81,7 +81,7 @@ bool XmlSaxHander::VisitExit( const tinyxml2::XMLElement& element )
bool XmlSaxHander::Visit( const tinyxml2::XMLText& text )
{
//CCLog("Visit %s",text.Value());
//log("Visit %s",text.Value());
SAXParser::textHandler(_ccsaxParserImp, (const CC_XML_CHAR *)text.Value(), strlen(text.Value()));
return true;
}

View File

@ -31,7 +31,7 @@
NS_CC_BEGIN
void CCLog(const char * pszFormat, ...)
void log(const char * pszFormat, ...)
{
printf("Cocos2d: ");
char szBuf[kMaxLogLen+1] = {0};

View File

@ -32,6 +32,7 @@
NS_CC_BEGIN
// XXX deprecated
void CCLog(const char * pszFormat, ...)
{
printf("Cocos2d: ");
@ -46,6 +47,21 @@ void CCLog(const char * pszFormat, ...)
fflush(stdout);
}
void log(const char * pszFormat, ...)
{
printf("Cocos2d: ");
char szBuf[kMaxLogLen];
va_list ap;
va_start(ap, pszFormat);
vsnprintf(szBuf, kMaxLogLen, pszFormat, ap);
va_end(ap);
printf("%s", szBuf);
printf("\n");
fflush(stdout);
}
void LuaLog(const char * pszFormat)
{
puts(pszFormat);

View File

@ -91,7 +91,7 @@ void Profiler::displayTimers()
CCDICT_FOREACH(_activeTimers, pElement)
{
ProfilingTimer* timer = static_cast<ProfilingTimer*>(pElement->getObject());
CCLog("%s", timer->description());
log("%s", timer->description());
}
}

View File

@ -206,7 +206,7 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
}
// public
TMXLayer * TMXTiledMap::getLayerNamed(const char *layerName) const
TMXLayer * TMXTiledMap::getLayer(const char *layerName) const
{
CCASSERT(layerName != NULL && strlen(layerName) > 0, "Invalid layer name!");
Object* pObj = NULL;
@ -226,7 +226,7 @@ TMXLayer * TMXTiledMap::getLayerNamed(const char *layerName) const
return NULL;
}
TMXObjectGroup * TMXTiledMap::getObjectGroupNamed(const char *groupName) const
TMXObjectGroup * TMXTiledMap::getObjectGroup(const char *groupName) const
{
CCASSERT(groupName != NULL && strlen(groupName) > 0, "Invalid group name!");
@ -249,7 +249,7 @@ TMXObjectGroup * TMXTiledMap::getObjectGroupNamed(const char *groupName) const
return NULL;
}
String* TMXTiledMap::getPropertyNamed(const char *propertyName) const
String* TMXTiledMap::getProperty(const char *propertyName) const
{
return static_cast<String*>(_properties->objectForKey(propertyName));
}

View File

@ -88,21 +88,21 @@ Each layer is created using an TMXLayer (subclass of SpriteBatchNode). If you ha
unless the layer visibility is off. In that case, the layer won't be created at all.
You can obtain the layers (TMXLayer objects) at runtime by:
- map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer, etc...
- map->layerNamed(name_of_the_layer);
- map->getLayer(name_of_the_layer);
Each object group is created using a TMXObjectGroup which is a subclass of MutableArray.
You can obtain the object groups at runtime by:
- map->objectGroupNamed(name_of_the_object_group);
- map->getObjectGroup(name_of_the_object_group);
Each object is a TMXObject.
Each property is stored as a key-value pair in an MutableDictionary.
You can obtain the properties at runtime by:
map->propertyNamed(name_of_the_property);
layer->propertyNamed(name_of_the_property);
objectGroup->propertyNamed(name_of_the_property);
object->propertyNamed(name_of_the_property);
map->getProperty(name_of_the_property);
layer->getProperty(name_of_the_property);
objectGroup->getProperty(name_of_the_property);
object->getProperty(name_of_the_property);
@since v0.8.1
*/
@ -125,16 +125,16 @@ public:
bool initWithXML(const char* tmxString, const char* resourcePath);
/** return the TMXLayer for the specific layer */
TMXLayer* getLayerNamed(const char *layerName) const;
CC_DEPRECATED_ATTRIBUTE TMXLayer* layerNamed(const char *layerName) const { return getLayerNamed(layerName); };
TMXLayer* getLayer(const char *layerName) const;
CC_DEPRECATED_ATTRIBUTE TMXLayer* layerNamed(const char *layerName) const { return getLayer(layerName); };
/** return the TMXObjectGroup for the specific group */
TMXObjectGroup* getObjectGroupNamed(const char *groupName) const;
CC_DEPRECATED_ATTRIBUTE TMXObjectGroup* objectGroupNamed(const char *groupName) const { return getObjectGroupNamed(groupName); };
TMXObjectGroup* getObjectGroup(const char *groupName) const;
CC_DEPRECATED_ATTRIBUTE TMXObjectGroup* objectGroupNamed(const char *groupName) const { return getObjectGroup(groupName); };
/** return the value for the specific property name */
String *getPropertyNamed(const char *propertyName) const;
CC_DEPRECATED_ATTRIBUTE String *propertyNamed(const char *propertyName) const { return getPropertyNamed(propertyName); };
String *getProperty(const char *propertyName) const;
CC_DEPRECATED_ATTRIBUTE String *propertyNamed(const char *propertyName) const { return getProperty(propertyName); };
/** return properties dictionary for tile GID */
Dictionary* getPropertiesForGID(int GID) const;

View File

@ -157,7 +157,7 @@ Color4B Texture2DMutable::pixelAt(const Point& pt)
c.b = 255;
}
//CCLog("color : %i, %i, %i, %i", c.r, c.g, c.b, c.a);
//log("color : %i, %i, %i, %i", c.r, c.g, c.b, c.a);
return c;
}

View File

@ -92,7 +92,7 @@ void SpriteFrameCacheHelper::addSpriteFrameFromDict(Dictionary *dictionary, Text
_display2ImageMap[spriteFrameName] = imagePath;
//CCLog("spriteFrameName : %s, imagePath : %s", spriteFrameName.c_str(), _imagePath);
//log("spriteFrameName : %s, imagePath : %s", spriteFrameName.c_str(), _imagePath);
SpriteFrame *spriteFrame = (SpriteFrame *)SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName.c_str());
if (spriteFrame)

View File

@ -382,7 +382,7 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
}
else
{
CCLog("CCBReader: Failed to create animation for property: %s", pPropName);
log("CCBReader: Failed to create animation for property: %s", pPropName);
}
return NULL;
@ -482,7 +482,7 @@ void CCBAnimationManager::setAnimatedProperty(const char *pPropName, Node *pNode
}
else
{
CCLog("unsupported property name is %s", pPropName);
log("unsupported property name is %s", pPropName);
CCASSERT(false, "unsupported property now");
}
}
@ -573,7 +573,7 @@ ActionInterval* CCBAnimationManager::getEaseAction(ActionInterval *pAction, int
}
else
{
CCLog("CCBReader: Unkown easing type %d", nEasingType);
log("CCBReader: Unkown easing type %d", nEasingType);
return pAction;
}
}

View File

@ -396,7 +396,7 @@ bool CCBReader::readHeader()
/* Read version. */
int version = this->readInt(false);
if(version != kCCBVersion) {
CCLog("WARNING! Incompatible ccbi file version (file: %d reader: %d)", version, kCCBVersion);
log("WARNING! Incompatible ccbi file version (file: %d reader: %d)", version, kCCBVersion);
return false;
}
@ -563,7 +563,7 @@ Node * CCBReader::readNodeGraph(Node * pParent) {
if (! ccNodeLoader)
{
CCLog("no corresponding node loader for %s", className.c_str());
log("no corresponding node loader for %s", className.c_str());
return NULL;
}

View File

@ -437,7 +437,7 @@ Size NodeLoader::parsePropTypeSize(Node * pNode, Node * pParent, CCBReader * pCC
}
default:
{
CCLog("Unknown CCB type.");
log("Unknown CCB type.");
}
break;
}

View File

@ -20,8 +20,8 @@ NS_CC_EXT_BEGIN
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
#define PROPERTY_VISIBLE "visible"
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLog("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) cocos2d::log("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) cocos2d::log("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
return T::create(); \

View File

@ -160,7 +160,7 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
// If there is no specified center region
if ( _capInsetsInternal.equals(Rect::ZERO) )
{
// CCLog("... cap insets not specified : using default cap insets ...");
// log("... cap insets not specified : using default cap insets ...");
_capInsetsInternal = Rect(w/3, h/3, w/3, h/3);
}
@ -223,7 +223,7 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
Rect rightbottombounds = Rect(x, y, right_w, bottom_h);
if (!rotated) {
// CCLog("!rotated");
// log("!rotated");
AffineTransform t = AffineTransformMakeIdentity();
t = AffineTransformTranslate(t, rect.origin.x, rect.origin.y);
@ -286,7 +286,7 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, Rect rect, bo
// set up transformation of coordinates
// to handle the case where the sprite is stored rotated
// in the spritesheet
// CCLog("rotated");
// log("rotated");
AffineTransform t = AffineTransformMakeIdentity();
@ -611,7 +611,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const char* spriteFrameNam
}
CC_SAFE_DELETE(pReturn);
CCLog("Could not allocate Scale9Sprite()");
log("Could not allocate Scale9Sprite()");
return NULL;
}

View File

@ -494,18 +494,18 @@ void TableView::scrollViewDidScroll(ScrollView* view)
CCARRAY_FOREACH(_cellsUsed, pObj)
{
TableViewCell* pCell = static_cast<TableViewCell*>(pObj);
CCLog("cells Used index %d, value = %d", i, pCell->getIdx());
log("cells Used index %d, value = %d", i, pCell->getIdx());
i++;
}
CCLog("---------------------------------------");
log("---------------------------------------");
i = 0;
CCARRAY_FOREACH(_cellsFreed, pObj)
{
TableViewCell* pCell = static_cast<TableViewCell*>(pObj);
CCLog("cells freed index %d, value = %d", i, pCell->getIdx());
log("cells freed index %d, value = %d", i, pCell->getIdx());
i++;
}
CCLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
#endif
if (_cellsUsed->count() > 0)

View File

@ -477,7 +477,7 @@ void HttpClient::send(HttpRequest* request)
// Poll and notify main thread if responses exists in queue
void HttpClient::dispatchResponseCallbacks(float delta)
{
// CCLog("CCHttpClient::dispatchResponseCallbacks is running");
// log("CCHttpClient::dispatchResponseCallbacks is running");
HttpResponse* response = NULL;

View File

@ -114,7 +114,7 @@ SIOClientImpl::~SIOClientImpl() {
}
void SIOClientImpl::handshake() {
CCLog("SIOClientImpl::handshake() called");
log("SIOClientImpl::handshake() called");
std::stringstream pre;
pre << "http://" << _uri << "/socket.io/1";
@ -126,7 +126,7 @@ void SIOClientImpl::handshake() {
request->setResponseCallback(this, httpresponse_selector(SIOClientImpl::handshakeResponse));
request->setTag("handshake");
CCLog("SIOClientImpl::handshake() waiting");
log("SIOClientImpl::handshake() waiting");
HttpClient::getInstance()->send(request);
@ -137,22 +137,22 @@ void SIOClientImpl::handshake() {
void SIOClientImpl::handshakeResponse(HttpClient *sender, HttpResponse *response) {
CCLog("SIOClientImpl::handshakeResponse() called");
log("SIOClientImpl::handshakeResponse() called");
if (0 != strlen(response->getHttpRequest()->getTag()))
{
CCLog("%s completed", response->getHttpRequest()->getTag());
log("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
CCLog("response code: %d", statusCode);
log("response code: %d", statusCode);
if (!response->isSucceed())
{
CCLog("SIOClientImpl::handshake() failed");
CCLog("error buffer: %s", response->getErrorBuffer());
log("SIOClientImpl::handshake() failed");
log("error buffer: %s", response->getErrorBuffer());
DictElement* el = NULL;
@ -167,7 +167,7 @@ void SIOClientImpl::handshakeResponse(HttpClient *sender, HttpResponse *response
return;
}
CCLog("SIOClientImpl::handshake() succeeded");
log("SIOClientImpl::handshake() succeeded");
std::vector<char> *buffer = response->getResponseData();
std::stringstream s;
@ -177,7 +177,7 @@ void SIOClientImpl::handshakeResponse(HttpClient *sender, HttpResponse *response
s << (*buffer)[i];
}
CCLog("SIOClientImpl::handshake() dump data: %s", s.str().c_str());
log("SIOClientImpl::handshake() dump data: %s", s.str().c_str());
std::string res = s.str();
std::string sid;
@ -212,7 +212,7 @@ void SIOClientImpl::handshakeResponse(HttpClient *sender, HttpResponse *response
void SIOClientImpl::openSocket() {
CCLog("SIOClientImpl::openSocket() called");
log("SIOClientImpl::openSocket() called");
std::stringstream s;
s << _uri << "/socket.io/1/websocket/" << _sid;
@ -228,7 +228,7 @@ void SIOClientImpl::openSocket() {
bool SIOClientImpl::init() {
CCLog("SIOClientImpl::init() successful");
log("SIOClientImpl::init() successful");
return true;
}
@ -247,7 +247,7 @@ void SIOClientImpl::disconnect() {
_ws->send(s);
CCLog("Disconnect sent");
log("Disconnect sent");
_ws->close();
@ -303,7 +303,7 @@ void SIOClientImpl::disconnectFromEndpoint(const std::string& endpoint) {
if(_clients->count() == 0 || endpoint == "/") {
CCLog("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect");
log("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect");
if(_connected) this->disconnect();
@ -325,7 +325,7 @@ void SIOClientImpl::heartbeat(float dt) {
_ws->send(s);
CCLog("Heartbeat sent");
log("Heartbeat sent");
}
@ -339,7 +339,7 @@ void SIOClientImpl::send(std::string endpoint, std::string s) {
std::string msg = pre.str();
CCLog("sending message: %s", msg.c_str());
log("sending message: %s", msg.c_str());
_ws->send(msg);
@ -355,7 +355,7 @@ void SIOClientImpl::emit(std::string endpoint, std::string eventname, std::strin
std::string msg = pre.str();
CCLog("emitting event with data: %s", msg.c_str());
log("emitting event with data: %s", msg.c_str());
_ws->send(msg);
@ -379,13 +379,13 @@ void SIOClientImpl::onOpen(cocos2d::extension::WebSocket* ws) {
Director::getInstance()->getScheduler()->scheduleSelector(schedule_selector(SIOClientImpl::heartbeat), this, (_heartbeat * .9), false);
CCLog("SIOClientImpl::onOpen socket connected!");
log("SIOClientImpl::onOpen socket connected!");
}
void SIOClientImpl::onMessage(cocos2d::extension::WebSocket* ws, const cocos2d::extension::WebSocket::Data& data) {
CCLog("SIOClientImpl::onMessage received: %s", data.bytes);
log("SIOClientImpl::onMessage received: %s", data.bytes);
int control = atoi(&data.bytes[0]);
@ -422,31 +422,31 @@ void SIOClientImpl::onMessage(cocos2d::extension::WebSocket* ws, const cocos2d::
s_data = payload;
SIOClient *c = NULL;
c = getClient(endpoint);
if(c == NULL) CCLog("SIOClientImpl::onMessage client lookup returned NULL");
if(c == NULL) log("SIOClientImpl::onMessage client lookup returned NULL");
switch(control) {
case 0:
CCLog("Received Disconnect Signal for Endpoint: %s\n", endpoint.c_str());
log("Received Disconnect Signal for Endpoint: %s\n", endpoint.c_str());
if(c) c->receivedDisconnect();
disconnectFromEndpoint(endpoint);
break;
case 1:
CCLog("Connected to endpoint: %s \n",endpoint.c_str());
log("Connected to endpoint: %s \n",endpoint.c_str());
if(c) c->onConnect();
break;
case 2:
CCLog("Heartbeat received\n");
log("Heartbeat received\n");
break;
case 3:
CCLog("Message received: %s \n", s_data.c_str());
log("Message received: %s \n", s_data.c_str());
if(c) c->getDelegate()->onMessage(c, s_data);
break;
case 4:
CCLog("JSON Message Received: %s \n", s_data.c_str());
log("JSON Message Received: %s \n", s_data.c_str());
if(c) c->getDelegate()->onMessage(c, s_data);
break;
case 5:
CCLog("Event Received with data: %s \n", s_data.c_str());
log("Event Received with data: %s \n", s_data.c_str());
if(c) {
eventname = "";
@ -463,14 +463,14 @@ void SIOClientImpl::onMessage(cocos2d::extension::WebSocket* ws, const cocos2d::
break;
case 6:
CCLog("Message Ack\n");
log("Message Ack\n");
break;
case 7:
CCLog("Error\n");
log("Error\n");
if(c) c->getDelegate()->onError(c, s_data);
break;
case 8:
CCLog("Noop\n");
log("Noop\n");
break;
}
@ -590,7 +590,7 @@ void SIOClient::on(const std::string& eventName, SIOEvent e) {
void SIOClient::fireEvent(const std::string& eventName, const std::string& data) {
CCLog("SIOClient::fireEvent called with event name: %s and data: %s", eventName.c_str(), data.c_str());
log("SIOClient::fireEvent called with event name: %s and data: %s", eventName.c_str(), data.c_str());
if(_eventRegistry[eventName]) {
@ -601,7 +601,7 @@ void SIOClient::fireEvent(const std::string& eventName, const std::string& data)
return;
}
CCLog("SIOClient::fireEvent no event with name %s found", eventName.c_str());
log("SIOClient::fireEvent no event with name %s found", eventName.c_str());
}

View File

@ -20,16 +20,16 @@ AppDelegate::~AppDelegate()
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
Director* director = Director::getInstance();
EGLView* pEGLView = EGLView::getInstance();
EGLView* glView = EGLView::getInstance();
director->setOpenGLView(pEGLView);
director->setOpenGLView(glView);
Size size = director->getWinSize();
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
Size frameSize = pEGLView->getFrameSize();
Size frameSize = glView->getFrameSize();
vector<string> searchPath;

View File

@ -36,18 +36,18 @@ bool HelloWorld::init()
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
MenuItemImage *pCloseItem = MenuItemImage::create(
MenuItemImage *closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(HelloWorld::menuCloseCallback,this));
pCloseItem->setPosition(Point(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
closeItem->setPosition(Point(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
origin.y + closeItem->getContentSize().height/2));
// create menu, it's an autorelease object
Menu* pMenu = Menu::create(pCloseItem, NULL);
pMenu->setPosition(Point::ZERO);
this->addChild(pMenu, 1);
Menu* menu = Menu::create(closeItem, NULL);
menu->setPosition(Point::ZERO);
this->addChild(menu, 1);
/////////////////////////////
// 3. add your codes below...
@ -55,23 +55,23 @@ bool HelloWorld::init()
// add a label shows "Hello World"
// create and initialize a label
LabelTTF* pLabel = LabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
LabelTTF* label = LabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
// position the label on the center of the screen
pLabel->setPosition(Point(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - pLabel->getContentSize().height));
label->setPosition(Point(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - label->getContentSize().height));
// add the label as a child to this layer
this->addChild(pLabel, 1);
this->addChild(label, 1);
// add "HelloWorld" splash screen"
Sprite* scene = Sprite::create("HelloWorld.png");
Sprite* sprite = Sprite::create("HelloWorld.png");
// position the sprite on the center of the screen
scene->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(scene, 0);
this->addChild(sprite, 0);
return true;
}

View File

@ -69,26 +69,26 @@ bool HelloWorld::init()
// 1. Add a menu item with "X" image, which is clicked to quit the program.
// Create a "close" menu item with close icon, it's an auto release object.
MenuItemImage *pCloseItem = MenuItemImage::create(
MenuItemImage *closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(HelloWorld::menuCloseCallback,this));
CC_BREAK_IF(! pCloseItem);
CC_BREAK_IF(! closeItem);
// Place the menu item bottom-right conner.
Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin();
pCloseItem->setPosition(Point(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2,
origin.y + pCloseItem->getContentSize().height/2));
closeItem->setPosition(Point(origin.x + visibleSize.width - closeItem->getContentSize().width/2,
origin.y + closeItem->getContentSize().height/2));
// Create a menu with the "close" menu item, it's an auto release object.
Menu* pMenu = Menu::create(pCloseItem, NULL);
pMenu->setPosition(Point::ZERO);
CC_BREAK_IF(! pMenu);
Menu* menu = Menu::create(closeItem, NULL);
menu->setPosition(Point::ZERO);
CC_BREAK_IF(! menu);
// Add the menu to HelloWorld layer as a child layer.
this->addChild(pMenu, 1);
this->addChild(menu, 1);
/////////////////////////////
// 2. add your codes below...
@ -193,7 +193,7 @@ void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
Touch* touch = (Touch*)( touches->anyObject() );
Point location = touch->getLocation();
CCLog("++++++++after x:%f, y:%f", location.x, location.y);
log("++++++++after x:%f, y:%f", location.x, location.y);
// Set up initial location of projectile
Size winSize = Director::getInstance()->getVisibleSize();

View File

@ -117,7 +117,7 @@ void CrashTest::onEnter()
{
ActionManagerTest::onEnter();
Sprite* child = Sprite::create(s_pPathGrossini);
Sprite* child = Sprite::create(s_pathGrossini);
child->setPosition( VisibleRect::center() );
addChild(child, 1);
@ -158,7 +158,7 @@ void LogicTest::onEnter()
{
ActionManagerTest::onEnter();
Sprite* grossini = Sprite::create(s_pPathGrossini);
Sprite* grossini = Sprite::create(s_pathGrossini);
addChild(grossini, 0, 2);
grossini->setPosition(VisibleRect::center());
@ -203,7 +203,7 @@ void PauseTest::onEnter()
//
// Also, this test MUST be done, after [super onEnter]
//
Sprite* grossini = Sprite::create(s_pPathGrossini);
Sprite* grossini = Sprite::create(s_pathGrossini);
addChild(grossini, 0, kTagGrossini);
grossini->setPosition(VisibleRect::center() );
@ -246,7 +246,7 @@ void RemoveTest::onEnter()
ActionInterval* pSequence = Sequence::create(pMove, pCallback, NULL);
pSequence->setTag(kTagSequence);
Sprite* pChild = Sprite::create(s_pPathGrossini);
Sprite* pChild = Sprite::create(s_pathGrossini);
pChild->setPosition( VisibleRect::center() );
addChild(pChild, 1, kTagGrossini);
@ -255,8 +255,8 @@ void RemoveTest::onEnter()
void RemoveTest::stopAction()
{
Node* scene = getChildByTag(kTagGrossini);
scene->stopActionByTag(kTagSequence);
Node* sprite = getChildByTag(kTagGrossini);
sprite->stopActionByTag(kTagSequence);
}
std::string RemoveTest::title()
@ -282,7 +282,7 @@ void ResumeTest::onEnter()
addChild(l);
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 75));
Sprite* pGrossini = Sprite::create(s_pPathGrossini);
Sprite* pGrossini = Sprite::create(s_pathGrossini);
addChild(pGrossini, 0, kTagGrossini);
pGrossini->setPosition(VisibleRect::center());

View File

@ -609,9 +609,9 @@ void EaseSpriteDemo::onEnter()
BaseTest::onEnter();
// Or you can create an sprite using a filename. PNG and BMP files are supported. Probably TIFF too
_grossini = Sprite::create(s_pPathGrossini); _grossini->retain();
_tamara = Sprite::create(s_pPathSister1); _tamara->retain();
_kathia = Sprite::create(s_pPathSister2); _kathia->retain();
_grossini = Sprite::create(s_pathGrossini); _grossini->retain();
_tamara = Sprite::create(s_pathSister1); _tamara->retain();
_kathia = Sprite::create(s_pathSister2); _kathia->retain();
addChild( _grossini, 3);
addChild( _kathia, 2);

View File

@ -135,13 +135,13 @@ void SpriteProgressToRadial::onEnter()
ProgressTo *to1 = ProgressTo::create(2, 100);
ProgressTo *to2 = ProgressTo::create(2, 100);
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathSister1));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1));
left->setType( kProgressTimerTypeRadial );
addChild(left);
left->setPosition(Point(100, s.height/2));
left->runAction( RepeatForever::create(to1));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathBlock));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathBlock));
right->setType(kProgressTimerTypeRadial);
// Makes the ridial CCW
right->setReverseProgress(true);
@ -170,7 +170,7 @@ void SpriteProgressToHorizontal::onEnter()
ProgressTo *to1 = ProgressTo::create(2, 100);
ProgressTo *to2 = ProgressTo::create(2, 100);
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathSister1));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1));
left->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the left since the midpoint is 0 for the x
left->setMidpoint(Point(0,0));
@ -180,7 +180,7 @@ void SpriteProgressToHorizontal::onEnter()
left->setPosition(Point(100, s.height/2));
left->runAction( RepeatForever::create(to1));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2));
right->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the left since the midpoint is 1 for the x
right->setMidpoint(Point(1, 0));
@ -210,7 +210,7 @@ void SpriteProgressToVertical::onEnter()
ProgressTo *to1 = ProgressTo::create(2, 100);
ProgressTo *to2 = ProgressTo::create(2, 100);
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathSister1));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1));
left->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
@ -221,7 +221,7 @@ void SpriteProgressToVertical::onEnter()
left->setPosition(Point(100, s.height/2));
left->runAction( RepeatForever::create(to1));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2));
right->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
right->setMidpoint(Point(0, 1));
@ -253,7 +253,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
/**
* Our image on the left should be a radial progress indicator, clockwise
*/
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathBlock));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathBlock));
left->setType(kProgressTimerTypeRadial);
addChild(left);
left->setMidpoint(Point(0.25f, 0.75f));
@ -263,7 +263,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
/**
* Our image on the left should be a radial progress indicator, counter clockwise
*/
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathBlock));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathBlock));
right->setType(kProgressTimerTypeRadial);
right->setMidpoint(Point(0.75f, 0.25f));
@ -294,7 +294,7 @@ void SpriteProgressBarVarious::onEnter()
ProgressTo *to = ProgressTo::create(2, 100);
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathSister1));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1));
left->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
@ -305,7 +305,7 @@ void SpriteProgressBarVarious::onEnter()
left->setPosition(Point(100, s.height/2));
left->runAction(RepeatForever::create(to->clone()));
ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pathSister2));
middle->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle->setMidpoint(Point(0.5f, 0.5f));
@ -315,7 +315,7 @@ void SpriteProgressBarVarious::onEnter()
middle->setPosition(Point(s.width/2, s.height/2));
middle->runAction(RepeatForever::create(to->clone()));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2));
right->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
right->setMidpoint(Point(0.5f, 0.5f));
@ -351,7 +351,7 @@ void SpriteProgressBarTintAndFade::onEnter()
FadeTo::create(1.0f, 255),
NULL);
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pPathSister1));
ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1));
left->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
@ -365,7 +365,7 @@ void SpriteProgressBarTintAndFade::onEnter()
left->addChild(LabelTTF::create("Tint", "Marker Felt", 20.0f));
ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pathSister2));
middle->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle->setMidpoint(Point(0.5f, 0.5f));
@ -378,7 +378,7 @@ void SpriteProgressBarTintAndFade::onEnter()
middle->addChild(LabelTTF::create("Fade", "Marker Felt", 20.0f));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pPathSister2));
ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2));
right->setType(kProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
right->setMidpoint(Point(0.5f, 0.5f));

View File

@ -115,13 +115,13 @@ void ActionsDemo::onEnter()
BaseTest::onEnter();
// Or you can create an sprite using a filename. only PNG is supported now. Probably TIFF too
_grossini = Sprite::create(s_pPathGrossini);
_grossini = Sprite::create(s_pathGrossini);
_grossini->retain();
_tamara = Sprite::create(s_pPathSister1);
_tamara = Sprite::create(s_pathSister1);
_tamara->retain();
_kathia = Sprite::create(s_pPathSister2);
_kathia = Sprite::create(s_pathSister2);
_kathia->retain();
addChild(_grossini, 1);
@ -1510,7 +1510,6 @@ void ActionCatmullRomStacked::onEnter()
_tamara->runAction(seq);
_tamara->runAction(
RepeatForever::create(
Sequence::create(
@ -1547,7 +1546,6 @@ void ActionCatmullRomStacked::onEnter()
MoveBy::create(0.05f, Point(-10,0)),
NULL)));
array->retain();
_array1 = array;
array2->retain();
@ -1704,7 +1702,7 @@ void Issue1305::onEnter()
void Issue1305::log(Node* pSender)
{
CCLog("This message SHALL ONLY appear when the sprite is added to the scene, NOT BEFORE");
cocos2d::log("This message SHALL ONLY appear when the sprite is added to the scene, NOT BEFORE");
}
void Issue1305::onExit()
@ -1775,22 +1773,22 @@ void Issue1305_2::onEnter()
void Issue1305_2::printLog1()
{
CCLog("1st block");
log("1st block");
}
void Issue1305_2::printLog2()
{
CCLog("2nd block");
log("2nd block");
}
void Issue1305_2::printLog3()
{
CCLog("3rd block");
log("3rd block");
}
void Issue1305_2::printLog4()
{
CCLog("4th block");
log("4th block");
}
std::string Issue1305_2::title()
@ -1889,14 +1887,14 @@ std::string Issue1327::subtitle()
void Issue1327::logSprRotation(Sprite* pSender)
{
CCLog("%f", pSender->getRotation());
log("%f", pSender->getRotation());
}
//Issue1398
void Issue1398::incrementInteger()
{
_testInteger++;
CCLog("incremented to %d", _testInteger);
log("incremented to %d", _testInteger);
}
void Issue1398::onEnter()
@ -1905,7 +1903,7 @@ void Issue1398::onEnter()
this->centerSprites(0);
_testInteger = 0;
CCLog("testInt = %d", _testInteger);
log("testInt = %d", _testInteger);
this->runAction(
Sequence::create(
@ -1923,7 +1921,7 @@ void Issue1398::onEnter()
void Issue1398::incrementIntegerCallback(void* data)
{
this->incrementInteger();
CCLog("%s", (char*)data);
log("%s", (char*)data);
}
std::string Issue1398::subtitle()
@ -2153,7 +2151,7 @@ string PauseResumeActions::subtitle()
void PauseResumeActions::pause(float dt)
{
CCLog("Pausing");
log("Pausing");
Director *director = Director::getInstance();
CC_SAFE_RELEASE(_pausedTargets);
@ -2163,7 +2161,7 @@ void PauseResumeActions::pause(float dt)
void PauseResumeActions::resume(float dt)
{
CCLog("Resuming");
log("Resuming");
Director *director = Director::getInstance();
director->getActionManager()->resumeTargets(_pausedTargets);
}

View File

@ -34,9 +34,9 @@ void BaseTest::onEnter()
// add menu
// CC_CALLBACK_1 == std::bind( function_ptr, instance, std::placeholders::_1, ...)
MenuItemImage *item1 = MenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(BaseTest::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(BaseTest::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(BaseTest::nextCallback, this) );
MenuItemImage *item1 = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(BaseTest::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(BaseTest::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(BaseTest::nextCallback, this) );
Menu *menu = Menu::create(item1, item2, item3, NULL);
@ -66,15 +66,15 @@ std::string BaseTest::subtitle()
void BaseTest::restartCallback(Object* pSender)
{
CCLog("override restart!");
log("override restart!");
}
void BaseTest::nextCallback(Object* pSender)
{
CCLog("override next!");
log("override next!");
}
void BaseTest::backCallback(Object* pSender)
{
CCLog("override back!");
log("override back!");
}

View File

@ -44,13 +44,13 @@ Box2DTestLayer::Box2DTestLayer()
scheduleUpdate();
#else
LabelTTF *pLabel = LabelTTF::create("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case",
LabelTTF *label = LabelTTF::create("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case",
"Arial",
18);
Size size = Director::getInstance()->getWinSize();
pLabel->setPosition(Point(size.width/2, size.height/2));
label->setPosition(Point(size.width/2, size.height/2));
addChild(pLabel);
addChild(label);
#endif
}

View File

@ -23,7 +23,7 @@ int check_for_error( Point p1, Point p2, Point p3, Point p4, float s, float t )
// Since float has rounding errors, only check if diff is < 0.05
if( (fabs( hitPoint1.x - hitPoint2.x) > 0.1f) || ( fabs(hitPoint1.y - hitPoint2.y) > 0.1f) )
{
CCLog("ERROR: (%f,%f) != (%f,%f)", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y);
log("ERROR: (%f,%f) != (%f,%f)", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y);
return 1;
}
@ -46,7 +46,7 @@ bool Bug1174Layer::init()
//
// Test 1.
//
CCLog("Test1 - Start");
log("Test1 - Start");
for( int i=0; i < 10000; i++)
{
// A | b
@ -84,12 +84,12 @@ bool Bug1174Layer::init()
ok++;
}
}
CCLog("Test1 - End. OK=%i, Err=%i", ok, err);
log("Test1 - End. OK=%i, Err=%i", ok, err);
//
// Test 2.
//
CCLog("Test2 - Start");
log("Test2 - Start");
p1 = Point(220,480);
p2 = Point(304,325);
@ -100,13 +100,13 @@ bool Bug1174Layer::init()
if( Point::isLineIntersect(p1, p2, p3, p4, &s, &t) )
check_for_error(p1, p2, p3, p4, s,t );
CCLog("Test2 - End");
log("Test2 - End");
//
// Test 3
//
CCLog("Test3 - Start");
log("Test3 - Start");
ok=0;
err=0;
@ -153,7 +153,7 @@ bool Bug1174Layer::init()
}
}
CCLog("Test3 - End. OK=%i, err=%i", ok, err);
log("Test3 - End. OK=%i, err=%i", ok, err);
return true;
}

View File

@ -27,12 +27,12 @@ void Bug422Layer::reset()
// and then a new node will be allocated occupying the memory.
// => CRASH BOOM BANG
Node *node = getChildByTag(localtag-1);
CCLog("Menu: %p", node);
log("Menu: %p", node);
removeChild(node, false);
// [self removeChildByTag:localtag-1 cleanup:NO];
MenuItem *item1 = MenuItemFont::create("One", CC_CALLBACK_1(Bug422Layer::menuCallback, this) );
CCLog("MenuItemFont: %p", item1);
log("MenuItemFont: %p", item1);
MenuItem *item2 = MenuItemFont::create("Two", CC_CALLBACK_1(Bug422Layer::menuCallback, this) );
Menu *menu = Menu::create(item1, item2, NULL);
menu->alignItemsVertically();
@ -53,7 +53,7 @@ void Bug422Layer::check(Node* t)
{
CC_BREAK_IF(! pChild);
Node* node = static_cast<Node*>(pChild);
CCLog("%p, rc: %d", node, node->retainCount());
log("%p, rc: %d", node, node->retainCount());
check(node);
}
}

View File

@ -42,5 +42,5 @@ bool Bug458Layer::init()
void Bug458Layer::selectAnswer(Object* sender)
{
CCLog("Selected");
log("Selected");
}

View File

@ -30,7 +30,7 @@ bool QuestionContainerSprite::init()
label->setColor(Color3B::BLUE);
else
{
CCLog("Color changed");
log("Color changed");
label->setColor(Color3B::RED);
}
a++;

View File

@ -39,7 +39,7 @@ void Bug624Layer::switchLayer(float dt)
void Bug624Layer::didAccelerate(Acceleration* acceleration)
{
CCLog("Layer1 accel");
log("Layer1 accel");
}
////////////////////////////////////////////////////////
@ -76,5 +76,5 @@ void Bug624Layer2::switchLayer(float dt)
void Bug624Layer2::didAccelerate(Acceleration* acceleration)
{
CCLog("Layer2 accel");
log("Layer2 accel");
}

View File

@ -65,7 +65,7 @@ bool Bug914Layer::init()
void Bug914Layer::ccTouchesMoved(Set *touches, Event * event)
{
CCLog("Number of touches: %d", touches->count());
log("Number of touches: %d", touches->count());
}
void Bug914Layer::ccTouchesBegan(Set *touches, Event * event)

View File

@ -117,9 +117,9 @@ void BugsTestBaseLayer::onEnter()
MenuItemFont::setFontSize(24);
MenuItemFont* pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTestBaseLayer::backCallback, this));
pMainItem->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
Menu* pMenu = Menu::create(pMainItem, NULL);
pMenu->setPosition( Point::ZERO );
addChild(pMenu);
Menu* menu = Menu::create(pMainItem, NULL);
menu->setPosition( Point::ZERO );
addChild(menu);
}
void BugsTestBaseLayer::backCallback(Object* pSender)

View File

@ -58,13 +58,13 @@ ChipmunkTestLayer::ChipmunkTestLayer()
scheduleUpdate();
#else
LabelTTF *pLabel = LabelTTF::create("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case",
LabelTTF *label = LabelTTF::create("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case",
"Arial",
18);
Size size = Director::getInstance()->getWinSize();
pLabel->setPosition(Point(size.width/2, size.height/2));
label->setPosition(Point(size.width/2, size.height/2));
addChild(pLabel);
addChild(label);
#endif

View File

@ -19,7 +19,7 @@ MainLayer::MainLayer()
{
setTouchEnabled(true);
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* sprite = Sprite::create(s_pathGrossini);
Layer* layer = LayerColor::create(Color4B(255,255,0,255));
addChild(layer, -1);

View File

@ -208,7 +208,7 @@ DrawNode* BasicTest::shape()
Sprite* BasicTest::grossini()
{
Sprite *grossini = Sprite::create(s_pPathGrossini);
Sprite *grossini = Sprite::create(s_pathGrossini);
grossini->setScale( 1.5 );
return grossini;
}
@ -377,7 +377,7 @@ void NestedTest::setup()
clipper->runAction(RepeatForever::create(RotateBy::create(i % 3 ? 1.33 : 1.66, i % 2 ? 90 : -90)));
parent->addChild(clipper);
Node *stencil = Sprite::create(s_pPathGrossini);
Node *stencil = Sprite::create(s_pathGrossini);
stencil->setScale( 2.5 - (i * (2.5 / depth)) );
stencil->setAnchorPoint( Point(0.5, 0.5) );
stencil->setPosition( Point(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2) );
@ -413,7 +413,7 @@ std::string HoleDemo::subtitle()
void HoleDemo::setup()
{
Sprite *target = Sprite::create(s_pPathBlock);
Sprite *target = Sprite::create(s_pathBlock);
target->setAnchorPoint(Point::ZERO);
target->setScale(3);
@ -598,7 +598,7 @@ void RawStencilBufferTest::setup()
if (_stencilBits < 3) {
CCLOGWARN("Stencil must be enabled for the current GLView.");
}
_sprite = Sprite::create(s_pPathGrossini);
_sprite = Sprite::create(s_pathGrossini);
_sprite->retain();
_sprite->setAnchorPoint( Point(0.5, 0) );
_sprite->setScale( 2.5f );

View File

@ -55,10 +55,10 @@ void PrettyPrinterDemo::onEnter()
PrettyPrinter vistor;
// print dictionary
Dictionary* pDict = Dictionary::createWithContentsOfFile("animations/animations.plist");
pDict->acceptVisitor(vistor);
CCLog("%s", vistor.getResult().c_str());
CCLog("-------------------------------");
Dictionary* dict = Dictionary::createWithContentsOfFile("animations/animations.plist");
dict->acceptVisitor(vistor);
log("%s", vistor.getResult().c_str());
log("-------------------------------");
Set myset;
for (int i = 0; i < 30; ++i) {
@ -66,14 +66,14 @@ void PrettyPrinterDemo::onEnter()
}
vistor.clear();
myset.acceptVisitor(vistor);
CCLog("%s", vistor.getResult().c_str());
CCLog("-------------------------------");
log("%s", vistor.getResult().c_str());
log("-------------------------------");
vistor.clear();
addSprite();
pDict = TextureCache::getInstance()->snapshotTextures();
pDict->acceptVisitor(vistor);
CCLog("%s", vistor.getResult().c_str());
dict = TextureCache::getInstance()->snapshotTextures();
dict->acceptVisitor(vistor);
log("%s", vistor.getResult().c_str());
}
void DataVisitorTestScene::runThisTest()

View File

@ -352,14 +352,14 @@ TextLayer::TextLayer(void)
// bg->setAnchorPoint( Point::ZERO );
bg->setPosition(VisibleRect::center());
Sprite* grossini = Sprite::create(s_pPathSister2);
Sprite* grossini = Sprite::create(s_pathSister2);
node->addChild(grossini, 1);
grossini->setPosition( Point(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
ActionInterval* sc = ScaleBy::create(2, 5);
ActionInterval* sc_back = sc->reverse();
grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) );
Sprite* tamara = Sprite::create(s_pPathSister1);
Sprite* tamara = Sprite::create(s_pathSister1);
node->addChild(tamara, 1);
tamara->setPosition( Point(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) );
ActionInterval* sc2 = ScaleBy::create(2, 5);

View File

@ -141,9 +141,9 @@ void ArmatureTestLayer::onEnter()
}
// add menu
MenuItemImage *item1 = MenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(ArmatureTestLayer::backCallback,this));
MenuItemImage *item2 = MenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(ArmatureTestLayer::restartCallback, this));
MenuItemImage *item3 = MenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(ArmatureTestLayer::nextCallback, this));
MenuItemImage *item1 = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(ArmatureTestLayer::backCallback,this));
MenuItemImage *item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(ArmatureTestLayer::restartCallback, this));
MenuItemImage *item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(ArmatureTestLayer::nextCallback, this));
Menu *menu = Menu::create(item1, item2, item3, NULL);

View File

@ -99,25 +99,25 @@ bool HelloCocosBuilderLayer::onAssignCCBCustomProperty(Object* pTarget, const ch
if (0 == strcmp(pMemberVariableName, "mCustomPropertyInt"))
{
this->mCustomPropertyInt = pCCBValue->getIntValue();
CCLog("mCustomPropertyInt = %d", mCustomPropertyInt);
log("mCustomPropertyInt = %d", mCustomPropertyInt);
bRet = true;
}
else if ( 0 == strcmp(pMemberVariableName, "mCustomPropertyFloat"))
{
this->mCustomPropertyFloat = pCCBValue->getFloatValue();
CCLog("mCustomPropertyFloat = %f", mCustomPropertyFloat);
log("mCustomPropertyFloat = %f", mCustomPropertyFloat);
bRet = true;
}
else if ( 0 == strcmp(pMemberVariableName, "mCustomPropertyBoolean"))
{
this->mCustomPropertyBoolean = pCCBValue->getBoolValue();
CCLog("mCustomPropertyBoolean = %d", mCustomPropertyBoolean);
log("mCustomPropertyBoolean = %d", mCustomPropertyBoolean);
bRet = true;
}
else if ( 0 == strcmp(pMemberVariableName, "mCustomPropertyString"))
{
this->mCustomPropertyString = pCCBValue->getStringValue();
CCLog("mCustomPropertyString = %s", mCustomPropertyString.c_str());
log("mCustomPropertyString = %s", mCustomPropertyString.c_str());
bRet = true;
}

View File

@ -94,22 +94,22 @@ void EditBoxTest::toExtensionsMainLayer(cocos2d::Object *sender)
void EditBoxTest::editBoxEditingDidBegin(cocos2d::extension::EditBox* editBox)
{
CCLog("editBox %p DidBegin !", editBox);
log("editBox %p DidBegin !", editBox);
}
void EditBoxTest::editBoxEditingDidEnd(cocos2d::extension::EditBox* editBox)
{
CCLog("editBox %p DidEnd !", editBox);
log("editBox %p DidEnd !", editBox);
}
void EditBoxTest::editBoxTextChanged(cocos2d::extension::EditBox* editBox, const std::string& text)
{
CCLog("editBox %p TextChanged, text: %s ", editBox, text.c_str());
log("editBox %p TextChanged, text: %s ", editBox, text.c_str());
}
void EditBoxTest::editBoxReturn(EditBox* editBox)
{
CCLog("editBox %p was returned !",editBox);
log("editBox %p was returned !",editBox);
if (_editName == editBox)
{

View File

@ -255,19 +255,19 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re
// You can get original request type from: response->request->reqType
if (0 != strlen(response->getHttpRequest()->getTag()))
{
CCLog("%s completed", response->getHttpRequest()->getTag());
log("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
_labelStatusCode->setString(statusString);
CCLog("response code: %d", statusCode);
log("response code: %d", statusCode);
if (!response->isSucceed())
{
CCLog("response failed");
CCLog("error buffer: %s", response->getErrorBuffer());
log("response failed");
log("error buffer: %s", response->getErrorBuffer());
return;
}

View File

@ -103,7 +103,7 @@ SocketIOTestLayer::~SocketIOTestLayer(void)
//test event callback handlers, these will be registered with socket.io
void SocketIOTestLayer::testevent(SIOClient *client, const std::string& data) {
CCLog("SocketIOTestLayer::testevent called with data: %s", data.c_str());
log("SocketIOTestLayer::testevent called with data: %s", data.c_str());
std::stringstream s;
s << client->getTag() << " received event testevent with data: " << data.c_str();
@ -114,7 +114,7 @@ void SocketIOTestLayer::testevent(SIOClient *client, const std::string& data) {
void SocketIOTestLayer::echotest(SIOClient *client, const std::string& data) {
CCLog("SocketIOTestLayer::echotest called with data: %s", data.c_str());
log("SocketIOTestLayer::echotest called with data: %s", data.c_str());
std::stringstream s;
s << client->getTag() << " received event echotest with data: " << data.c_str();
@ -208,7 +208,7 @@ void SocketIOTestLayer::onMenuTestEndpointDisconnectClicked(cocos2d::Object *sen
void SocketIOTestLayer::onConnect(cocos2d::extension::SIOClient* client)
{
CCLog("SocketIOTestLayer::onConnect called");
log("SocketIOTestLayer::onConnect called");
std::stringstream s;
s << client->getTag() << " connected!";
@ -218,7 +218,7 @@ void SocketIOTestLayer::onConnect(cocos2d::extension::SIOClient* client)
void SocketIOTestLayer::onMessage(cocos2d::extension::SIOClient* client, const std::string& data)
{
CCLog("SocketIOTestLayer::onMessage received: %s", data.c_str());
log("SocketIOTestLayer::onMessage received: %s", data.c_str());
std::stringstream s;
s << client->getTag() << " received message with content: " << data.c_str();
@ -228,7 +228,7 @@ void SocketIOTestLayer::onMessage(cocos2d::extension::SIOClient* client, const s
void SocketIOTestLayer::onClose(cocos2d::extension::SIOClient* client)
{
CCLog("SocketIOTestLayer::onClose called");
log("SocketIOTestLayer::onClose called");
std::stringstream s;
s << client->getTag() << " closed!";
@ -248,7 +248,7 @@ void SocketIOTestLayer::onClose(cocos2d::extension::SIOClient* client)
void SocketIOTestLayer::onError(cocos2d::extension::SIOClient* client, const std::string& data)
{
CCLog("SocketIOTestLayer::onError received: %s", data.c_str());
log("SocketIOTestLayer::onError received: %s", data.c_str());
std::stringstream s;
s << client->getTag() << " received error with content: " << data.c_str();

View File

@ -109,7 +109,7 @@ WebSocketTestLayer::~WebSocketTestLayer()
// Delegate methods
void WebSocketTestLayer::onOpen(cocos2d::extension::WebSocket* ws)
{
CCLog("Websocket (%p) opened", ws);
log("Websocket (%p) opened", ws);
if (ws == _wsiSendText)
{
_sendTextStatus->setString("Send Text WS was opened.");
@ -132,7 +132,7 @@ void WebSocketTestLayer::onMessage(cocos2d::extension::WebSocket* ws, const coco
char times[100] = {0};
sprintf(times, "%d", _sendTextTimes);
std::string textStr = std::string("response text msg: ")+data.bytes+", "+times;
CCLog("%s", textStr.c_str());
log("%s", textStr.c_str());
_sendTextStatus->setString(textStr.c_str());
}
@ -156,14 +156,14 @@ void WebSocketTestLayer::onMessage(cocos2d::extension::WebSocket* ws, const coco
}
binaryStr += std::string(", ")+times;
CCLog("%s", binaryStr.c_str());
log("%s", binaryStr.c_str());
_sendBinaryStatus->setString(binaryStr.c_str());
}
}
void WebSocketTestLayer::onClose(cocos2d::extension::WebSocket* ws)
{
CCLog("websocket instance (%p) closed.", ws);
log("websocket instance (%p) closed.", ws);
if (ws == _wsiSendText)
{
_wsiSendText = NULL;
@ -182,7 +182,7 @@ void WebSocketTestLayer::onClose(cocos2d::extension::WebSocket* ws)
void WebSocketTestLayer::onError(cocos2d::extension::WebSocket* ws, const cocos2d::extension::WebSocket::ErrorCode& error)
{
CCLog("Error was fired, error code: %d", error);
log("Error was fired, error code: %d", error);
if (ws == _wsiError)
{
char buf[100] = {0};
@ -209,7 +209,7 @@ void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Object *sender)
else
{
std::string warningStr = "send text websocket instance wasn't ready...";
CCLog("%s", warningStr.c_str());
log("%s", warningStr.c_str());
_sendTextStatus->setString(warningStr.c_str());
}
}
@ -225,7 +225,7 @@ void WebSocketTestLayer::onMenuSendBinaryClicked(cocos2d::Object *sender)
else
{
std::string warningStr = "send binary websocket instance wasn't ready...";
CCLog("%s", warningStr.c_str());
log("%s", warningStr.c_str());
_sendBinaryStatus->setString(warningStr.c_str());
}
}

View File

@ -142,24 +142,24 @@ void S9BatchNodeBasic::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeBasic ...");
log("S9BatchNodeBasic ...");
auto batchNode = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode created with : Images/blocks9.png");
log("batchNode created with : Images/blocks9.png");
auto blocks = Scale9Sprite::create();
CCLog("... created");
log("... created");
blocks->updateWithBatchNode(batchNode, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
log("... updateWithBatchNode");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9BatchNodeBasic done.");
log("... S9BatchNodeBasic done.");
}
std::string S9BatchNodeBasic::title()
@ -182,18 +182,18 @@ void S9FrameNameSpriteSheet::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheet ...");
log("S9FrameNameSpriteSheet ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
log("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheet done.");
log("... S9FrameNameSpriteSheet done.");
}
std::string S9FrameNameSpriteSheet::title()
@ -216,18 +216,18 @@ void S9FrameNameSpriteSheetRotated::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotated ...");
log("S9FrameNameSpriteSheetRotated ...");
auto blocks = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
log("... created");
blocks->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotated done.");
log("... S9FrameNameSpriteSheetRotated done.");
}
std::string S9FrameNameSpriteSheetRotated::title()
@ -251,27 +251,27 @@ void S9BatchNodeScaledNoInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaledNoInsets ...");
log("S9BatchNodeScaledNoInsets ...");
// scaled without insets
auto batchNode_scaled = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled created with : Images/blocks9.png");
log("batchNode_scaled created with : Images/blocks9.png");
auto blocks_scaled = Scale9Sprite::create();
CCLog("... created");
log("... created");
blocks_scaled->updateWithBatchNode(batchNode_scaled, Rect(0, 0, 96, 96), false, Rect(0, 0, 96, 96));
CCLog("... updateWithBatchNode");
log("... updateWithBatchNode");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
log("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9BtchNodeScaledNoInsets done.");
log("... S9BtchNodeScaledNoInsets done.");
}
std::string S9BatchNodeScaledNoInsets::title()
@ -295,21 +295,21 @@ void S9FrameNameSpriteSheetScaledNoInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetScaledNoInsets ...");
log("S9FrameNameSpriteSheetScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9.png");
CCLog("... created");
log("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
log("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetScaledNoInsets done.");
log("... S9FrameNameSpriteSheetScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetScaledNoInsets::title()
@ -334,21 +334,21 @@ void S9FrameNameSpriteSheetRotatedScaledNoInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");
log("S9FrameNameSpriteSheetRotatedScaledNoInsets ...");
auto blocks_scaled = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
log("... created");
blocks_scaled->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
blocks_scaled->setContentSize(Size(96 * 4, 96*2));
CCLog("... setContentSize");
log("... setContentSize");
this->addChild(blocks_scaled);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
log("... S9FrameNameSpriteSheetRotatedScaledNoInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedScaledNoInsets::title()
@ -373,27 +373,27 @@ void S9BatchNodeScaleWithCapInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9BatchNodeScaleWithCapInsets ...");
log("S9BatchNodeScaleWithCapInsets ...");
auto batchNode_scaled_with_insets = SpriteBatchNode::create("Images/blocks9.png");
CCLog("batchNode_scaled_with_insets created with : Images/blocks9.png");
log("batchNode_scaled_with_insets created with : Images/blocks9.png");
auto blocks_scaled_with_insets = Scale9Sprite::create();
CCLog("... created");
log("... created");
blocks_scaled_with_insets->updateWithBatchNode(batchNode_scaled_with_insets, Rect(0, 0, 96, 96), false, Rect(32, 32, 32, 32));
CCLog("... updateWithBatchNode");
log("... updateWithBatchNode");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
log("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9BatchNodeScaleWithCapInsets done.");
log("... S9BatchNodeScaleWithCapInsets done.");
}
std::string S9BatchNodeScaleWithCapInsets::title()
@ -417,18 +417,18 @@ void S9FrameNameSpriteSheetInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsets ...");
log("S9FrameNameSpriteSheetInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
log("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsets done.");
log("... S9FrameNameSpriteSheetInsets done.");
}
std::string S9FrameNameSpriteSheetInsets::title()
@ -451,21 +451,21 @@ void S9FrameNameSpriteSheetInsetsScaled::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetInsetsScaled ...");
log("S9FrameNameSpriteSheetInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
log("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
log("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetInsetsScaled done.");
log("... S9FrameNameSpriteSheetInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetInsetsScaled::title()
@ -488,18 +488,18 @@ void S9FrameNameSpriteSheetRotatedInsets::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsets ...");
log("S9FrameNameSpriteSheetRotatedInsets ...");
auto blocks_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png", Rect(32, 32, 32, 32));
CCLog("... created");
log("... created");
blocks_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsets done.");
log("... S9FrameNameSpriteSheetRotatedInsets done.");
}
std::string S9FrameNameSpriteSheetRotatedInsets::title()
@ -525,35 +525,35 @@ void S9_TexturePacker::onEnter()
float x = winSize.width / 4;
float y = 0 + (winSize.height / 2);
CCLog("S9_TexturePacker ...");
log("S9_TexturePacker ...");
auto s = Scale9Sprite::createWithSpriteFrameName("button_normal.png");
CCLog("... created");
log("... created");
s->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
s->setContentSize(Size(14 * 16, 10 * 16));
CCLog("... setContentSize");
log("... setContentSize");
this->addChild(s);
CCLog("this->addChild");
log("this->addChild");
x = winSize.width * 3/4;
auto s2 = Scale9Sprite::createWithSpriteFrameName("button_actived.png");
CCLog("... created");
log("... created");
s2->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
s2->setContentSize(Size(14 * 16, 10 * 16));
CCLog("... setContentSize");
log("... setContentSize");
this->addChild(s2);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9_TexturePacker done.");
log("... S9_TexturePacker done.");
}
std::string S9_TexturePacker::title()
@ -577,21 +577,21 @@ void S9FrameNameSpriteSheetRotatedInsetsScaled::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("S9FrameNameSpriteSheetRotatedInsetsScaled ...");
log("S9FrameNameSpriteSheetRotatedInsetsScaled ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9.png", Rect(32, 32, 32, 32));
CCLog("... created");
log("... created");
blocks_scaled_with_insets->setContentSize(Size(96 * 4.5, 96 * 2.5));
CCLog("... setContentSize");
log("... setContentSize");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
log("... S9FrameNameSpriteSheetRotatedInsetsScaled done.");
}
std::string S9FrameNameSpriteSheetRotatedInsetsScaled::title()
@ -615,22 +615,22 @@ void S9FrameNameSpriteSheetRotatedSetCapInsetLater::onEnter()
float x = winSize.width / 2;
float y = 0 + (winSize.height / 2);
CCLog("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");
log("Scale9FrameNameSpriteSheetRotatedSetCapInsetLater ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
log("... created");
blocks_scaled_with_insets->setInsetLeft(32);
blocks_scaled_with_insets->setInsetRight(32);
blocks_scaled_with_insets->setPreferredSize(Size(32*5.5f, 32*4));
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
this->addChild(blocks_scaled_with_insets);
CCLog("this->addChild");
log("this->addChild");
CCLog("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
log("... Scale9FrameNameSpriteSheetRotatedSetCapInsetLater done.");
}
std::string S9FrameNameSpriteSheetRotatedSetCapInsetLater::title()
@ -658,13 +658,13 @@ void S9CascadeOpacityAndColor::onEnter()
rgba->setCascadeOpacityEnabled(true);
this->addChild(rgba);
CCLog("S9CascadeOpacityAndColor ...");
log("S9CascadeOpacityAndColor ...");
auto blocks_scaled_with_insets = Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
CCLog("... created");
log("... created");
blocks_scaled_with_insets->setPosition(Point(x, y));
CCLog("... setPosition");
log("... setPosition");
rgba->addChild(blocks_scaled_with_insets);
Sequence* actions = Sequence::create(FadeIn::create(1),
@ -674,9 +674,9 @@ void S9CascadeOpacityAndColor::onEnter()
NULL);
RepeatForever* repeat = RepeatForever::create(actions);
rgba->runAction(repeat);
CCLog("this->addChild");
log("this->addChild");
CCLog("... S9CascadeOpacityAndColor done.");
log("... S9CascadeOpacityAndColor done.");
}
std::string S9CascadeOpacityAndColor::title()

View File

@ -138,7 +138,7 @@ void TestResolutionDirectories::onEnter()
for( int i=1; i<7; i++) {
String *filename = String::createWithFormat("test%d.txt", i);
ret = sharedFileUtils->fullPathForFilename(filename->getCString());
CCLog("%s -> %s", filename->getCString(), ret.c_str());
log("%s -> %s", filename->getCString(), ret.c_str());
}
}
@ -184,7 +184,7 @@ void TestSearchPath::onEnter()
CCASSERT(ret == 0, "fwrite function returned nonzero value");
fclose(fp);
if (ret == 0)
CCLog("Writing file to writable path succeed.");
log("Writing file to writable path succeed.");
}
searchPaths.insert(searchPaths.begin(), writablePath);
@ -201,12 +201,12 @@ void TestSearchPath::onEnter()
for( int i=1; i<3; i++) {
String *filename = String::createWithFormat("file%d.txt", i);
ret = sharedFileUtils->fullPathForFilename(filename->getCString());
CCLog("%s -> %s", filename->getCString(), ret.c_str());
log("%s -> %s", filename->getCString(), ret.c_str());
}
// Gets external.txt from writable path
string fullPath = sharedFileUtils->fullPathForFilename("external.txt");
CCLog("external file path = %s", fullPath.c_str());
log("external file path = %s", fullPath.c_str());
if (fullPath.length() > 0)
{
fp = fopen(fullPath.c_str(), "rb");
@ -215,7 +215,7 @@ void TestSearchPath::onEnter()
char szReadBuf[100] = {0};
int read = fread(szReadBuf, 1, strlen(szBuf), fp);
if (read > 0)
CCLog("The content of file from writable path: %s", szReadBuf);
log("The content of file from writable path: %s", szReadBuf);
fclose(fp);
}
}
@ -363,9 +363,9 @@ void TextWritePlist::onEnter()
std::string writablePath = FileUtils::getInstance()->getWritablePath();
std::string fullPath = writablePath + "text.plist";
if(root->writeToFile(fullPath.c_str()))
CCLog("see the plist file at %s", fullPath.c_str());
log("see the plist file at %s", fullPath.c_str());
else
CCLog("write plist file failed");
log("write plist file failed");
LabelTTF *label = LabelTTF::create(fullPath.c_str(), "Thonburi", 6);
this->addChild(label);

View File

@ -49,7 +49,7 @@ IntervalLayer::IntervalLayer()
addChild(_label4);
// Sprite
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* sprite = Sprite::create(s_pathGrossini);
sprite->setPosition( Point(VisibleRect::left().x + 40, VisibleRect::bottom().y + 50) );
JumpBy* jump = JumpBy::create(3, Point(s.width-80,0), 50, 4);

View File

@ -26,12 +26,12 @@ KeyboardTest::~KeyboardTest()
void KeyboardTest::keyPressed(int keyCode)
{
CCLog("Key with keycode %d pressed", keyCode);
log("Key with keycode %d pressed", keyCode);
}
void KeyboardTest::keyReleased(int keyCode)
{
CCLog("Key with keycode %d released", keyCode);
log("Key with keycode %d released", keyCode);
}
void KeyboardTestScene::runThisTest()

View File

@ -540,8 +540,8 @@ LayerTestBlend::LayerTestBlend()
Size s = Director::getInstance()->getWinSize();
LayerColor* layer1 = LayerColor::create( Color4B(255, 255, 255, 80) );
Sprite* sister1 = Sprite::create(s_pPathSister1);
Sprite* sister2 = Sprite::create(s_pPathSister2);
Sprite* sister1 = Sprite::create(s_pathSister1);
Sprite* sister2 = Sprite::create(s_pathSister2);
addChild(sister1);
addChild(sister2);
@ -607,7 +607,7 @@ LayerGradientTest::LayerGradientTest()
void LayerGradientTest::toggleItem(Object *sender)
{
LayerGradient *gradient = (LayerGradient*)getChildByTag(kTagLayer);
LayerGradient *gradient = static_cast<LayerGradient*>( getChildByTag(kTagLayer) );
gradient->setCompressedInterpolation(! gradient->isCompressedInterpolation());
}
@ -615,13 +615,13 @@ void LayerGradientTest::ccTouchesMoved(Set * touches, Event *event)
{
Size s = Director::getInstance()->getWinSize();
Touch* touch = (Touch*) touches->anyObject();
Touch* touch = static_cast<Touch*>( touches->anyObject() );
Point start = touch->getLocation();
Point diff = Point(s.width/2,s.height/2) - start;
diff = diff.normalize();
LayerGradient *gradient = (LayerGradient*) getChildByTag(1);
LayerGradient *gradient = static_cast<LayerGradient*>( getChildByTag(1) );
gradient->setVector(diff);
}

View File

@ -151,7 +151,7 @@ void MenuLayerMainMenu::allowTouches(float dt)
Director* director = Director::getInstance();
director->getTouchDispatcher()->setPriority(kMenuHandlerPriority+1, this);
unscheduleAllSelectors();
CCLog("TOUCHES ALLOWED AGAIN");
log("TOUCHES ALLOWED AGAIN");
}
void MenuLayerMainMenu::menuCallbackDisabled(Object* sender)
@ -160,7 +160,7 @@ void MenuLayerMainMenu::menuCallbackDisabled(Object* sender)
Director* director = Director::getInstance();
director->getTouchDispatcher()->setPriority(kMenuHandlerPriority-1, this);
schedule(schedule_selector(MenuLayerMainMenu::allowTouches), 5.0f);
CCLog("TOUCHES DISABLED FOR 5 SECONDS");
log("TOUCHES DISABLED FOR 5 SECONDS");
}
void MenuLayerMainMenu::menuCallback2(Object* sender)
@ -324,7 +324,7 @@ MenuLayer3::MenuLayer3()
MenuItemSprite* item3 = MenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, [](Object *sender) {
CCLog("sprite clicked!");
log("sprite clicked!");
});
_disabledItem = item3; item3->retain();
_disabledItem->setEnabled( false );
@ -536,7 +536,7 @@ void BugsTest::issue1410MenuCallback(Object *sender)
menu->setTouchEnabled(false);
menu->setTouchEnabled(true);
CCLog("NO CRASHES");
log("NO CRASHES");
}
void BugsTest::issue1410v2MenuCallback(cocos2d::Object *pSender)
@ -545,7 +545,7 @@ void BugsTest::issue1410v2MenuCallback(cocos2d::Object *pSender)
menu->setTouchEnabled(true);
menu->setTouchEnabled(false);
CCLog("NO CRASHES. AND MENU SHOULD STOP WORKING");
log("NO CRASHES. AND MENU SHOULD STOP WORKING");
}
void BugsTest::backMenuCallback(cocos2d::Object *pSender)

View File

@ -66,12 +66,12 @@ void MotionStreakTest1::onEnter()
Size s = Director::getInstance()->getWinSize();
// the root object just rotates around
_root = Sprite::create(s_pPathR1);
_root = Sprite::create(s_pathR1);
addChild(_root, 1);
_root->setPosition(Point(s.width/2, s.height/2));
// the target object is offset from root, and the streak is moved to follow it
_target = Sprite::create(s_pPathR1);
_target = Sprite::create(s_pathR1);
_root->addChild(_target);
_target->setPosition(Point(s.width/4, 0));

View File

@ -140,10 +140,10 @@ void Test2::onEnter()
Size s = Director::getInstance()->getWinSize();
Sprite *sp1 = Sprite::create(s_pPathSister1);
Sprite *sp2 = Sprite::create(s_pPathSister2);
Sprite *sp3 = Sprite::create(s_pPathSister1);
Sprite *sp4 = Sprite::create(s_pPathSister2);
Sprite *sp1 = Sprite::create(s_pathSister1);
Sprite *sp2 = Sprite::create(s_pathSister2);
Sprite *sp3 = Sprite::create(s_pathSister1);
Sprite *sp4 = Sprite::create(s_pathSister2);
sp1->setPosition(Point(100, s.height /2 ));
sp2->setPosition(Point(380, s.height /2 ));
@ -189,8 +189,8 @@ std::string Test2::title()
Test4::Test4()
{
Sprite *sp1 = Sprite::create(s_pPathSister1);
Sprite *sp2 = Sprite::create(s_pPathSister2);
Sprite *sp1 = Sprite::create(s_pathSister1);
Sprite *sp2 = Sprite::create(s_pathSister2);
sp1->setPosition( Point(100,160) );
sp2->setPosition( Point(380,160) );
@ -228,8 +228,8 @@ std::string Test4::title()
//------------------------------------------------------------------
Test5::Test5()
{
Sprite* sp1 = Sprite::create(s_pPathSister1);
Sprite* sp2 = Sprite::create(s_pPathSister2);
Sprite* sp1 = Sprite::create(s_pathSister1);
Sprite* sp2 = Sprite::create(s_pathSister2);
sp1->setPosition(Point(100,160));
sp2->setPosition(Point(380,160));
@ -280,11 +280,11 @@ std::string Test5::title()
//------------------------------------------------------------------
Test6::Test6()
{
Sprite* sp1 = Sprite::create(s_pPathSister1);
Sprite* sp11 = Sprite::create(s_pPathSister1);
Sprite* sp1 = Sprite::create(s_pathSister1);
Sprite* sp11 = Sprite::create(s_pathSister1);
Sprite* sp2 = Sprite::create(s_pPathSister2);
Sprite* sp21 = Sprite::create(s_pPathSister2);
Sprite* sp2 = Sprite::create(s_pathSister2);
Sprite* sp21 = Sprite::create(s_pathSister2);
sp1->setPosition(Point(100,160));
sp2->setPosition(Point(380,160));
@ -343,7 +343,7 @@ StressTest1::StressTest1()
{
Size s = Director::getInstance()->getWinSize();
Sprite *sp1 = Sprite::create(s_pPathSister1);
Sprite *sp1 = Sprite::create(s_pathSister1);
addChild(sp1, 0, kTagSprite1);
sp1->setPosition( Point(s.width/2, s.height/2) );
@ -398,7 +398,7 @@ StressTest2::StressTest2()
Layer* sublayer = Layer::create();
Sprite *sp1 = Sprite::create(s_pPathSister1);
Sprite *sp1 = Sprite::create(s_pathSister1);
sp1->setPosition( Point(80, s.height/2) );
ActionInterval* move = MoveBy::create(3, Point(350,0));
@ -536,7 +536,7 @@ CameraOrbitTest::CameraOrbitTest()
// LEFT
s = p->getContentSize();
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
sprite->setScale(0.5f);
p->addChild(sprite, 0);
sprite->setPosition( Point(s.width/4*1, s.height/2) );
@ -544,7 +544,7 @@ CameraOrbitTest::CameraOrbitTest()
sprite->runAction( RepeatForever::create( orbit ) );
// CENTER
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
sprite->setScale( 1.0f );
p->addChild(sprite, 0);
sprite->setPosition( Point(s.width/4*2, s.height/2) );
@ -553,7 +553,7 @@ CameraOrbitTest::CameraOrbitTest()
// RIGHT
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
sprite->setScale( 2.0f );
p->addChild(sprite, 0);
sprite->setPosition( Point(s.width/4*3, s.height/2) );
@ -601,7 +601,7 @@ CameraZoomTest::CameraZoomTest()
Camera *cam;
// LEFT
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
addChild( sprite, 0);
sprite->setPosition( Point(s.width/4*1, s.height/2) );
cam = sprite->getCamera();
@ -609,12 +609,12 @@ CameraZoomTest::CameraZoomTest()
cam->setCenterXYZ(0, 0, 0);
// CENTER
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
addChild( sprite, 0, 40);
sprite->setPosition(Point(s.width/4*2, s.height/2));
// RIGHT
sprite = Sprite::create(s_pPathGrossini);
sprite = Sprite::create(s_pathGrossini);
addChild( sprite, 0, 20);
sprite->setPosition(Point(s.width/4*3, s.height/2));

View File

@ -1240,7 +1240,7 @@ void ParticleBatchHybrid::switchRender(float dt)
Node *newParent = (usingBatch ? _parent2 : _parent1 );
newParent->addChild(_emitter);
CCLog("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode");
log("Particle: Using new parent: %s", usingBatch ? "CCNode" : "CCParticleBatchNode");
}
std::string ParticleBatchHybrid::title()

View File

@ -121,9 +121,9 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
addChild(infoLabel, 1, kTagInfoLayer);
NodeChildrenMenuLayer* pMenu = new NodeChildrenMenuLayer(true, TEST_COUNT, s_nCurCase);
addChild(pMenu);
pMenu->release();
NodeChildrenMenuLayer* menuLayer = new NodeChildrenMenuLayer(true, TEST_COUNT, s_nCurCase);
addChild(menuLayer);
menuLayer->release();
updateQuantityLabel();
updateQuantityOfNodes();
@ -220,8 +220,8 @@ void IterateSpriteSheetFastEnum::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* scene = static_cast<Sprite*>(pObject);
scene->setVisible(false);
Sprite* sprite = static_cast<Sprite*>(pObject);
sprite->setVisible(false);
}
CC_PROFILER_STOP_INSTANCE(this, this->profilerName());
@ -257,8 +257,8 @@ void IterateSpriteSheetCArray::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* scene = static_cast<Sprite*>(pObject);
scene->setVisible(false);
Sprite* sprite = static_cast<Sprite*>(pObject);
sprite->setVisible(false);
}
CC_PROFILER_STOP(this->profilerName());
@ -354,8 +354,8 @@ void AddSpriteSheet::update(float dt)
// Don't include the sprite creation time and random as part of the profiling
for(int i=0; i<totalToAdd; i++)
{
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
Sprite* sprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(sprite);
zs[i] = CCRANDOM_MINUS1_1() * 50;
}
@ -415,8 +415,8 @@ void RemoveSpriteSheet::update(float dt)
// Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++)
{
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
Sprite* sprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(sprite);
}
// add them with random Z (very important!)
@ -469,10 +469,10 @@ void ReorderSpriteSheet::update(float dt)
Array* sprites = Array::createWithCapacity(totalToAdd);
// Don't include the sprite creation time as part of the profiling
for(int i=0;i<totalToAdd;i++)
for(int i=0; i<totalToAdd; i++)
{
Sprite* scene = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(scene);
Sprite* sprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
sprites->addObject(sprite);
}
// add them with random Z (very important!)

View File

@ -114,9 +114,9 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
labelAtlas->setPosition(Point(s.width-66,50));
// Next Prev Test
ParticleMenuLayer* pMenu = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx);
addChild(pMenu, 1, kTagMenuLayer);
pMenu->release();
ParticleMenuLayer* menuLayer = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
// Sub Tests
MenuItemFont::setFontSize(40);
@ -259,8 +259,8 @@ void ParticleMainScene::testNCallback(Object* pSender)
{
subtestNumber = ((Node*)pSender)->getTag();
ParticleMenuLayer* pMenu = (ParticleMenuLayer*)getChildByTag(kTagMenuLayer);
pMenu->restartCallback(pSender);
ParticleMenuLayer* menu = (ParticleMenuLayer*)getChildByTag(kTagMenuLayer);
menu->restartCallback(pSender);
}
void ParticleMainScene::updateQuantityLabel()

View File

@ -303,20 +303,20 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
addChild(infoLabel, 1, kTagInfoLayer);
// add menu
SpriteMenuLayer* pMenu = new SpriteMenuLayer(true, TEST_COUNT, s_nSpriteCurCase);
addChild(pMenu, 1, kTagMenuLayer);
pMenu->release();
SpriteMenuLayer* menuLayer = new SpriteMenuLayer(true, TEST_COUNT, s_nSpriteCurCase);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
// Sub Tests
MenuItemFont::setFontSize(32);
Menu* pSubMenu = Menu::create();
Menu* subMenu = Menu::create();
for (int i = 1; i <= 9; ++i)
{
char str[10] = {0};
sprintf(str, "%d ", i);
MenuItemFont* itemFont = MenuItemFont::create(str, CC_CALLBACK_1(SpriteMainScene::testNCallback, this));
itemFont->setTag(i);
pSubMenu->addChild(itemFont, 10);
subMenu->addChild(itemFont, 10);
if( i<= 3)
itemFont->setColor(Color3B(200,20,20));
@ -326,9 +326,9 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
itemFont->setColor(Color3B(0,20,200));
}
pSubMenu->alignItemsHorizontally();
pSubMenu->setPosition(Point(s.width/2, 80));
addChild(pSubMenu, 2);
subMenu->alignItemsHorizontally();
subMenu->setPosition(Point(s.width/2, 80));
addChild(subMenu, 2);
// add title label
LabelTTF *label = LabelTTF::create(title().c_str(), "Arial", 40);
@ -357,8 +357,8 @@ SpriteMainScene::~SpriteMainScene()
void SpriteMainScene::testNCallback(Object* pSender)
{
subtestNumber = ((MenuItemFont*) pSender)->getTag();
SpriteMenuLayer* pMenu = (SpriteMenuLayer*)getChildByTag(kTagMenuLayer);
pMenu->restartCallback(pSender);
SpriteMenuLayer* menu = (SpriteMenuLayer*)getChildByTag(kTagMenuLayer);
menu->restartCallback(pSender);
}
void SpriteMainScene::updateNodes()
@ -408,77 +408,77 @@ void SpriteMainScene::onDecrease(Object* pSender)
// For test functions
//
////////////////////////////////////////////////////////
void performanceActions(Sprite* scene)
void performanceActions(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
float period = 0.5f + (rand() % 1000) / 500.0f;
RotateBy* rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1());
ActionInterval* rot_back = rot->reverse();
Action *permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL));
scene->runAction(permanentRotation);
sprite->runAction(permanentRotation);
float growDuration = 0.5f + (rand() % 1000) / 500.0f;
ActionInterval *grow = ScaleBy::create(growDuration, 0.5f, 0.5f);
Action *permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), NULL));
scene->runAction(permanentScaleLoop);
sprite->runAction(permanentScaleLoop);
}
void performanceActions20(Sprite* scene)
void performanceActions20(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
if( CCRANDOM_0_1() < 0.2f )
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
else
scene->setPosition(Point( -1000, -1000));
sprite->setPosition(Point( -1000, -1000));
float period = 0.5f + (rand() % 1000) / 500.0f;
RotateBy* rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1());
ActionInterval* rot_back = rot->reverse();
Action *permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL));
scene->runAction(permanentRotation);
sprite->runAction(permanentRotation);
float growDuration = 0.5f + (rand() % 1000) / 500.0f;
ActionInterval *grow = ScaleBy::create(growDuration, 0.5f, 0.5f);
Action *permanentScaleLoop = RepeatForever::create(Sequence::createWithTwoActions(grow, grow->reverse()));
scene->runAction(permanentScaleLoop);
sprite->runAction(permanentScaleLoop);
}
void performanceRotationScale(Sprite* scene)
void performanceRotationScale(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setRotation(CCRANDOM_0_1() * 360);
scene->setScale(CCRANDOM_0_1() * 2);
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setRotation(CCRANDOM_0_1() * 360);
sprite->setScale(CCRANDOM_0_1() * 2);
}
void performancePosition(Sprite* scene)
void performancePosition(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
}
void performanceout20(Sprite* scene)
void performanceout20(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
if( CCRANDOM_0_1() < 0.2f )
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
else
scene->setPosition(Point( -1000, -1000));
sprite->setPosition(Point( -1000, -1000));
}
void performanceOut100(Sprite* scene)
void performanceOut100(Sprite* sprite)
{
scene->setPosition(Point( -1000, -1000));
sprite->setPosition(Point( -1000, -1000));
}
void performanceScale(Sprite* scene)
void performanceScale(Sprite* sprite)
{
Size size = Director::getInstance()->getWinSize();
scene->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
scene->setScale(CCRANDOM_0_1() * 100 / 50);
sprite->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height)));
sprite->setScale(CCRANDOM_0_1() * 100 / 50);
}
////////////////////////////////////////////////////////

View File

@ -37,18 +37,18 @@ void PerformanceMainLayer::onEnter()
Size s = Director::getInstance()->getWinSize();
Menu* pMenu = Menu::create();
pMenu->setPosition( Point::ZERO );
Menu* menu = Menu::create();
menu->setPosition( Point::ZERO );
MenuItemFont::setFontName("Arial");
MenuItemFont::setFontSize(24);
for (int i = 0; i < g_testMax; ++i)
{
MenuItemFont* pItem = MenuItemFont::create(g_testsName[i].name, g_testsName[i].callback);
pItem->setPosition(Point(s.width / 2, s.height - (i + 1) * LINE_SPACE));
pMenu->addChild(pItem, kItemTagBasic + i);
menu->addChild(pItem, kItemTagBasic + i);
}
addChild(pMenu);
addChild(menu);
}
////////////////////////////////////////////////////////
@ -72,23 +72,23 @@ void PerformBasicLayer::onEnter()
MenuItemFont::setFontSize(24);
MenuItemFont* pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(PerformBasicLayer::toMainLayer, this));
pMainItem->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
Menu* pMenu = Menu::create(pMainItem, NULL);
pMenu->setPosition( Point::ZERO );
Menu* menu = Menu::create(pMainItem, NULL);
menu->setPosition( Point::ZERO );
if (_controlMenuVisible)
{
MenuItemImage *item1 = MenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(PerformBasicLayer::backCallback, this));
MenuItemImage *item2 = MenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(PerformBasicLayer::restartCallback, this));
MenuItemImage *item3 = MenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(PerformBasicLayer::nextCallback, this));
MenuItemImage *item1 = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(PerformBasicLayer::backCallback, this));
MenuItemImage *item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(PerformBasicLayer::restartCallback, this));
MenuItemImage *item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(PerformBasicLayer::nextCallback, this));
item1->setPosition(Point(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
item2->setPosition(Point(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
item3->setPosition(Point(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
pMenu->addChild(item1, kItemTagBasic);
pMenu->addChild(item2, kItemTagBasic);
pMenu->addChild(item3, kItemTagBasic);
menu->addChild(item1, kItemTagBasic);
menu->addChild(item2, kItemTagBasic);
menu->addChild(item3, kItemTagBasic);
}
addChild(pMenu);
addChild(menu);
}
void PerformBasicLayer::toMainLayer(Object* pSender)

View File

@ -86,44 +86,44 @@ void TextureTest::performTestsPNG(const char* filename)
Texture2D *texture;
TextureCache *cache = TextureCache::getInstance();
CCLog("RGBA 8888");
log("RGBA 8888");
Texture2D::setDefaultAlphaPixelFormat(kTexture2DPixelFormat_RGBA8888);
gettimeofday(&now, NULL);
texture = cache->addImage(filename);
if( texture )
CCLog(" ms:%f", calculateDeltaTime(&now) );
log(" ms:%f", calculateDeltaTime(&now) );
else
CCLog(" ERROR");
log(" ERROR");
cache->removeTexture(texture);
CCLog("RGBA 4444");
log("RGBA 4444");
Texture2D::setDefaultAlphaPixelFormat(kTexture2DPixelFormat_RGBA4444);
gettimeofday(&now, NULL);
texture = cache->addImage(filename);
if( texture )
CCLog(" ms:%f", calculateDeltaTime(&now) );
log(" ms:%f", calculateDeltaTime(&now) );
else
CCLog(" ERROR");
log(" ERROR");
cache->removeTexture(texture);
CCLog("RGBA 5551");
log("RGBA 5551");
Texture2D::setDefaultAlphaPixelFormat(kTexture2DPixelFormat_RGB5A1);
gettimeofday(&now, NULL);
texture = cache->addImage(filename);
if( texture )
CCLog(" ms:%f", calculateDeltaTime(&now) );
log(" ms:%f", calculateDeltaTime(&now) );
else
CCLog(" ERROR");
log(" ERROR");
cache->removeTexture(texture);
CCLog("RGB 565");
log("RGB 565");
Texture2D::setDefaultAlphaPixelFormat(kTexture2DPixelFormat_RGB565);
gettimeofday(&now, NULL);
texture = cache->addImage(filename);
if( texture )
CCLog(" ms:%f", calculateDeltaTime(&now) );
log(" ms:%f", calculateDeltaTime(&now) );
else
CCLog(" ERROR");
log(" ERROR");
cache->removeTexture(texture);
}
@ -133,60 +133,60 @@ void TextureTest::performTests()
// struct timeval now;
// TextureCache *cache = TextureCache::getInstance();
CCLog("--------");
log("--------");
CCLog("--- PNG 128x128 ---");
log("--- PNG 128x128 ---");
performTestsPNG("Images/test_image.png");
// CCLog("--- PVR 128x128 ---");
// CCLog("RGBA 8888");
// log("--- PVR 128x128 ---");
// log("RGBA 8888");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/test_image_rgba8888.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("BGRA 8888");
// log("BGRA 8888");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/test_image_bgra8888.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("RGBA 4444");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/test_image_rgba4444.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("RGB 565");
// log("RGB 565");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/test_image_rgb565.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
CCLog("--- PNG 512x512 ---");
log("--- PNG 512x512 ---");
performTestsPNG("Images/texture512x512.png");
// CCLog("--- PVR 512x512 ---");
// CCLog("RGBA 4444");
// log("--- PVR 512x512 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/texture512x512_rgba4444.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
@ -195,38 +195,38 @@ void TextureTest::performTests()
// Empty image
//
CCLog("EMPTY IMAGE");
CCLog("--- PNG 1024x1024 ---");
log("EMPTY IMAGE");
log("--- PNG 1024x1024 ---");
performTestsPNG("Images/texture1024x1024.png");
// CCLog("--- PVR 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.GZ 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR.GZ 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.gz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.CCZ 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR.CCZ 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.ccz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
@ -235,38 +235,38 @@ void TextureTest::performTests()
// SpriteSheet images
//
CCLog("SPRITESHEET IMAGE");
CCLog("--- PNG 1024x1024 ---");
log("SPRITESHEET IMAGE");
log("--- PNG 1024x1024 ---");
performTestsPNG("Images/PlanetCute-1024x1024.png");
// CCLog("--- PVR 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.GZ 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR.GZ 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.gz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.CCZ 1024x1024 ---");
// CCLog("RGBA 4444");
// log("--- PVR.CCZ 1024x1024 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.ccz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
@ -276,39 +276,39 @@ void TextureTest::performTests()
// Landscape Image
//
CCLog("LANDSCAPE IMAGE");
log("LANDSCAPE IMAGE");
CCLog("--- PNG 1024x1024 ---");
log("--- PNG 1024x1024 ---");
performTestsPNG("Images/landscape-1024x1024.png");
// CCLog("--- PVR 1024x1024 ---");
// CCLog("RGBA 8888");
// log("--- PVR 1024x1024 ---");
// log("RGBA 8888");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.GZ 1024x1024 ---");
// CCLog("RGBA 8888");
// log("--- PVR.GZ 1024x1024 ---");
// log("RGBA 8888");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.gz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
//
// CCLog("--- PVR.CCZ 1024x1024 ---");
// CCLog("RGBA 8888");
// log("--- PVR.CCZ 1024x1024 ---");
// log("RGBA 8888");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.ccz");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
@ -318,17 +318,17 @@ void TextureTest::performTests()
//
// most platform don't support texture with width/height is 2048
// CCLog("--- PNG 2048x2048 ---");
// log("--- PNG 2048x2048 ---");
// performTestsPNG("Images/texture2048x2048.png");
// CCLog("--- PVR 2048x2048 ---");
// CCLog("RGBA 4444");
// log("--- PVR 2048x2048 ---");
// log("RGBA 4444");
// gettimeofday(&now, NULL);
// texture = cache->addImage("Images/texture2048x2048_rgba4444.pvr");
// if( texture )
// CCLog(" ms:%f", calculateDeltaTime(&now) );
// log(" ms:%f", calculateDeltaTime(&now) );
// else
// CCLog("ERROR");
// log("ERROR");
// cache->removeTexture(texture);
}

View File

@ -41,9 +41,9 @@ void SpriteLayer::onEnter()
x = size.width;
y = size.height;
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* spriteSister1 = Sprite::create(s_pPathSister1);
Sprite* spriteSister2 = Sprite::create(s_pPathSister2);
Sprite* sprite = Sprite::create(s_pathGrossini);
Sprite* spriteSister1 = Sprite::create(s_pathSister1);
Sprite* spriteSister2 = Sprite::create(s_pathSister2);
sprite->setScale(1.5f);
spriteSister1->setScale(1.5f);

View File

@ -28,7 +28,7 @@ SceneTestLayer1::SceneTestLayer1()
addChild( menu );
Size s = Director::getInstance()->getWinSize();
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* sprite = Sprite::create(s_pathGrossini);
addChild(sprite);
sprite->setPosition( Point(s.width-40, s.height/2) );
ActionInterval* rotate = RotateBy::create(2, 360);
@ -113,7 +113,7 @@ SceneTestLayer2::SceneTestLayer2()
addChild( menu );
Size s = Director::getInstance()->getWinSize();
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* sprite = Sprite::create(s_pathGrossini);
addChild(sprite);
sprite->setPosition( Point(s.width-40, s.height/2) );
ActionInterval* rotate = RotateBy::create(2, 360);
@ -182,7 +182,7 @@ bool SceneTestLayer3::init()
this->schedule(schedule_selector(SceneTestLayer3::testDealloc));
Sprite* sprite = Sprite::create(s_pPathGrossini);
Sprite* sprite = Sprite::create(s_pathGrossini);
addChild(sprite);
sprite->setPosition( Point(s.width/2, 40) );
ActionInterval* rotate = RotateBy::create(2, 360);
@ -195,7 +195,7 @@ bool SceneTestLayer3::init()
void SceneTestLayer3::testDealloc(float dt)
{
CCLog("Layer3:testDealloc");
log("Layer3:testDealloc");
}
void SceneTestLayer3::item0Clicked(Object* pSender)

View File

@ -261,17 +261,17 @@ void SchedulerPauseResumeAll::onExit()
void SchedulerPauseResumeAll::tick1(float dt)
{
CCLog("tick1");
log("tick1");
}
void SchedulerPauseResumeAll::tick2(float dt)
{
CCLog("tick2");
log("tick2");
}
void SchedulerPauseResumeAll::pause(float dt)
{
CCLog("Pausing");
log("Pausing");
Director* director = Director::getInstance();
_pausedTargets = director->getScheduler()->pauseAllTargets();
CC_SAFE_RETAIN(_pausedTargets);
@ -281,13 +281,13 @@ void SchedulerPauseResumeAll::pause(float dt)
if (c > 2)
{
// should have only 2 items: ActionManager, self
CCLog("Error: pausedTargets should have only 2 items, and not %u", (unsigned int)c);
log("Error: pausedTargets should have only 2 items, and not %u", (unsigned int)c);
}
}
void SchedulerPauseResumeAll::resume(float dt)
{
CCLog("Resuming");
log("Resuming");
Director* director = Director::getInstance();
director->getScheduler()->resumeTargets(_pausedTargets);
CC_SAFE_RELEASE_NULL(_pausedTargets);
@ -347,17 +347,17 @@ void SchedulerPauseResumeAllUser::onExit()
void SchedulerPauseResumeAllUser::tick1(float dt)
{
CCLog("tick1");
log("tick1");
}
void SchedulerPauseResumeAllUser::tick2(float dt)
{
CCLog("tick2");
log("tick2");
}
void SchedulerPauseResumeAllUser::pause(float dt)
{
CCLog("Pausing");
log("Pausing");
Director* director = Director::getInstance();
_pausedTargets = director->getScheduler()->pauseAllTargetsWithMinPriority(kPriorityNonSystemMin);
CC_SAFE_RETAIN(_pausedTargets);
@ -365,7 +365,7 @@ void SchedulerPauseResumeAllUser::pause(float dt)
void SchedulerPauseResumeAllUser::resume(float dt)
{
CCLog("Resuming");
log("Resuming");
Director* director = Director::getInstance();
director->getScheduler()->resumeTargets(_pausedTargets);
CC_SAFE_RELEASE_NULL(_pausedTargets);
@ -635,7 +635,7 @@ TestNode::~TestNode()
void TestNode::update(float dt)
{
CC_UNUSED_PARAM(dt);
CCLog("%s", _pstring->getCString());
log("%s", _pstring->getCString());
}
//------------------------------------------------------------------
@ -856,7 +856,7 @@ std::string SchedulerDelayAndRepeat::subtitle()
void SchedulerDelayAndRepeat::update(float dt)
{
CCLog("update called:%f", dt);
log("update called:%f", dt);
}
// SchedulerTimeScale
@ -1095,7 +1095,7 @@ class TestNode2 : public Node
{
public:
~TestNode2() {
cocos2d::CCLog("Delete TestNode (should not crash)");
cocos2d::log("Delete TestNode (should not crash)");
this->unscheduleAllSelectors();
}

View File

@ -1 +1 @@
cde4f9e3da5d9548b91fe5ef35bdf0a42547c206
715f77e7fdc777c303783dad8b6ce3e1b19526d7

View File

@ -298,7 +298,7 @@ void TextFieldTTFActionTest::onEnter()
Sequence::create(
FadeOut::create(0.25),
FadeIn::create(0.25),
0
NULL
));
_textFieldAction->retain();
_action = false;
@ -390,9 +390,9 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * pSender, const
MoveTo::create(duration, endPos),
ScaleTo::create(duration, 1),
FadeOut::create(duration),
0),
NULL),
CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)),
0);
NULL);
label->runAction(seq);
return false;
}
@ -424,9 +424,9 @@ bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * pSender, c
RotateBy::create(rotateDuration, (rand()%2) ? 360 : -360),
repeatTime),
FadeOut::create(duration),
0),
NULL),
CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)),
0);
NULL);
label->runAction(seq);
return false;
}

View File

@ -438,7 +438,7 @@ void TexturePVRTest::onEnter()
}
else
{
CCLog("This test is not supported.");
log("This test is not supported.");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
@ -470,7 +470,7 @@ void TexturePVR4BPP::onEnter()
}
else
{
CCLog("This test is not supported in cocos2d-mac");
log("This test is not supported in cocos2d-mac");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
}
@ -523,7 +523,7 @@ void TexturePVRBGRA8888::onEnter()
}
else
{
CCLog("BGRA8888 images are not supported");
log("BGRA8888 images are not supported");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
}
@ -825,7 +825,7 @@ void TexturePVR4BPPv3::onEnter()
}
else
{
CCLog("This test is not supported");
log("This test is not supported");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
@ -860,7 +860,7 @@ void TexturePVRII4BPPv3::onEnter()
}
else
{
CCLog("This test is not supported");
log("This test is not supported");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
@ -918,7 +918,7 @@ void TexturePVRBGRA8888v3::onEnter()
}
else
{
CCLog("BGRA images are not supported");
log("BGRA images are not supported");
}
TextureCache::getInstance()->dumpCachedTextureInfo();
@ -1514,7 +1514,7 @@ void TextureAsync::imageLoaded(Object* pObj)
_imageOffset++;
CCLog("Image loaded: %p", tex);
log("Image loaded: %p", tex);
}
std::string TextureAsync::title()
@ -1612,33 +1612,33 @@ void TextureSizeTest::onEnter()
TextureDemo::onEnter();
Sprite *sprite = NULL;
CCLog("Loading 512x512 image...");
log("Loading 512x512 image...");
sprite = Sprite::create("Images/texture512x512.png");
if( sprite )
CCLog("OK");
log("OK");
else
CCLog("Error");
log("Error");
CCLog("Loading 1024x1024 image...");
log("Loading 1024x1024 image...");
sprite = Sprite::create("Images/texture1024x1024.png");
if( sprite )
CCLog("OK");
log("OK");
else
CCLog("Error");
log("Error");
// @todo
// CCLog("Loading 2048x2048 image...");
// log("Loading 2048x2048 image...");
// sprite = Sprite::create("Images/texture2048x2048.png");
// if( sprite )
// CCLog("OK");
// log("OK");
// else
// CCLog("Error");
// log("Error");
//
// CCLog("Loading 4096x4096 image...");
// log("Loading 4096x4096 image...");
// sprite = Sprite::create("Images/texture4096x4096.png");
// if( sprite )
// CCLog("OK");
// log("OK");
// else
// CCLog("Error");
// log("Error");
}
std::string TextureSizeTest::title()

View File

@ -261,7 +261,7 @@ TMXOrthoTest4::TMXOrthoTest4()
map->setAnchorPoint(Point(0, 0));
TMXLayer* layer = map->layerNamed("Layer 0");
auto layer = map->getLayer("Layer 0");
Size s = layer->getLayerSize();
Sprite* sprite;
@ -282,8 +282,8 @@ void TMXOrthoTest4::removeSprite(float dt)
{
unschedule(schedule_selector(TMXOrthoTest4::removeSprite));
TMXTiledMap *map = (TMXTiledMap*)getChildByTag(kTagTileMap);
TMXLayer* layer = map->layerNamed("Layer 0");
auto map = static_cast<TMXTiledMap*>( getChildByTag(kTagTileMap) );
auto layer = map->getLayer("Layer 0");
Size s = layer->getLayerSize();
Sprite* sprite = layer->getTileAt( Point(s.width-1,0) );
@ -318,7 +318,7 @@ TMXReadWriteTest::TMXReadWriteTest()
CCLOG("ContentSize: %f, %f", s.width,s.height);
TMXLayer* layer = map->layerNamed("Layer 0");
TMXLayer* layer = map->getLayer("Layer 0");
layer->getTexture()->setAntiAliasTexParameters();
map->setScale( 1 );
@ -585,13 +585,13 @@ TMXTilesetTest::TMXTilesetTest()
CCLOG("ContentSize: %f, %f", s.width,s.height);
TMXLayer* layer;
layer = map->layerNamed("Layer 0");
layer = map->getLayer("Layer 0");
layer->getTexture()->setAntiAliasTexParameters();
layer = map->layerNamed("Layer 1");
layer = map->getLayer("Layer 1");
layer->getTexture()->setAntiAliasTexParameters();
layer = map->layerNamed("Layer 2");
layer = map->getLayer("Layer 2");
layer->getTexture()->setAntiAliasTexParameters();
}
@ -614,7 +614,7 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
CCLOG("ContentSize: %f, %f", s.width,s.height);
////----CCLOG("----> Iterating over all the group objets");
TMXObjectGroup* group = map->objectGroupNamed("Object Group 1");
auto group = map->getObjectGroup("Object Group 1");
Array* objects = group->getObjects();
Dictionary* dict = NULL;
@ -636,8 +636,8 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
void TMXOrthoObjectsTest::draw()
{
TMXTiledMap* map = (TMXTiledMap*) getChildByTag(kTagTileMap);
TMXObjectGroup* group = map->objectGroupNamed("Object Group 1");
auto map = static_cast<TMXTiledMap*>( getChildByTag(kTagTileMap) );
auto group = map->getObjectGroup("Object Group 1");
Array* objects = group->getObjects();
Dictionary* dict = NULL;
@ -693,7 +693,7 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
Size CC_UNUSED s = map->getContentSize();
CCLOG("ContentSize: %f, %f", s.width,s.height);
TMXObjectGroup* group = map->objectGroupNamed("Object Group 1");
TMXObjectGroup* group = map->getObjectGroup("Object Group 1");
//UxMutableArray* objects = group->objects();
Array* objects = group->getObjects();
@ -714,7 +714,7 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
void TMXIsoObjectsTest::draw()
{
TMXTiledMap *map = (TMXTiledMap*) getChildByTag(kTagTileMap);
TMXObjectGroup *group = map->objectGroupNamed("Object Group 1");
TMXObjectGroup *group = map->getObjectGroup("Object Group 1");
Array* objects = group->getObjects();
Dictionary* dict;
@ -771,7 +771,7 @@ TMXResizeTest::TMXResizeTest()
CCLOG("ContentSize: %f, %f", s.width,s.height);
TMXLayer* layer;
layer = map->layerNamed("Layer 0");
layer = map->getLayer("Layer 0");
Size ls = layer->getLayerSize();
for (unsigned int y = 0; y < ls.height; y++)
@ -808,7 +808,7 @@ TMXIsoZorder::TMXIsoZorder()
CCLOG("ContentSize: %f, %f", s.width,s.height);
map->setPosition(Point(-s.width/2,0));
_tamara = Sprite::create(s_pPathSister1);
_tamara = Sprite::create(s_pathSister1);
map->addChild(_tamara, map->getChildren()->count() );
_tamara->retain();
int mapWidth = map->getMapSize().width * map->getTileSize().width;
@ -876,7 +876,7 @@ TMXOrthoZorder::TMXOrthoZorder()
Size CC_UNUSED s = map->getContentSize();
CCLOG("ContentSize: %f, %f", s.width,s.height);
_tamara = Sprite::create(s_pPathSister1);
_tamara = Sprite::create(s_pathSister1);
map->addChild(_tamara, map->getChildren()->count());
_tamara->retain();
_tamara->setAnchorPoint(Point(0.5f,0));
@ -940,7 +940,7 @@ TMXIsoVertexZ::TMXIsoVertexZ()
// because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
// can use any Sprite and it will work OK.
TMXLayer* layer = map->layerNamed("Trees");
TMXLayer* layer = map->getLayer("Trees");
_tamara = layer->getTileAt( Point(29,29) );
_tamara->retain();
@ -1009,7 +1009,7 @@ TMXOrthoVertexZ::TMXOrthoVertexZ()
// because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
// can use any Sprite and it will work OK.
TMXLayer* layer = map->layerNamed("trees");
TMXLayer* layer = map->getLayer("trees");
_tamara = layer->getTileAt(Point(0,11));
CCLOG("%p vertexZ: %f", _tamara, _tamara->getVertexZ());
_tamara->retain();
@ -1126,7 +1126,7 @@ TMXTilePropertyTest::TMXTilePropertyTest()
addChild(map ,0 ,kTagTileMap);
for(int i=1;i<=20;i++){
CCLog("GID:%i, Properties:%p", i, map->propertiesForGID(i));
log("GID:%i, Properties:%p", i, map->getPropertiesForGID(i));
}
}
@ -1152,7 +1152,7 @@ TMXOrthoFlipTest::TMXOrthoFlipTest()
addChild(map, 0, kTagTileMap);
Size CC_UNUSED s = map->getContentSize();
CCLog("ContentSize: %f, %f", s.width,s.height);
log("ContentSize: %f, %f", s.width,s.height);
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
@ -1182,7 +1182,7 @@ TMXOrthoFlipRunTimeTest::TMXOrthoFlipRunTimeTest()
addChild(map, 0, kTagTileMap);
Size s = map->getContentSize();
CCLog("ContentSize: %f, %f", s.width,s.height);
log("ContentSize: %f, %f", s.width,s.height);
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
@ -1210,7 +1210,7 @@ std::string TMXOrthoFlipRunTimeTest::subtitle()
void TMXOrthoFlipRunTimeTest::flipIt(float dt)
{
TMXTiledMap *map = (TMXTiledMap*) getChildByTag(kTagTileMap);
TMXLayer *layer = map->layerNamed("Layer 0");
TMXLayer *layer = map->getLayer("Layer 0");
//blue diamond
Point tileCoord = Point(1,10);
@ -1261,7 +1261,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
addChild(map, 0, kTagTileMap);
Size s = map->getContentSize();
CCLog("ContentSize: %f, %f", s.width,s.height);
log("ContentSize: %f, %f", s.width,s.height);
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
@ -1303,7 +1303,7 @@ TMXBug987::TMXBug987()
}
map->setAnchorPoint(Point(0, 0));
TMXLayer *layer = map->layerNamed("Tile Layer 1");
TMXLayer *layer = map->getLayer("Tile Layer 1");
layer->setTileGID(3, Point(2,2));
}
@ -1516,7 +1516,7 @@ TMXGIDObjectsTest::TMXGIDObjectsTest()
void TMXGIDObjectsTest::draw()
{
TMXTiledMap *map = (TMXTiledMap*)getChildByTag(kTagTileMap);
TMXObjectGroup *group = map->objectGroupNamed("Object Layer 1");
TMXObjectGroup *group = map->getObjectGroup("Object Layer 1");
Array *array = group->getObjects();
Dictionary* dict;

View File

@ -297,9 +297,9 @@ TestLayer1::TestLayer1(void)
addChild( label);
// menu
MenuItemImage *item1 = MenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(TestLayer1::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(TestLayer1::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(TestLayer1::nextCallback, this) );
MenuItemImage *item1 = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(TestLayer1::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer1::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer1::nextCallback, this) );
Menu *menu = Menu::create(item1, item2, item3, NULL);
@ -382,25 +382,25 @@ void TestLayer1::step(float dt)
void TestLayer1::onEnter()
{
Layer::onEnter();
CCLog("Scene 1 onEnter");
log("Scene 1 onEnter");
}
void TestLayer1::onEnterTransitionDidFinish()
{
Layer::onEnterTransitionDidFinish();
CCLog("Scene 1: onEnterTransitionDidFinish");
log("Scene 1: onEnterTransitionDidFinish");
}
void TestLayer1::onExitTransitionDidStart()
{
Layer::onExitTransitionDidStart();
CCLog("Scene 1: onExitTransitionDidStart");
log("Scene 1: onExitTransitionDidStart");
}
void TestLayer1::onExit()
{
Layer::onExit();
CCLog("Scene 1 onExit");
log("Scene 1 onExit");
}
TestLayer2::TestLayer2()
@ -426,9 +426,9 @@ TestLayer2::TestLayer2()
addChild( label);
// menu
MenuItemImage *item1 = MenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(TestLayer2::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(TestLayer2::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(TestLayer2::nextCallback, this) );
MenuItemImage *item1 = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(TestLayer2::backCallback, this) );
MenuItemImage *item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer2::restartCallback, this) );
MenuItemImage *item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer2::nextCallback, this) );
Menu *menu = Menu::create(item1, item2, item3, NULL);
@ -511,23 +511,23 @@ void TestLayer2::step(float dt)
void TestLayer2::onEnter()
{
Layer::onEnter();
CCLog("Scene 2 onEnter");
log("Scene 2 onEnter");
}
void TestLayer2::onEnterTransitionDidFinish()
{
Layer::onEnterTransitionDidFinish();
CCLog("Scene 2: onEnterTransitionDidFinish");
log("Scene 2: onEnterTransitionDidFinish");
}
void TestLayer2::onExitTransitionDidStart()
{
Layer::onExitTransitionDidStart();
CCLog("Scene 2: onExitTransitionDidStart");
log("Scene 2: onExitTransitionDidStart");
}
void TestLayer2::onExit()
{
Layer::onExit();
CCLog("Scene 2 onExit");
log("Scene 2 onExit");
}

View File

@ -6,9 +6,9 @@ void VisibleRect::lazyInit()
{
if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f)
{
EGLView* pEGLView = EGLView::getInstance();
s_visibleRect.origin = pEGLView->getVisibleOrigin();
s_visibleRect.size = pEGLView->getVisibleSize();
EGLView* glView = EGLView::getInstance();
s_visibleRect.origin = glView->getVisibleOrigin();
s_visibleRect.size = glView->getVisibleSize();
}
}

View File

@ -94,11 +94,11 @@ TestController::TestController()
: _beginPos(Point::ZERO)
{
// add close menu
MenuItemImage *pCloseItem = MenuItemImage::create(s_pPathClose, s_pPathClose, CC_CALLBACK_1(TestController::closeCallback, this) );
Menu* pMenu =Menu::create(pCloseItem, NULL);
MenuItemImage *closeItem = MenuItemImage::create(s_pathClose, s_pathClose, CC_CALLBACK_1(TestController::closeCallback, this) );
Menu* menu =Menu::create(closeItem, NULL);
pMenu->setPosition( Point::ZERO );
pCloseItem->setPosition(Point( VisibleRect::right().x - 30, VisibleRect::top().y - 30));
menu->setPosition( Point::ZERO );
closeItem->setPosition(Point( VisibleRect::right().x - 30, VisibleRect::top().y - 30));
// add menu items for tests
_itemMenu = Menu::create();
@ -109,10 +109,10 @@ TestController::TestController()
// #else
LabelTTF* label = LabelTTF::create( g_aTestNames[i].test_name, "Arial", 24);
// #endif
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(TestController::menuCallback, this));
MenuItemLabel* menuItem = MenuItemLabel::create(label, CC_CALLBACK_1(TestController::menuCallback, this));
_itemMenu->addChild(pMenuItem, i + 10000);
pMenuItem->setPosition( Point( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
_itemMenu->addChild(menuItem, i + 10000);
menuItem->setPosition( Point( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
}
_itemMenu->setContentSize(Size(VisibleRect::getVisibleRect().size.width, (g_testCount + 1) * (LINE_SPACE)));
@ -121,7 +121,7 @@ TestController::TestController()
setTouchEnabled(true);
addChild(pMenu, 1);
addChild(menu, 1);
}
@ -135,8 +135,8 @@ void TestController::menuCallback(Object * pSender)
Director::getInstance()->purgeCachedData();
// get the userdata, it's the index of the menu item clicked
MenuItem* pMenuItem = (MenuItem *)(pSender);
int idx = pMenuItem->getZOrder() - 10000;
MenuItem* menuItem = (MenuItem *)(pSender);
int idx = menuItem->getZOrder() - 10000;
// create the test scene and run it
TestScene* scene = g_aTestNames[idx].callback();

View File

@ -17,7 +17,7 @@ void TestScene::onEnter()
//#else
LabelTTF* label = LabelTTF::create("MainMenu", "Arial", 20);
//#endif
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, [](Object *sender) {
MenuItemLabel* menuItem = MenuItemLabel::create(label, [](Object *sender) {
/*
****** GCC Compiler issue on Android and Linux (CLANG compiler is ok) ******
We couldn't use 'Scene::create' directly since gcc will trigger
@ -47,10 +47,10 @@ void TestScene::onEnter()
}
});
Menu* pMenu =Menu::create(pMenuItem, NULL);
Menu* menu =Menu::create(menuItem, NULL);
pMenu->setPosition( Point::ZERO );
pMenuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
menu->setPosition( Point::ZERO );
menuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
addChild(pMenu, 1);
addChild(menu, 1);
}

View File

@ -1,16 +1,16 @@
#ifndef _TEST_RESOURCE_H_
#define _TEST_RESOURCE_H_
static const char s_pPathGrossini[] = "Images/grossini.png";
static const char s_pPathSister1[] = "Images/grossinis_sister1.png";
static const char s_pPathSister2[] = "Images/grossinis_sister2.png";
static const char s_pPathB1[] = "Images/b1.png";
static const char s_pPathB2[] = "Images/b2.png";
static const char s_pPathR1[] = "Images/r1.png";
static const char s_pPathR2[] = "Images/r2.png";
static const char s_pPathF1[] = "Images/f1.png";
static const char s_pPathF2[] = "Images/f2.png";
static const char s_pPathBlock[] = "Images/blocks.png";
static const char s_pathGrossini[] = "Images/grossini.png";
static const char s_pathSister1[] = "Images/grossinis_sister1.png";
static const char s_pathSister2[] = "Images/grossinis_sister2.png";
static const char s_pathB1[] = "Images/b1.png";
static const char s_pathB2[] = "Images/b2.png";
static const char s_pathR1[] = "Images/r1.png";
static const char s_pathR2[] = "Images/r2.png";
static const char s_pathF1[] = "Images/f1.png";
static const char s_pathF2[] = "Images/f2.png";
static const char s_pathBlock[] = "Images/blocks.png";
static const char s_back[] = "Images/background.png";
static const char s_back1[] = "Images/background1.png";
static const char s_back2[] = "Images/background2.png";
@ -28,7 +28,7 @@ static const char s_HighNormal[] = "Images/btn-highscores-normal.png";
static const char s_HighSelect[] = "Images/btn-highscores-selected.png";
static const char s_Ball[] = "Images/ball.png";
static const char s_Paddle[] = "Images/paddle.png";
static const char s_pPathClose[] = "Images/close.png";
static const char s_pathClose[] = "Images/close.png";
static const char s_MenuItem[] = "Images/menuitemsprite.png";
static const char s_SendScore[] = "Images/SendScoreButton.png";
static const char s_PressSendScore[] = "Images/SendScoreButtonPressed.png";

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate()
{
ScriptEngineManager::purgeSharedManager();
ScriptEngineManager::destroyInstance();
}
bool AppDelegate::applicationDidFinishLaunching()

View File

@ -1403,7 +1403,7 @@ local function runTextureTest()
-- gettimeofday(&now, NULL)
pTexture = pCache:addImage(strFileName)
if nil ~= pTexture then
--CCLog(" ms:%f", calculateDeltaTime(&now) )
--log(" ms:%f", calculateDeltaTime(&now) )
print("add sucess")
else
print(" ERROR")

View File

@ -519,7 +519,7 @@ JSBool ScriptingCore::runScript(const char *path, JSObject* global, JSContext* c
JSAutoCompartment ac(cx, global);
evaluatedOK = JS_ExecuteScript(cx, global, script, &rval);
if (JS_FALSE == evaluatedOK) {
CCLog("(evaluatedOK == JS_FALSE)");
cocos2d::log("(evaluatedOK == JS_FALSE)");
JS_ReportPendingException(cx);
}
}

View File

@ -44,8 +44,8 @@
#else
#define JSB_PRECONDITION( condition, ...) do { \
if( ! (condition) ) { \
cocos2d::CCLog("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::CCLog(__VA_ARGS__); \
cocos2d::log("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
JSContext* globalContext = ScriptingCore::getInstance()->getGlobalContext(); \
if( ! JS_IsExceptionPending( globalContext ) ) { \
JS_ReportError( globalContext, __VA_ARGS__ ); \
@ -55,8 +55,8 @@
} while(0)
#define JSB_PRECONDITION2( condition, context, ret_value, ...) do { \
if( ! (condition) ) { \
cocos2d::CCLog("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::CCLog(__VA_ARGS__); \
cocos2d::log("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
if( ! JS_IsExceptionPending( context ) ) { \
JS_ReportError( context, __VA_ARGS__ ); \
} \

View File

@ -60,7 +60,7 @@ extern "C"
}
else
{
CCLog("can not get file data of %s", filename.c_str());
log("can not get file data of %s", filename.c_str());
}
return 1;