removes `using namespace std` from header file

... in order to prevent possible collisions.

`using namespace XXX` MUST never be used in header files.
This commit is contained in:
Ricardo Quesada 2013-12-18 11:45:30 -08:00
parent 903844c7bd
commit d1b555614e
18 changed files with 144 additions and 152 deletions

View File

@ -27,8 +27,6 @@ THE SOFTWARE.
#include "cocostudio/CCArmatureDefine.h" #include "cocostudio/CCArmatureDefine.h"
#include <stack> #include <stack>
using namespace std;
namespace cocostudio { namespace cocostudio {
/** /**

View File

@ -316,7 +316,7 @@ void ActionSkew::onEnter()
_kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), NULL)); _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), NULL));
} }
string ActionSkew::subtitle() std::string ActionSkew::subtitle()
{ {
return "SkewTo / SkewBy"; return "SkewTo / SkewBy";
} }
@ -438,7 +438,7 @@ void ActionSkewRotateScale::onEnter()
box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL)); box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL));
} }
string ActionSkewRotateScale::subtitle() std::string ActionSkewRotateScale::subtitle()
{ {
return "Skew + Rotate + Scale"; return "Skew + Rotate + Scale";
} }
@ -2040,12 +2040,12 @@ void ActionCatmullRom::draw()
DrawPrimitives::drawCatmullRom(_array2,50); DrawPrimitives::drawCatmullRom(_array2,50);
} }
string ActionCatmullRom::title() std::string ActionCatmullRom::title()
{ {
return "CatmullRomBy / CatmullRomTo"; return "CatmullRomBy / CatmullRomTo";
} }
string ActionCatmullRom::subtitle() std::string ActionCatmullRom::subtitle()
{ {
return "Catmull Rom spline paths. Testing reverse too"; return "Catmull Rom spline paths. Testing reverse too";
} }
@ -2123,12 +2123,12 @@ void ActionCardinalSpline::draw()
kmGLPopMatrix(); kmGLPopMatrix();
} }
string ActionCardinalSpline::title() std::string ActionCardinalSpline::title()
{ {
return "CardinalSplineBy / CardinalSplineTo"; return "CardinalSplineBy / CardinalSplineTo";
} }
string ActionCardinalSpline::subtitle() std::string ActionCardinalSpline::subtitle()
{ {
return "Cardinal Spline paths. Testing different tensions for one array"; return "Cardinal Spline paths. Testing different tensions for one array";
} }
@ -2160,12 +2160,12 @@ void PauseResumeActions::onEnter()
this->schedule(schedule_selector(PauseResumeActions::resume), 5, false, 0); this->schedule(schedule_selector(PauseResumeActions::resume), 5, false, 0);
} }
string PauseResumeActions::title() std::string PauseResumeActions::title()
{ {
return "PauseResumeActions"; return "PauseResumeActions";
} }
string PauseResumeActions::subtitle() std::string PauseResumeActions::subtitle()
{ {
return "All actions pause at 3s and resume at 5s"; return "All actions pause at 3s and resume at 5s";
} }

View File

@ -82,12 +82,12 @@ void FileUtilsDemo::restartCallback(Object* sender)
scene->release(); scene->release();
} }
string FileUtilsDemo::title() std::string FileUtilsDemo::title()
{ {
return "No title"; return "No title";
} }
string FileUtilsDemo::subtitle() std::string FileUtilsDemo::subtitle()
{ {
return ""; return "";
} }
@ -99,16 +99,16 @@ void TestResolutionDirectories::onEnter()
FileUtilsDemo::onEnter(); FileUtilsDemo::onEnter();
auto sharedFileUtils = FileUtils::getInstance(); auto sharedFileUtils = FileUtils::getInstance();
string ret; std::string ret;
sharedFileUtils->purgeCachedEntries(); sharedFileUtils->purgeCachedEntries();
_defaultSearchPathArray = sharedFileUtils->getSearchPaths(); _defaultSearchPathArray = sharedFileUtils->getSearchPaths();
vector<string> searchPaths = _defaultSearchPathArray; std::vector<std::string> searchPaths = _defaultSearchPathArray;
searchPaths.insert(searchPaths.begin(), "Misc"); searchPaths.insert(searchPaths.begin(), "Misc");
sharedFileUtils->setSearchPaths(searchPaths); sharedFileUtils->setSearchPaths(searchPaths);
_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder(); _defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
vector<string> resolutionsOrder = _defaultResolutionsOrderArray; std::vector<std::string> resolutionsOrder = _defaultResolutionsOrderArray;
resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipadhd"); resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipadhd");
resolutionsOrder.insert(resolutionsOrder.begin()+1, "resources-ipad"); resolutionsOrder.insert(resolutionsOrder.begin()+1, "resources-ipad");
@ -136,12 +136,12 @@ void TestResolutionDirectories::onExit()
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
string TestResolutionDirectories::title() std::string TestResolutionDirectories::title()
{ {
return "FileUtils: resolutions in directories"; return "FileUtils: resolutions in directories";
} }
string TestResolutionDirectories::subtitle() std::string TestResolutionDirectories::subtitle()
{ {
return "See the console"; return "See the console";
} }
@ -153,13 +153,13 @@ void TestSearchPath::onEnter()
FileUtilsDemo::onEnter(); FileUtilsDemo::onEnter();
auto sharedFileUtils = FileUtils::getInstance(); auto sharedFileUtils = FileUtils::getInstance();
string ret; std::string ret;
sharedFileUtils->purgeCachedEntries(); sharedFileUtils->purgeCachedEntries();
_defaultSearchPathArray = sharedFileUtils->getSearchPaths(); _defaultSearchPathArray = sharedFileUtils->getSearchPaths();
vector<string> searchPaths = _defaultSearchPathArray; std::vector<std::string> searchPaths = _defaultSearchPathArray;
string writablePath = sharedFileUtils->getWritablePath(); std::string writablePath = sharedFileUtils->getWritablePath();
string fileName = writablePath+"external.txt"; std::string fileName = writablePath+"external.txt";
char szBuf[100] = "Hello Cocos2d-x!"; char szBuf[100] = "Hello Cocos2d-x!";
FILE* fp = fopen(fileName.c_str(), "wb"); FILE* fp = fopen(fileName.c_str(), "wb");
if (fp) if (fp)
@ -177,7 +177,7 @@ void TestSearchPath::onEnter()
sharedFileUtils->setSearchPaths(searchPaths); sharedFileUtils->setSearchPaths(searchPaths);
_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder(); _defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
vector<string> resolutionsOrder = _defaultResolutionsOrderArray; std::vector<std::string> resolutionsOrder = _defaultResolutionsOrderArray;
resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipad"); resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipad");
sharedFileUtils->setSearchResolutionsOrder(resolutionsOrder); sharedFileUtils->setSearchResolutionsOrder(resolutionsOrder);
@ -189,7 +189,7 @@ void TestSearchPath::onEnter()
} }
// Gets external.txt from writable path // Gets external.txt from writable path
string fullPath = sharedFileUtils->fullPathForFilename("external.txt"); std::string fullPath = sharedFileUtils->fullPathForFilename("external.txt");
log("external file path = %s", fullPath.c_str()); log("external file path = %s", fullPath.c_str());
if (fullPath.length() > 0) if (fullPath.length() > 0)
{ {
@ -215,12 +215,12 @@ void TestSearchPath::onExit()
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
string TestSearchPath::title() std::string TestSearchPath::title()
{ {
return "FileUtils: search path"; return "FileUtils: search path";
} }
string TestSearchPath::subtitle() std::string TestSearchPath::subtitle()
{ {
return "See the console"; return "See the console";
} }
@ -258,12 +258,12 @@ void TestFilenameLookup::onExit()
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
string TestFilenameLookup::title() std::string TestFilenameLookup::title()
{ {
return "FileUtils: filename lookup"; return "FileUtils: filename lookup";
} }
string TestFilenameLookup::subtitle() std::string TestFilenameLookup::subtitle()
{ {
return "See the console"; return "See the console";
} }
@ -302,12 +302,12 @@ void TestIsFileExist::onExit()
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
string TestIsFileExist::title() std::string TestIsFileExist::title()
{ {
return "FileUtils: check whether the file exists"; return "FileUtils: check whether the file exists";
} }
string TestIsFileExist::subtitle() std::string TestIsFileExist::subtitle()
{ {
return ""; return "";
} }
@ -361,12 +361,12 @@ void TextWritePlist::onExit()
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
string TextWritePlist::title() std::string TextWritePlist::title()
{ {
return "FileUtils: Dictionary to plist"; return "FileUtils: Dictionary to plist";
} }
string TextWritePlist::subtitle() std::string TextWritePlist::subtitle()
{ {
std::string writablePath = FileUtils::getInstance()->getWritablePath().c_str(); std::string writablePath = FileUtils::getInstance()->getWritablePath().c_str();
return ("See plist file at your writablePath"); return ("See plist file at your writablePath");

View File

@ -5,7 +5,6 @@
#include "../BaseTest.h" #include "../BaseTest.h"
USING_NS_CC; USING_NS_CC;
using namespace std;
class FileUtilsTestScene : public TestScene class FileUtilsTestScene : public TestScene
{ {
@ -17,8 +16,8 @@ class FileUtilsDemo : public BaseTest
{ {
public: public:
virtual void onEnter(); virtual void onEnter();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
void backCallback(Object* sender); void backCallback(Object* sender);
void nextCallback(Object* sender); void nextCallback(Object* sender);
void restartCallback(Object* sender); void restartCallback(Object* sender);
@ -31,11 +30,11 @@ public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
private: private:
vector<string> _defaultSearchPathArray; std::vector<std::string> _defaultSearchPathArray;
vector<string> _defaultResolutionsOrderArray; std::vector<std::string> _defaultResolutionsOrderArray;
}; };
class TestSearchPath : public FileUtilsDemo class TestSearchPath : public FileUtilsDemo
@ -45,11 +44,11 @@ public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
private: private:
vector<string> _defaultSearchPathArray; std::vector<std::string> _defaultSearchPathArray;
vector<string> _defaultResolutionsOrderArray; std::vector<std::string> _defaultResolutionsOrderArray;
}; };
class TestFilenameLookup : public FileUtilsDemo class TestFilenameLookup : public FileUtilsDemo
@ -59,8 +58,8 @@ public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
}; };
class TestIsFileExist : public FileUtilsDemo class TestIsFileExist : public FileUtilsDemo
@ -70,8 +69,8 @@ public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
}; };
class TextWritePlist : public FileUtilsDemo class TextWritePlist : public FileUtilsDemo
@ -81,8 +80,8 @@ public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit(); virtual void onExit();
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
}; };
#endif /* __FILEUTILSTEST_H__ */ #endif /* __FILEUTILSTEST_H__ */

View File

@ -38,12 +38,12 @@ MouseTest::~MouseTest()
_labelPosition->release(); _labelPosition->release();
} }
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); } template <typename T> std::string tostr(const T& t) { std::ostringstream os; os<<t; return os.str(); }
void MouseTest::onMouseDown(Event *event) void MouseTest::onMouseDown(Event *event)
{ {
EventMouse* e = (EventMouse*)event; EventMouse* e = (EventMouse*)event;
string str = "Mouse Down detected, Key: "; std::string str = "Mouse Down detected, Key: ";
str += tostr(e->getMouseButton()); str += tostr(e->getMouseButton());
_labelAction->setString(str.c_str()); _labelAction->setString(str.c_str());
} }
@ -51,7 +51,7 @@ void MouseTest::onMouseDown(Event *event)
void MouseTest::onMouseUp(Event *event) void MouseTest::onMouseUp(Event *event)
{ {
EventMouse* e = (EventMouse*)event; EventMouse* e = (EventMouse*)event;
string str = "Mouse Up detected, Key: "; std::string str = "Mouse Up detected, Key: ";
str += tostr(e->getMouseButton()); str += tostr(e->getMouseButton());
_labelAction->setString(str.c_str()); _labelAction->setString(str.c_str());
} }
@ -59,7 +59,7 @@ void MouseTest::onMouseUp(Event *event)
void MouseTest::onMouseMove(Event *event) void MouseTest::onMouseMove(Event *event)
{ {
EventMouse* e = (EventMouse*)event; EventMouse* e = (EventMouse*)event;
string str = "MousePosition X:"; std::string str = "MousePosition X:";
str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY()); str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY());
_labelPosition->setString(str.c_str()); _labelPosition->setString(str.c_str());
} }
@ -67,7 +67,7 @@ void MouseTest::onMouseMove(Event *event)
void MouseTest::onMouseScroll(Event *event) void MouseTest::onMouseScroll(Event *event)
{ {
EventMouse* e = (EventMouse*)event; EventMouse* e = (EventMouse*)event;
string str = "Mouse Scroll detected, X: "; std::string str = "Mouse Scroll detected, X: ";
str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY()); str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY());
_labelAction->setString(str.c_str()); _labelAction->setString(str.c_str());
} }

View File

@ -1046,12 +1046,12 @@ const char* LabelTTFTest::getCurrentAlignment()
return String::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString(); return String::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString();
} }
string LabelTTFTest::title() std::string LabelTTFTest::title()
{ {
return "Testing LabelTTF"; return "Testing LabelTTF";
} }
string LabelTTFTest::subtitle() std::string LabelTTFTest::subtitle()
{ {
return "Select the buttons on the sides to change alignment"; return "Select the buttons on the sides to change alignment";
} }
@ -1072,12 +1072,12 @@ LabelTTFMultiline::LabelTTFMultiline()
addChild(center); addChild(center);
} }
string LabelTTFMultiline::title() std::string LabelTTFMultiline::title()
{ {
return "Testing LabelTTF Word Wrap"; return "Testing LabelTTF Word Wrap";
} }
string LabelTTFMultiline::subtitle() std::string LabelTTFMultiline::subtitle()
{ {
return "Word wrap using LabelTTF and a custom TTF font"; return "Word wrap using LabelTTF and a custom TTF font";
} }
@ -1090,7 +1090,7 @@ LabelTTFChinese::LabelTTFChinese()
this->addChild(label); this->addChild(label);
} }
string LabelTTFChinese::title() std::string LabelTTFChinese::title()
{ {
return "Testing LabelTTF with Chinese character"; return "Testing LabelTTF with Chinese character";
} }
@ -1103,7 +1103,7 @@ LabelBMFontChinese::LabelBMFontChinese()
this->addChild(label); this->addChild(label);
} }
string LabelBMFontChinese::title() std::string LabelBMFontChinese::title()
{ {
return "Testing LabelBMFont with Chinese character"; return "Testing LabelBMFont with Chinese character";
} }
@ -1583,12 +1583,12 @@ LabelBMFontBounds::LabelBMFontBounds()
label1->setPosition(Point(s.width/2, s.height/2)); label1->setPosition(Point(s.width/2, s.height/2));
} }
string LabelBMFontBounds::title() std::string LabelBMFontBounds::title()
{ {
return "Testing LabelBMFont Bounds"; return "Testing LabelBMFont Bounds";
} }
string LabelBMFontBounds::subtitle() std::string LabelBMFontBounds::subtitle()
{ {
return "You should see string enclosed by a box"; return "You should see string enclosed by a box";
} }

View File

@ -599,7 +599,7 @@ std::string LabelTTFUnicodeChinese::title()
return "New Label + .TTF file Chinese"; return "New Label + .TTF file Chinese";
} }
string LabelTTFUnicodeChinese::subtitle() std::string LabelTTFUnicodeChinese::subtitle()
{ {
return "Testing new Label + TTF with Chinese character"; return "Testing new Label + TTF with Chinese character";
} }
@ -613,12 +613,12 @@ LabelFNTUnicodeChinese::LabelFNTUnicodeChinese()
this->addChild(label); this->addChild(label);
} }
string LabelFNTUnicodeChinese::title() std::string LabelFNTUnicodeChinese::title()
{ {
return "New Label + .FNT file Chinese"; return "New Label + .FNT file Chinese";
} }
string LabelFNTUnicodeChinese::subtitle() std::string LabelFNTUnicodeChinese::subtitle()
{ {
return "Testing new Label + FNT with Chinese character"; return "Testing new Label + FNT with Chinese character";
} }
@ -885,12 +885,12 @@ LabelFNTBounds::LabelFNTBounds()
label1->setPosition(Point(s.width/2, s.height/2)); label1->setPosition(Point(s.width/2, s.height/2));
} }
string LabelFNTBounds::title() std::string LabelFNTBounds::title()
{ {
return "New Label + .FNT + Bounds"; return "New Label + .FNT + Bounds";
} }
string LabelFNTBounds::subtitle() std::string LabelFNTBounds::subtitle()
{ {
return "You should see string enclosed by a box"; return "You should see string enclosed by a box";
} }

View File

@ -68,7 +68,7 @@ LayerTest::~LayerTest(void)
{ {
} }
string LayerTest::subtitle() std::string LayerTest::subtitle()
{ {
return ""; return "";
} }
@ -626,7 +626,7 @@ std::string LayerGradientTest::title()
return "LayerGradientTest"; return "LayerGradientTest";
} }
string LayerGradientTest::subtitle() std::string LayerGradientTest::subtitle()
{ {
return "Touch the screen and move your finger"; return "Touch the screen and move your finger";
} }
@ -649,7 +649,7 @@ std::string LayerGradientTest2::title()
return "LayerGradientTest 2"; return "LayerGradientTest 2";
} }
string LayerGradientTest2::subtitle() std::string LayerGradientTest2::subtitle()
{ {
return "You should see a gradient"; return "You should see a gradient";
} }
@ -671,7 +671,7 @@ std::string LayerGradientTest3::title()
return "LayerGradientTest 3"; return "LayerGradientTest 3";
} }
string LayerGradientTest3::subtitle() std::string LayerGradientTest3::subtitle()
{ {
return "You should see a gradient"; return "You should see a gradient";
} }
@ -858,12 +858,12 @@ LayerExtendedBlendOpacityTest::LayerExtendedBlendOpacityTest()
addChild(layer3); addChild(layer3);
} }
string LayerExtendedBlendOpacityTest::title() std::string LayerExtendedBlendOpacityTest::title()
{ {
return "Extended Blend & Opacity"; return "Extended Blend & Opacity";
} }
string LayerExtendedBlendOpacityTest::subtitle() std::string LayerExtendedBlendOpacityTest::subtitle()
{ {
return "You should see 3 layers"; return "You should see 3 layers";
} }

View File

@ -104,12 +104,12 @@ void EventDispatcherTestDemo::restartCallback(Object* sender)
scene->release(); scene->release();
} }
string EventDispatcherTestDemo::title() std::string EventDispatcherTestDemo::title()
{ {
return "No title"; return "No title";
} }
string EventDispatcherTestDemo::subtitle() std::string EventDispatcherTestDemo::subtitle()
{ {
return ""; return "";
} }

View File

@ -88,12 +88,12 @@ MultiSceneTest::~MultiSceneTest()
} }
string MultiSceneTest::title() std::string MultiSceneTest::title()
{ {
return BaseTest::title(); return BaseTest::title();
} }
string MultiSceneTest::subtitle() std::string MultiSceneTest::subtitle()
{ {
return BaseTest::subtitle(); return BaseTest::subtitle();
} }
@ -211,13 +211,12 @@ void NewSpriteTest::onTouchesEnded(const std::vector<Touch *> &touches, Event *e
} }
std::string NewSpriteTest::title()
string NewSpriteTest::title()
{ {
return "NewRender"; return "NewRender";
} }
string NewSpriteTest::subtitle() std::string NewSpriteTest::subtitle()
{ {
return "SpriteTest"; return "SpriteTest";
} }
@ -239,17 +238,17 @@ NewSpriteBatchTest::~NewSpriteBatchTest()
} }
string NewSpriteBatchTest::title() std::string NewSpriteBatchTest::title()
{ {
return "NewRender"; return "NewRender";
} }
string NewSpriteBatchTest::subtitle() std::string NewSpriteBatchTest::subtitle()
{ {
return "SpriteBatchTest"; return "SpriteBatchTest";
} }
void NewSpriteBatchTest::onTouchesEnded(const vector<Touch *> &touches, Event *event) void NewSpriteBatchTest::onTouchesEnded(const std::vector<Touch *> &touches, Event *event)
{ {
for (auto &touch : touches) for (auto &touch : touches)
{ {
@ -343,12 +342,12 @@ NewClippingNodeTest::~NewClippingNodeTest()
} }
string NewClippingNodeTest::title() std::string NewClippingNodeTest::title()
{ {
return "New Render"; return "New Render";
} }
string NewClippingNodeTest::subtitle() std::string NewClippingNodeTest::subtitle()
{ {
return "ClipNode"; return "ClipNode";
} }
@ -392,7 +391,7 @@ NewDrawNodeTest::NewDrawNodeTest()
parent->setPosition(s.width/2, s.height/2); parent->setPosition(s.width/2, s.height/2);
addChild(parent); addChild(parent);
auto rectNode = NewDrawNode::create(); auto rectNode = DrawNode::create();
Point rectangle[4]; Point rectangle[4];
rectangle[0] = Point(-50, -50); rectangle[0] = Point(-50, -50);
rectangle[1] = Point(50, -50); rectangle[1] = Point(50, -50);
@ -409,12 +408,12 @@ NewDrawNodeTest::~NewDrawNodeTest()
} }
string NewDrawNodeTest::title() std::string NewDrawNodeTest::title()
{ {
return "New Render"; return "New Render";
} }
string NewDrawNodeTest::subtitle() std::string NewDrawNodeTest::subtitle()
{ {
return "DrawNode"; return "DrawNode";
} }
@ -423,7 +422,7 @@ NewCullingTest::NewCullingTest()
{ {
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
std::vector<string> images; std::vector<std::string> images;
images.push_back("Images/grossini_dance_01.png"); images.push_back("Images/grossini_dance_01.png");
images.push_back("Images/grossini_dance_02.png"); images.push_back("Images/grossini_dance_02.png");
images.push_back("Images/grossini_dance_03.png"); images.push_back("Images/grossini_dance_03.png");
@ -476,12 +475,12 @@ NewCullingTest::~NewCullingTest()
} }
string NewCullingTest::title() std::string NewCullingTest::title()
{ {
return "New Render"; return "New Render";
} }
string NewCullingTest::subtitle() std::string NewCullingTest::subtitle()
{ {
return "Culling"; return "Culling";
} }

View File

@ -11,8 +11,6 @@
#include "../testBasic.h" #include "../testBasic.h"
#include "../BaseTest.h" #include "../BaseTest.h"
using namespace std;
#define kTagSpriteBatchNode 100 #define kTagSpriteBatchNode 100
#define kTagClipperNode 101 #define kTagClipperNode 101
#define kTagContentNode 102 #define kTagContentNode 102
@ -27,8 +25,8 @@ class MultiSceneTest : public BaseTest
{ {
public: public:
CREATE_FUNC(MultiSceneTest); CREATE_FUNC(MultiSceneTest);
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
virtual void onEnter(); virtual void onEnter();
void restartCallback(Object* sender); void restartCallback(Object* sender);
@ -46,8 +44,8 @@ class NewSpriteTest : public MultiSceneTest
public: public:
CREATE_FUNC(NewSpriteTest); CREATE_FUNC(NewSpriteTest);
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
void createSpriteTest(); void createSpriteTest();
void createNewSpriteTest(); void createNewSpriteTest();
@ -63,10 +61,10 @@ class NewSpriteBatchTest : public MultiSceneTest
public: public:
CREATE_FUNC(NewSpriteBatchTest); CREATE_FUNC(NewSpriteBatchTest);
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
void onTouchesEnded(const vector<Touch*>& touches, Event* event); void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
void addNewSpriteWithCoords(Point p); void addNewSpriteWithCoords(Point p);
protected: protected:
@ -79,8 +77,8 @@ class NewClippingNodeTest : public MultiSceneTest
public: public:
CREATE_FUNC(NewClippingNodeTest); CREATE_FUNC(NewClippingNodeTest);
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event); void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event); void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
@ -99,8 +97,8 @@ class NewDrawNodeTest : public MultiSceneTest
public: public:
CREATE_FUNC(NewDrawNodeTest) CREATE_FUNC(NewDrawNodeTest)
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
protected: protected:
NewDrawNodeTest(); NewDrawNodeTest();
@ -112,8 +110,8 @@ class NewCullingTest : public MultiSceneTest
public: public:
CREATE_FUNC(NewCullingTest) CREATE_FUNC(NewCullingTest)
virtual string title(); virtual std::string title();
virtual string subtitle(); virtual std::string subtitle();
protected: protected:
NewCullingTest(); NewCullingTest();

View File

@ -121,12 +121,12 @@ RenderTextureSave::RenderTextureSave()
menu->setPosition(Point(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); menu->setPosition(Point(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30));
} }
string RenderTextureSave::title() std::string RenderTextureSave::title()
{ {
return "Touch the screen"; return "Touch the screen";
} }
string RenderTextureSave::subtitle() std::string RenderTextureSave::subtitle()
{ {
return "Press 'Save Image' to create an snapshot of the render texture"; return "Press 'Save Image' to create an snapshot of the render texture";
} }
@ -354,12 +354,12 @@ RenderTextureZbuffer::RenderTextureZbuffer()
sp9->setColor(Color3B::YELLOW); sp9->setColor(Color3B::YELLOW);
} }
string RenderTextureZbuffer::title() std::string RenderTextureZbuffer::title()
{ {
return "Testing Z Buffer in Render Texture"; return "Testing Z Buffer in Render Texture";
} }
string RenderTextureZbuffer::subtitle() std::string RenderTextureZbuffer::subtitle()
{ {
return "Touch screen. It should be green"; return "Touch screen. It should be green";
} }
@ -557,12 +557,12 @@ void RenderTextureTargetNode::update(float dt)
time += dt; time += dt;
} }
string RenderTextureTargetNode::title() std::string RenderTextureTargetNode::title()
{ {
return "Testing Render Target Node"; return "Testing Render Target Node";
} }
string RenderTextureTargetNode::subtitle() std::string RenderTextureTargetNode::subtitle()
{ {
return "Sprites should be equal and move with each frame"; return "Sprites should be equal and move with each frame";
} }

View File

@ -744,12 +744,12 @@ ShaderFail::ShaderFail()
p->release(); p->release();
} }
string ShaderFail::title() std::string ShaderFail::title()
{ {
return "Shader: Invalid shader"; return "Shader: Invalid shader";
} }
string ShaderFail::subtitle() std::string ShaderFail::subtitle()
{ {
return "See console for output with useful error log"; return "See console for output with useful error log";
} }

View File

@ -1 +1 @@
64530cc9f89e92fb0946c9c3c6311f6c07741419 887344c810ec00253c0de1e8080a9d9b5b4ff92f

View File

@ -803,12 +803,12 @@ void TexturePVR2BPPv3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVR2BPPv3::title() std::string TexturePVR2BPPv3::title()
{ {
return "PVR TC 2bpp Test"; return "PVR TC 2bpp Test";
} }
string TexturePVR2BPPv3::subtitle() std::string TexturePVR2BPPv3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -830,12 +830,12 @@ void TexturePVRII2BPPv3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRII2BPPv3::title() std::string TexturePVRII2BPPv3::title()
{ {
return "PVR TC II 2bpp Test"; return "PVR TC II 2bpp Test";
} }
string TexturePVRII2BPPv3::subtitle() std::string TexturePVRII2BPPv3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -861,12 +861,12 @@ void TexturePVR4BPPv3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVR4BPPv3::title() std::string TexturePVR4BPPv3::title()
{ {
return "PVR TC 4bpp Test"; return "PVR TC 4bpp Test";
} }
string TexturePVR4BPPv3::subtitle() std::string TexturePVR4BPPv3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -896,12 +896,12 @@ void TexturePVRII4BPPv3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRII4BPPv3::title() std::string TexturePVRII4BPPv3::title()
{ {
return "PVR TC II 4bpp Test"; return "PVR TC II 4bpp Test";
} }
string TexturePVRII4BPPv3::subtitle() std::string TexturePVRII4BPPv3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -923,12 +923,12 @@ void TexturePVRRGBA8888v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRRGBA8888v3::title() std::string TexturePVRRGBA8888v3::title()
{ {
return "PVR + RGBA 8888 Test"; return "PVR + RGBA 8888 Test";
} }
string TexturePVRRGBA8888v3::subtitle() std::string TexturePVRRGBA8888v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -954,12 +954,12 @@ void TexturePVRBGRA8888v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRBGRA8888v3::title() std::string TexturePVRBGRA8888v3::title()
{ {
return "PVR + BGRA 8888 Test"; return "PVR + BGRA 8888 Test";
} }
string TexturePVRBGRA8888v3::subtitle() std::string TexturePVRBGRA8888v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -981,12 +981,12 @@ void TexturePVRRGBA5551v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRRGBA5551v3::title() std::string TexturePVRRGBA5551v3::title()
{ {
return "PVR + RGBA 5551 Test"; return "PVR + RGBA 5551 Test";
} }
string TexturePVRRGBA5551v3::subtitle() std::string TexturePVRRGBA5551v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1008,12 +1008,12 @@ void TexturePVRRGBA4444v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRRGBA4444v3::title() std::string TexturePVRRGBA4444v3::title()
{ {
return "PVR + RGBA 4444 Test"; return "PVR + RGBA 4444 Test";
} }
string TexturePVRRGBA4444v3::subtitle() std::string TexturePVRRGBA4444v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1035,12 +1035,12 @@ void TexturePVRRGB565v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRRGB565v3::title() std::string TexturePVRRGB565v3::title()
{ {
return "PVR + RGB 565 Test"; return "PVR + RGB 565 Test";
} }
string TexturePVRRGB565v3::subtitle() std::string TexturePVRRGB565v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1062,12 +1062,12 @@ void TexturePVRRGB888v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRRGB888v3::title() std::string TexturePVRRGB888v3::title()
{ {
return "PVR + RGB 888 Test"; return "PVR + RGB 888 Test";
} }
string TexturePVRRGB888v3::subtitle() std::string TexturePVRRGB888v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1089,12 +1089,12 @@ void TexturePVRA8v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRA8v3::title() std::string TexturePVRA8v3::title()
{ {
return "PVR + A8 Test"; return "PVR + A8 Test";
} }
string TexturePVRA8v3::subtitle() std::string TexturePVRA8v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1116,12 +1116,12 @@ void TexturePVRI8v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRI8v3::title() std::string TexturePVRI8v3::title()
{ {
return "PVR + I8 Test"; return "PVR + I8 Test";
} }
string TexturePVRI8v3::subtitle() std::string TexturePVRI8v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1143,12 +1143,12 @@ void TexturePVRAI88v3::onEnter()
Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); Director::getInstance()->getTextureCache()->dumpCachedTextureInfo();
} }
string TexturePVRAI88v3::title() std::string TexturePVRAI88v3::title()
{ {
return "PVR + AI88 Test"; return "PVR + AI88 Test";
} }
string TexturePVRAI88v3::subtitle() std::string TexturePVRAI88v3::subtitle()
{ {
return "Testing PVR File Format v3"; return "Testing PVR File Format v3";
} }
@ -1889,7 +1889,7 @@ void TextureMemoryAlloc::updateImage(cocos2d::Object *sender)
Director::getInstance()->getTextureCache()->removeUnusedTextures(); Director::getInstance()->getTextureCache()->removeUnusedTextures();
int tag = ((Node*)sender)->getTag(); int tag = ((Node*)sender)->getTag();
string file; std::string file;
switch (tag) switch (tag)
{ {
case 0: case 0:
@ -1934,12 +1934,12 @@ void TextureMemoryAlloc::updateImage(cocos2d::Object *sender)
_background->setPosition(Point(s.width/2, s.height/2)); _background->setPosition(Point(s.width/2, s.height/2));
} }
string TextureMemoryAlloc::title() std::string TextureMemoryAlloc::title()
{ {
return "Texture memory"; return "Texture memory";
} }
string TextureMemoryAlloc::subtitle() std::string TextureMemoryAlloc::subtitle()
{ {
return "Testing Texture Memory allocation. Use Instruments + VM Tracker"; return "Testing Texture Memory allocation. Use Instruments + VM Tracker";
} }

View File

@ -782,7 +782,7 @@ void TMXIsoZorder::repositionSprite(float dt)
// if tamara < 144,z=2 // if tamara < 144,z=2
int newZ = 4 - (p.y / 48); int newZ = 4 - (p.y / 48);
newZ = max(newZ,0); newZ = std::max(newZ,0);
map->reorderChild(_tamara, newZ); map->reorderChild(_tamara, newZ);
} }
@ -843,7 +843,7 @@ void TMXOrthoZorder::repositionSprite(float dt)
// -10: customization for this particular sample // -10: customization for this particular sample
int newZ = 4 - ( (p.y-10) / 81); int newZ = 4 - ( (p.y-10) / 81);
newZ = max(newZ,0); newZ = std::max(newZ,0);
map->reorderChild(_tamara, newZ); map->reorderChild(_tamara, newZ);
} }
@ -1184,8 +1184,8 @@ void TMXOrthoFlipRunTimeTest::flipIt(float dt)
TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
{ {
string resources = "TileMaps"; // partial paths are OK as resource paths. std::string resources = "TileMaps"; // partial paths are OK as resource paths.
string file = resources + "/orthogonal-test1.tmx"; std::string file = resources + "/orthogonal-test1.tmx";
auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str());
CCASSERT(str != NULL, "Unable to open file"); CCASSERT(str != NULL, "Unable to open file");
@ -1469,12 +1469,12 @@ void TMXGIDObjectsTest::draw()
} }
} }
string TMXGIDObjectsTest::title() std::string TMXGIDObjectsTest::title()
{ {
return "TMX GID objects"; return "TMX GID objects";
} }
string TMXGIDObjectsTest::subtitle() std::string TMXGIDObjectsTest::subtitle()
{ {
return "Tiles are created from an object group"; return "Tiles are created from an object group";
} }

View File

@ -29,7 +29,7 @@ void UserDefaultTest::doTest()
// print value // print value
string ret = UserDefault::getInstance()->getStringForKey("string"); std::string ret = UserDefault::getInstance()->getStringForKey("string");
CCLOG("string is %s", ret.c_str()); CCLOG("string is %s", ret.c_str());
double d = UserDefault::getInstance()->getDoubleForKey("double"); double d = UserDefault::getInstance()->getDoubleForKey("double");

View File

@ -6,8 +6,6 @@
USING_NS_CC; USING_NS_CC;
using namespace std;
class TestScene : public Scene class TestScene : public Scene
{ {
public: public: