diff --git a/.travis.yml b/.travis.yml
index 758f46af9da5..60d4bc156249 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,37 @@
language: cpp
script:
- - export NACL_SDK_ROOT=$PWD/nacl_sdk/pepper_canary
- - export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin
- - make -j4
-install:
- - "if [ \"$PLATFORM\" != nacl ]; then ./install-deps-linux.sh; fi"
- - "if [ \"$PLATFORM\" = nacl ]; then sudo apt-get update; fi"
- - "if [ \"$PLATFORM\" = nacl ]; then sudo apt-get install libc6:i386; fi"
- - "if [ \"$PLATFORM\" = nacl ]; then wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip; fi"
- - "if [ \"$PLATFORM\" = nacl ]; then unzip nacl_sdk.zip; fi"
- - "if [ \"$PLATFORM\" = nacl ]; then nacl_sdk/naclsdk update --force pepper_canary; fi"
+ - if [ $PLATFORM = android ]; then export NDK_ROOT=$PWD/android-ndk; fi
+ - if [ $PLATFORM = android ]; then cd samples/$SAMPLE_LANG/$APPNAME/proj.android; fi
+ - if [ $PLATFORM = android ]; then ./build_native.sh; fi
+ - if [ $PLATFORM != android ]; then export NACL_SDK_ROOT=$PWD/nacl_sdk/pepper_canary; fi
+ - if [ $PLATFORM != android ]; then export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin; fi
+ - if [ $PLATFORM != android ]; then make -j4; fi
+before_install:
+ - if [ $PLATFORM = linux ]; then ./install-deps-linux.sh; fi
+ - if [ $PLATFORM = nacl ]; then sudo apt-get update; fi
+ - if [ $PLATFORM = nacl ]; then sudo apt-get install libc6:i386; fi
+ - if [ $PLATFORM = nacl ]; then wget http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip; fi
+ - if [ $PLATFORM = nacl ]; then unzip nacl_sdk.zip; fi
+ - if [ $PLATFORM = nacl ]; then nacl_sdk/naclsdk update --force pepper_canary; fi
+ - if [ $PLATFORM = android ]; then curl -O http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2; fi
+ - if [ $PLATFORM = android ]; then tar xjf android-ndk-r8e-linux-x86_64.tar.bz2; fi
+ - if [ $PLATFORM = android ]; then mv android-ndk-r8e android-ndk; fi
env:
- PLATFORM=nacl DEBUG=1
- PLATFORM=nacl DEBUG=0
- PLATFORM=linux DEBUG=1
- PLATFORM=linux DEBUG=0
+ - PLATFORM=android SAMPLE_LANG=Cpp APPNAME=HelloCpp
+ - PLATFORM=android SAMPLE_LANG=Cpp APPNAME=TestCpp
+ - PLATFORM=android SAMPLE_LANG=Cpp APPNAME=SimpleGame
+ - PLATFORM=android SAMPLE_LANG=Cpp APPNAME=AssetsManagerTest
+ - PLATFORM=android SAMPLE_LANG=Javascript APPNAME=CocosDragonJS
+ - PLATFORM=android SAMPLE_LANG=Javascript APPNAME=CrystalCraze
+ - PLATFORM=android SAMPLE_LANG=Javascript APPNAME=MoonWarriors
+ - PLATFORM=android SAMPLE_LANG=Javascript APPNAME=TestJavascript
+ - PLATFORM=android SAMPLE_LANG=Javascript APPNAME=WatermelonWithMe
+ - PLATFORM=android SAMPLE_LANG=Lua APPNAME=HelloLua
+ - PLATFORM=android SAMPLE_LANG=Lua APPNAME=TestLua
+branches:
+ only:
+ - master
diff --git a/README.mdown b/README.mdown
index 63672aa3f2c7..50603485b779 100644
--- a/README.mdown
+++ b/README.mdown
@@ -1,7 +1,7 @@
cocos2d-x
=========
-[![Build Status](https://travis-ci.org/sbc100/cocos2d-x.png?branch=travis)](https://travis-ci.org/sbc100/cocos2d-x)
+[![Build Status](https://travis-ci.org/dumganhar/cocos2d-x.png?branch=master)](https://travis-ci.org/dumganhar/cocos2d-x)
[cocos2d-x][1] is a multi-platform 2D game framework in C++, branched on
[cocos2d-iphone][2] and licensed under MIT. The master branch on github uses
diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk
index 7f53d20bbd73..40cb3274a34c 100644
--- a/cocos2dx/Android.mk
+++ b/cocos2dx/Android.mk
@@ -35,6 +35,7 @@ cocoa/CCSet.cpp \
cocoa/CCString.cpp \
cocoa/CCZone.cpp \
cocoa/CCArray.cpp \
+cocoa/CCDataVisitor.cpp \
cocos2d.cpp \
CCDirector.cpp \
draw_nodes/CCDrawingPrimitives.cpp \
diff --git a/cocos2dx/cocoa/CCArray.cpp b/cocos2dx/cocoa/CCArray.cpp
index 42574fa41dfb..12e5bb2971c9 100644
--- a/cocos2dx/cocoa/CCArray.cpp
+++ b/cocos2dx/cocoa/CCArray.cpp
@@ -391,4 +391,9 @@ CCObject* CCArray::copyWithZone(CCZone* pZone)
return pArray;
}
+void CCArray::acceptVisitor(CCDataVisitor &visitor)
+{
+ visitor.visit(this);
+}
+
NS_CC_END
diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h
index 55baeaf37557..01c196f9b1ff 100644
--- a/cocos2dx/cocoa/CCArray.h
+++ b/cocos2dx/cocoa/CCArray.h
@@ -210,6 +210,9 @@ class CC_DLL CCArray : public CCObject
/* override functions */
virtual CCObject* copyWithZone(CCZone* pZone);
+ /* override functions */
+ virtual void acceptVisitor(CCDataVisitor &visitor);
+
public:
ccArray* data;
CCArray();
diff --git a/cocos2dx/cocoa/CCBool.h b/cocos2dx/cocoa/CCBool.h
index 7f49e03a808e..e2a172c519a3 100755
--- a/cocos2dx/cocoa/CCBool.h
+++ b/cocos2dx/cocoa/CCBool.h
@@ -50,6 +50,10 @@ class CC_DLL CCBool : public CCObject
}
return pRet;
}
+
+ /* override functions */
+ virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); }
+
private:
bool m_bValue;
};
diff --git a/cocos2dx/cocoa/CCDataVisitor.cpp b/cocos2dx/cocoa/CCDataVisitor.cpp
new file mode 100644
index 000000000000..9282c234e20f
--- /dev/null
+++ b/cocos2dx/cocoa/CCDataVisitor.cpp
@@ -0,0 +1,227 @@
+/****************************************************************************
+ Copyright (c) 2013 cocos2d-x.org
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#include "CCObject.h"
+#include "CCBool.h"
+#include "CCInteger.h"
+#include "CCFloat.h"
+#include "CCDouble.h"
+#include "CCString.h"
+#include "CCArray.h"
+#include "CCDictionary.h"
+#include "CCSet.h"
+
+NS_CC_BEGIN
+
+void CCDataVisitor::visit(const CCBool *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCInteger *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCFloat *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCDouble *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCString *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCArray *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCDictionary *value)
+{
+ visitObject(value);
+}
+
+void CCDataVisitor::visit(const CCSet *value)
+{
+ visitObject(value);
+}
+
+// CCPrettyPrinter
+CCPrettyPrinter::CCPrettyPrinter(int indentLevel/* = 0 */)
+{
+ setIndentLevel(indentLevel);
+}
+
+void CCPrettyPrinter::clear()
+{
+ _result.clear();
+}
+
+std::string CCPrettyPrinter::getResult()
+{
+ return _result;
+}
+
+void CCPrettyPrinter::visitObject(const CCObject *p)
+{
+ char buf[50] = {0};
+ sprintf(buf, "%p", p);
+ _result += buf;
+}
+
+void CCPrettyPrinter::visit(const CCBool * p)
+{
+ char buf[50] = {0};
+ sprintf(buf, "%s", p->getValue() ? "true" : "false");
+}
+
+void CCPrettyPrinter::visit(const CCInteger *p)
+{
+ char buf[50] = {0};
+ sprintf(buf, "%d", p->getValue());
+ _result += buf;
+}
+
+void CCPrettyPrinter::visit(const CCFloat *p)
+{
+ char buf[50] = {0};
+ sprintf(buf, "%f", p->getValue());
+ _result += buf;
+}
+
+void CCPrettyPrinter::visit(const CCDouble *p)
+{
+ char buf[50] = {0};
+ sprintf(buf, "%lf", p->getValue());
+ _result += buf;
+}
+
+void CCPrettyPrinter::visit(const CCString *p)
+{
+ _result += p->getCString();
+}
+
+void CCPrettyPrinter::visit(const CCArray *p)
+{
+ _result += "\n";
+ _result += _indentStr;
+ _result += "\n";
+
+ setIndentLevel(_indentLevel+1);
+ CCObject* obj;
+ int i = 0;
+ char buf[50] = {0};
+ CCARRAY_FOREACH(p, obj)
+ {
+ if (i > 0) {
+ _result += "\n";
+ }
+ sprintf(buf, "%s%02d: ", _indentStr.c_str(), i);
+ _result += buf;
+ CCPrettyPrinter v(_indentLevel);
+ obj->acceptVisitor(v);
+ _result += v.getResult();
+ i++;
+ }
+ setIndentLevel(_indentLevel-1);
+
+ _result += "\n";
+ _result += _indentStr;
+ _result += "";
+}
+
+void CCPrettyPrinter::visit(const CCDictionary *p)
+{
+ _result += "\n";
+ _result += _indentStr;
+ _result += "\n";
+
+ setIndentLevel(_indentLevel+1);
+ CCDictElement* element;
+ bool bFirstElement = true;
+ char buf[1000] = {0};
+ CCDICT_FOREACH(p, element)
+ {
+ if (!bFirstElement) {
+ _result += "\n";
+ }
+ sprintf(buf, "%s%s: ", _indentStr.c_str(),element->getStrKey());
+ _result += buf;
+ CCPrettyPrinter v(_indentLevel);
+ element->getObject()->acceptVisitor(v);
+ _result += v.getResult();
+ bFirstElement = false;
+ }
+ setIndentLevel(_indentLevel-1);
+
+ _result += "\n";
+ _result += _indentStr;
+ _result += "";
+}
+
+void CCPrettyPrinter::visit(const CCSet *p)
+{
+ _result += "\n";
+ _result += _indentStr;
+ _result += "\n";
+
+ setIndentLevel(_indentLevel+1);
+
+ int i = 0;
+ CCSet* tmp = const_cast(p);
+ CCSetIterator it = tmp->begin();
+
+ for (; it != tmp->end(); ++it, ++i) {
+ if (i > 0) {
+ _result += "\n";
+ }
+ _result += _indentStr.c_str();
+ CCPrettyPrinter v(_indentLevel);
+ (*it)->acceptVisitor(v);
+ _result += v.getResult();
+ }
+ setIndentLevel(_indentLevel-1);
+
+ _result += "\n";
+ _result += _indentStr;
+ _result += "\n";
+}
+
+void CCPrettyPrinter::setIndentLevel(int indentLevel)
+{
+ _indentLevel = indentLevel;
+ _indentStr.clear();
+ for (int i = 0; i < _indentLevel; ++i) {
+ _indentStr += "\t";
+ }
+}
+
+NS_CC_END
diff --git a/cocos2dx/cocoa/CCDataVisitor.h b/cocos2dx/cocoa/CCDataVisitor.h
new file mode 100644
index 000000000000..636021d971c2
--- /dev/null
+++ b/cocos2dx/cocoa/CCDataVisitor.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+ Copyright (c) 2013 cocos2d-x.org
+
+ http://www.cocos2d-x.org
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#ifndef __CCDATAVISITOR_H__
+#define __CCDATAVISITOR_H__
+
+#include "platform/CCPlatformMacros.h"
+#include
+
+NS_CC_BEGIN
+
+class CCObject;
+class CCBool;
+class CCInteger;
+class CCFloat;
+class CCDouble;
+class CCString;
+class CCArray;
+class CCDictionary;
+class CCSet;
+
+/**
+ * @addtogroup data_structures
+ * @{
+ */
+
+/**
+ * Visitor that helps to perform action that depends on polymorphic object type
+ *
+ * Use cases:
+ * - data serialization,
+ * - pretty printing of \a CCObject *
+ * - safe value reading from \a CCArray, \a CCDictionary, \a CCSet
+ *
+ * Usage:
+ * 1. subclass CCDataVisitor
+ * 2. overload visit() methods for object that you need to handle
+ * 3. handle other objects in \a visitObject()
+ * 4. pass your visitor to \a CCObject::acceptVisitor()
+ */
+class CC_DLL CCDataVisitor
+{
+public:
+ virtual ~CCDataVisitor() {}
+
+ /** default method, called from non-overloaded methods and for unrecognized objects */
+ virtual void visitObject(const CCObject *p) = 0;
+
+ virtual void visit(const CCBool *p);
+ virtual void visit(const CCInteger *p);
+ virtual void visit(const CCFloat *p);
+ virtual void visit(const CCDouble *p);
+ virtual void visit(const CCString *p);
+ virtual void visit(const CCArray *p);
+ virtual void visit(const CCDictionary *p);
+ virtual void visit(const CCSet *p);
+};
+
+
+class CC_DLL CCPrettyPrinter : public CCDataVisitor
+{
+public:
+ CCPrettyPrinter(int indentLevel = 0);
+
+ virtual void clear();
+ virtual std::string getResult();
+
+ virtual void visitObject(const CCObject *p);
+ virtual void visit(const CCBool * p);
+ virtual void visit(const CCInteger *p);
+ virtual void visit(const CCFloat *p);
+ virtual void visit(const CCDouble *p);
+ virtual void visit(const CCString *p);
+ virtual void visit(const CCArray *p);
+ virtual void visit(const CCDictionary *p);
+ virtual void visit(const CCSet *p);
+private:
+ void setIndentLevel(int indentLevel);
+ int _indentLevel;
+ std::string _indentStr;
+ std::string _result;
+};
+
+// end of data_structure group
+/// @}
+
+NS_CC_END
+
+#endif // __CCDATAVISITOR_H__
diff --git a/cocos2dx/cocoa/CCDictionary.cpp b/cocos2dx/cocoa/CCDictionary.cpp
index 1e534578a9f8..b7f15d3a8457 100644
--- a/cocos2dx/cocoa/CCDictionary.cpp
+++ b/cocos2dx/cocoa/CCDictionary.cpp
@@ -408,6 +408,11 @@ CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFile
return CCFileUtils::sharedFileUtils()->createCCDictionaryWithContentsOfFile(pFileName);
}
+void CCDictionary::acceptVisitor(CCDataVisitor &visitor)
+{
+ return visitor.visit(this);
+}
+
CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName)
{
CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName);
diff --git a/cocos2dx/cocoa/CCDictionary.h b/cocos2dx/cocoa/CCDictionary.h
index 7dba087dc9a5..2d76a0249a76 100644
--- a/cocos2dx/cocoa/CCDictionary.h
+++ b/cocos2dx/cocoa/CCDictionary.h
@@ -382,6 +382,9 @@ class CC_DLL CCDictionary : public CCObject
*/
static CCDictionary* createWithContentsOfFileThreadSafe(const char *pFileName);
+ /* override functions */
+ virtual void acceptVisitor(CCDataVisitor &visitor);
+
private:
/**
* For internal usage, invoked by setObject.
diff --git a/cocos2dx/cocoa/CCDouble.h b/cocos2dx/cocoa/CCDouble.h
index e1f3101e0831..920b228baa7e 100755
--- a/cocos2dx/cocoa/CCDouble.h
+++ b/cocos2dx/cocoa/CCDouble.h
@@ -50,6 +50,10 @@ class CC_DLL CCDouble : public CCObject
}
return pRet;
}
+
+ /* override functions */
+ virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); }
+
private:
double m_dValue;
};
diff --git a/cocos2dx/cocoa/CCFloat.h b/cocos2dx/cocoa/CCFloat.h
index 37433c82e7a5..36c9642951df 100755
--- a/cocos2dx/cocoa/CCFloat.h
+++ b/cocos2dx/cocoa/CCFloat.h
@@ -50,6 +50,10 @@ class CC_DLL CCFloat : public CCObject
}
return pRet;
}
+
+ /* override functions */
+ virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); }
+
private:
float m_fValue;
};
diff --git a/cocos2dx/cocoa/CCObject.cpp b/cocos2dx/cocoa/CCObject.cpp
index eb818cee289c..dd74c695a33d 100644
--- a/cocos2dx/cocoa/CCObject.cpp
+++ b/cocos2dx/cocoa/CCObject.cpp
@@ -115,4 +115,9 @@ bool CCObject::isEqual(const CCObject *pObject)
return this == pObject;
}
+void CCObject::acceptVisitor(CCDataVisitor &visitor)
+{
+ visitor.visitObject(this);
+}
+
NS_CC_END
diff --git a/cocos2dx/cocoa/CCObject.h b/cocos2dx/cocoa/CCObject.h
index 8c17c45ff35c..d79224848b82 100644
--- a/cocos2dx/cocoa/CCObject.h
+++ b/cocos2dx/cocoa/CCObject.h
@@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCOBJECT_H__
#define __CCOBJECT_H__
-#include "platform/CCPlatformMacros.h"
+#include "CCDataVisitor.h"
#ifdef EMSCRIPTEN
#include
@@ -73,6 +73,8 @@ class CC_DLL CCObject : public CCCopying
unsigned int retainCount(void) const;
virtual bool isEqual(const CCObject* pObject);
+ virtual void acceptVisitor(CCDataVisitor &visitor);
+
virtual void update(float dt) {CC_UNUSED_PARAM(dt);};
friend class CCAutoreleasePool;
diff --git a/cocos2dx/cocoa/CCSet.cpp b/cocos2dx/cocoa/CCSet.cpp
index cb6f654992bb..8de3b02e2d86 100644
--- a/cocos2dx/cocoa/CCSet.cpp
+++ b/cocos2dx/cocoa/CCSet.cpp
@@ -56,6 +56,11 @@ CCSet::~CCSet(void)
CC_SAFE_DELETE(m_pSet);
}
+void CCSet::acceptVisitor(CCDataVisitor &visitor)
+{
+ visitor.visit(this);
+}
+
CCSet * CCSet::create()
{
CCSet * pRet = new CCSet();
diff --git a/cocos2dx/cocoa/CCSet.h b/cocos2dx/cocoa/CCSet.h
index 042ee71c83ac..85d36d6d9d3e 100644
--- a/cocos2dx/cocoa/CCSet.h
+++ b/cocos2dx/cocoa/CCSet.h
@@ -90,6 +90,8 @@ class CC_DLL CCSet : public CCObject
*/
CCObject* anyObject();
+ virtual void acceptVisitor(CCDataVisitor &visitor);
+
private:
std::set *m_pSet;
};
diff --git a/cocos2dx/cocoa/CCString.cpp b/cocos2dx/cocoa/CCString.cpp
index d22f5724ad7a..caf320b26a32 100644
--- a/cocos2dx/cocoa/CCString.cpp
+++ b/cocos2dx/cocoa/CCString.cpp
@@ -200,4 +200,9 @@ CCString* CCString::createWithContentsOfFile(const char* pszFileName)
return pRet;
}
+void CCString::acceptVisitor(CCDataVisitor &visitor)
+{
+ visitor.visit(this);
+}
+
NS_CC_END
diff --git a/cocos2dx/cocoa/CCString.h b/cocos2dx/cocoa/CCString.h
index 13a63884af23..9548a0e63c4a 100644
--- a/cocos2dx/cocoa/CCString.h
+++ b/cocos2dx/cocoa/CCString.h
@@ -109,6 +109,8 @@ class CC_DLL CCString : public CCObject
*/
static CCString* createWithContentsOfFile(const char* pszFileName);
+ virtual void acceptVisitor(CCDataVisitor &visitor);
+
private:
/** only for internal use */
diff --git a/cocos2dx/platform/nacl/CCEGLView.cpp b/cocos2dx/platform/nacl/CCEGLView.cpp
index 1177f40fd4a1..954dd5751b07 100644
--- a/cocos2dx/platform/nacl/CCEGLView.cpp
+++ b/cocos2dx/platform/nacl/CCEGLView.cpp
@@ -108,7 +108,7 @@ bool OpenGLContext::MakeContextCurrent()
return false;
}
- CCLOG("glSetCurrentContextPPAPI: %p", m_graphics3d.pp_resource());
+ CCLOG("glSetCurrentContextPPAPI: %p", (void*)m_graphics3d.pp_resource());
glSetCurrentContextPPAPI(m_graphics3d.pp_resource());
return true;
}
diff --git a/cocos2dx/platform/nacl/CCInstance.cpp b/cocos2dx/platform/nacl/CCInstance.cpp
index 4d997ee328b7..44ef996c0f54 100644
--- a/cocos2dx/platform/nacl/CCInstance.cpp
+++ b/cocos2dx/platform/nacl/CCInstance.cpp
@@ -82,7 +82,7 @@ bool CocosPepperInstance::Init(uint32_t argc, const char* argn[], const char* ar
#ifdef OLD_NACL_MOUNTS
m_runner = new MainThreadRunner(this);
#else
- CCLOG("%p %p", pp_instance(), pp::Module::Get()->get_browser_interface());
+ CCLOG("%p %p", (void*)pp_instance(), (void*)pp::Module::Get()->get_browser_interface());
nacl_io_init_ppapi(pp_instance(), pp::Module::Get()->get_browser_interface());
CCLOG("done nacl_mounts_init_ppapi");
diff --git a/cocos2dx/proj.emscripten/Makefile b/cocos2dx/proj.emscripten/Makefile
index 06d991fb49b4..01a305b58432 100644
--- a/cocos2dx/proj.emscripten/Makefile
+++ b/cocos2dx/proj.emscripten/Makefile
@@ -38,6 +38,7 @@ SOURCES = ../actions/CCAction.cpp \
../cocoa/CCArray.cpp \
../cocoa/CCDictionary.cpp \
../cocoa/CCString.cpp \
+../cocoa/CCDataVisitor.cpp \
../draw_nodes/CCDrawingPrimitives.cpp \
../draw_nodes/CCDrawNode.cpp \
../effects/CCGrabber.cpp \
diff --git a/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj b/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj
index ab1a108831df..89741f647de6 100644
--- a/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj
+++ b/cocos2dx/proj.ios/cocos2dx.xcodeproj/project.pbxproj
@@ -280,6 +280,8 @@
1A3199AE16C0E3A200207637 /* libwebp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A3199AD16C0E3A200207637 /* libwebp.a */; };
1A4646DA16DC8FB700DE131F /* ccFPSImages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4646D816DC8FB700DE131F /* ccFPSImages.h */; };
1A4646DC16DC901A00DE131F /* ccFPSImages.c in Sources */ = {isa = PBXBuildFile; fileRef = 1A4646DB16DC901900DE131F /* ccFPSImages.c */; };
+ 1A5428FF1720F0650074EC5C /* CCDataVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5428FD1720F0650074EC5C /* CCDataVisitor.cpp */; };
+ 1A5429001720F0650074EC5C /* CCDataVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5428FE1720F0650074EC5C /* CCDataVisitor.h */; };
1A5B48EA16F084CC008568FC /* CCBool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B48E716F084CC008568FC /* CCBool.h */; };
1A5B48EB16F084CC008568FC /* CCDouble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B48E816F084CC008568FC /* CCDouble.h */; };
1A5B48EC16F084CC008568FC /* CCFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B48E916F084CC008568FC /* CCFloat.h */; };
@@ -587,6 +589,8 @@
1A3199AD16C0E3A200207637 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../platform/third_party/ios/libraries/libwebp.a; sourceTree = ""; };
1A4646D816DC8FB700DE131F /* ccFPSImages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccFPSImages.h; sourceTree = ""; };
1A4646DB16DC901900DE131F /* ccFPSImages.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccFPSImages.c; sourceTree = ""; };
+ 1A5428FD1720F0650074EC5C /* CCDataVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCDataVisitor.cpp; sourceTree = ""; };
+ 1A5428FE1720F0650074EC5C /* CCDataVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDataVisitor.h; sourceTree = ""; };
1A5B48E716F084CC008568FC /* CCBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBool.h; sourceTree = ""; };
1A5B48E816F084CC008568FC /* CCDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDouble.h; sourceTree = ""; };
1A5B48E916F084CC008568FC /* CCFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFloat.h; sourceTree = ""; };
@@ -752,6 +756,8 @@
1551A384158F2ADE00E66CFE /* CCAutoreleasePool.cpp */,
1551A385158F2ADE00E66CFE /* CCAutoreleasePool.h */,
1A5B48E716F084CC008568FC /* CCBool.h */,
+ 1A5428FD1720F0650074EC5C /* CCDataVisitor.cpp */,
+ 1A5428FE1720F0650074EC5C /* CCDataVisitor.h */,
1551A386158F2ADE00E66CFE /* CCDictionary.cpp */,
1551A387158F2ADE00E66CFE /* CCDictionary.h */,
1A5B48E816F084CC008568FC /* CCDouble.h */,
@@ -1437,6 +1443,7 @@
1A5B48EA16F084CC008568FC /* CCBool.h in Headers */,
1A5B48EB16F084CC008568FC /* CCDouble.h in Headers */,
1A5B48EC16F084CC008568FC /* CCFloat.h in Headers */,
+ 1A5429001720F0650074EC5C /* CCDataVisitor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1621,6 +1628,7 @@
46A393F616E5D01B00210B16 /* CCUserDefault.cpp in Sources */,
46A393F816E5D01B00210B16 /* CCUserDefault.mm in Sources */,
46A393F916E5D01B00210B16 /* CCUserDefaultAndroid.cpp in Sources */,
+ 1A5428FF1720F0650074EC5C /* CCDataVisitor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile
index 3549cf946e08..4ce130fb939c 100644
--- a/cocos2dx/proj.linux/Makefile
+++ b/cocos2dx/proj.linux/Makefile
@@ -34,6 +34,7 @@ SOURCES = ../actions/CCAction.cpp \
../cocoa/CCArray.cpp \
../cocoa/CCDictionary.cpp \
../cocoa/CCString.cpp \
+../cocoa/CCDataVisitor.cpp \
../draw_nodes/CCDrawingPrimitives.cpp \
../draw_nodes/CCDrawNode.cpp \
../effects/CCGrabber.cpp \
diff --git a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj
index 593eeddbb616..703f1f571cf5 100644
--- a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj
+++ b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj
@@ -259,6 +259,11 @@
15C647F0165F2B77007D4F18 /* CCClippingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 15C647EE165F2B77007D4F18 /* CCClippingNode.h */; };
1A589DA416EC7B2F00C6B691 /* CCUserDefault.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A589DA016EC7B2F00C6B691 /* CCUserDefault.h */; };
1A589DA516EC7B2F00C6B691 /* CCUserDefault.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A589DA116EC7B2F00C6B691 /* CCUserDefault.mm */; };
+ 1A60BF5C173CD9D90054773B /* CCBool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60BF57173CD9D90054773B /* CCBool.h */; };
+ 1A60BF5D173CD9D90054773B /* CCDataVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A60BF58173CD9D90054773B /* CCDataVisitor.cpp */; };
+ 1A60BF5E173CD9D90054773B /* CCDataVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60BF59173CD9D90054773B /* CCDataVisitor.h */; };
+ 1A60BF5F173CD9D90054773B /* CCDouble.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60BF5A173CD9D90054773B /* CCDouble.h */; };
+ 1A60BF60173CD9D90054773B /* CCFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60BF5B173CD9D90054773B /* CCFloat.h */; };
1A78B70616DEED020038FAD0 /* ccUTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A78B70416DEED020038FAD0 /* ccUTF8.cpp */; };
1A78B70716DEED020038FAD0 /* ccUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A78B70516DEED020038FAD0 /* ccUTF8.h */; };
1A94D34516C1FF8800D79D09 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A94D34116C1FF8800D79D09 /* decode.h */; };
@@ -555,6 +560,11 @@
15C647EE165F2B77007D4F18 /* CCClippingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCClippingNode.h; sourceTree = ""; };
1A589DA016EC7B2F00C6B691 /* CCUserDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUserDefault.h; sourceTree = ""; };
1A589DA116EC7B2F00C6B691 /* CCUserDefault.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCUserDefault.mm; sourceTree = ""; };
+ 1A60BF57173CD9D90054773B /* CCBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBool.h; sourceTree = ""; };
+ 1A60BF58173CD9D90054773B /* CCDataVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCDataVisitor.cpp; sourceTree = ""; };
+ 1A60BF59173CD9D90054773B /* CCDataVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDataVisitor.h; sourceTree = ""; };
+ 1A60BF5A173CD9D90054773B /* CCDouble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDouble.h; sourceTree = ""; };
+ 1A60BF5B173CD9D90054773B /* CCFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFloat.h; sourceTree = ""; };
1A78B70416DEED020038FAD0 /* ccUTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ccUTF8.cpp; sourceTree = ""; };
1A78B70516DEED020038FAD0 /* ccUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccUTF8.h; sourceTree = ""; };
1A94D33F16C1FF8800D79D09 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libwebp.a; sourceTree = ""; };
@@ -739,8 +749,13 @@
1551A383158F2ADE00E66CFE /* CCArray.h */,
1551A384158F2ADE00E66CFE /* CCAutoreleasePool.cpp */,
1551A385158F2ADE00E66CFE /* CCAutoreleasePool.h */,
+ 1A60BF57173CD9D90054773B /* CCBool.h */,
+ 1A60BF58173CD9D90054773B /* CCDataVisitor.cpp */,
+ 1A60BF59173CD9D90054773B /* CCDataVisitor.h */,
1551A386158F2ADE00E66CFE /* CCDictionary.cpp */,
1551A387158F2ADE00E66CFE /* CCDictionary.h */,
+ 1A60BF5A173CD9D90054773B /* CCDouble.h */,
+ 1A60BF5B173CD9D90054773B /* CCFloat.h */,
1551A388158F2ADE00E66CFE /* CCGeometry.cpp */,
1551A389158F2ADE00E66CFE /* CCGeometry.h */,
1551A38A158F2ADE00E66CFE /* CCInteger.h */,
@@ -1396,6 +1411,10 @@
1A78B70716DEED020038FAD0 /* ccUTF8.h in Headers */,
46A3939B16E03F4D00210B16 /* ccFPSImages.h in Headers */,
1A589DA416EC7B2F00C6B691 /* CCUserDefault.h in Headers */,
+ 1A60BF5C173CD9D90054773B /* CCBool.h in Headers */,
+ 1A60BF5E173CD9D90054773B /* CCDataVisitor.h in Headers */,
+ 1A60BF5F173CD9D90054773B /* CCDouble.h in Headers */,
+ 1A60BF60173CD9D90054773B /* CCFloat.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1575,6 +1594,7 @@
1A78B70616DEED020038FAD0 /* ccUTF8.cpp in Sources */,
46A3939A16E03F4D00210B16 /* ccFPSImages.c in Sources */,
1A589DA516EC7B2F00C6B691 /* CCUserDefault.mm in Sources */,
+ 1A60BF5D173CD9D90054773B /* CCDataVisitor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/cocos2dx/proj.nacl/Makefile b/cocos2dx/proj.nacl/Makefile
index cb75af8dc4a3..6c9871ff7215 100644
--- a/cocos2dx/proj.nacl/Makefile
+++ b/cocos2dx/proj.nacl/Makefile
@@ -34,6 +34,7 @@ SOURCES = ../actions/CCAction.cpp \
../cocoa/CCArray.cpp \
../cocoa/CCDictionary.cpp \
../cocoa/CCString.cpp \
+../cocoa/CCDataVisitor.cpp \
../draw_nodes/CCDrawingPrimitives.cpp \
../draw_nodes/CCDrawNode.cpp \
../effects/CCGrabber.cpp \
diff --git a/cocos2dx/proj.win32/cocos2d.vcxproj b/cocos2dx/proj.win32/cocos2d.vcxproj
index 2dcf7b55146b..79f6a7b9043e 100644
--- a/cocos2dx/proj.win32/cocos2d.vcxproj
+++ b/cocos2dx/proj.win32/cocos2d.vcxproj
@@ -144,6 +144,7 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
+
@@ -268,7 +269,11 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
+
+
+
+
diff --git a/cocos2dx/proj.win32/cocos2d.vcxproj.filters b/cocos2dx/proj.win32/cocos2d.vcxproj.filters
index 1b1dacc68119..20c672dc8c14 100644
--- a/cocos2dx/proj.win32/cocos2d.vcxproj.filters
+++ b/cocos2dx/proj.win32/cocos2d.vcxproj.filters
@@ -458,6 +458,9 @@
support\tinyxml2
+
+ cocoa
+
@@ -914,5 +917,17 @@
support\tinyxml2
+
+ cocoa
+
+
+ cocoa
+
+
+ cocoa
+
+
+ cocoa
+
\ No newline at end of file
diff --git a/cocos2dx/textures/CCTexturePVR.cpp b/cocos2dx/textures/CCTexturePVR.cpp
index 926a6c1499d1..73282426c8f4 100644
--- a/cocos2dx/textures/CCTexturePVR.cpp
+++ b/cocos2dx/textures/CCTexturePVR.cpp
@@ -443,7 +443,7 @@ bool CCTexturePVR::unpackPVRv3Data(unsigned char* dataPointer, unsigned int data
// unsupported / bad pixel format
if (! infoValid)
{
- CCLOG("cocos2d: WARNING: unsupported pvr pixelformat: %lx", pixelFormat );
+ CCLOG("cocos2d: WARNING: unsupported pvr pixelformat: %lx", (unsigned long)pixelFormat );
return false;
}
diff --git a/samples/Cpp/TestCpp/Android.mk b/samples/Cpp/TestCpp/Android.mk
index dfe121c007fd..1bb55f60bcb8 100644
--- a/samples/Cpp/TestCpp/Android.mk
+++ b/samples/Cpp/TestCpp/Android.mk
@@ -94,6 +94,7 @@ Classes/TransitionsTest/TransitionsTest.cpp \
Classes/UserDefaultTest/UserDefaultTest.cpp \
Classes/ZwoptexTest/ZwoptexTest.cpp \
Classes/FileUtilsTest/FileUtilsTest.cpp \
+Classes/DataVisitorTest/DataVisitorTest.cpp \
Classes/controller.cpp \
Classes/testBasic.cpp \
Classes/AppDelegate.cpp \
diff --git a/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.cpp b/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.cpp
new file mode 100644
index 000000000000..d753490ff70d
--- /dev/null
+++ b/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.cpp
@@ -0,0 +1,86 @@
+#include "DataVisitorTest.h"
+#include "../testResource.h"
+
+std::string PrettyPrinterDemo::title()
+{
+ return "PrettyPrinter Test";
+}
+
+std::string PrettyPrinterDemo::subtitle()
+{
+ return "Please see log!";
+}
+
+void PrettyPrinterDemo::addSprite()
+{
+ // create sprites
+
+ CCSprite *s1 = CCSprite::create("Images/grossini.png");
+ CCSprite *s2 = CCSprite::create("Images/grossini_dance_01.png");
+ CCSprite *s3 = CCSprite::create("Images/grossini_dance_02.png");
+ CCSprite *s4 = CCSprite::create("Images/grossini_dance_03.png");
+ CCSprite *s5 = CCSprite::create("Images/grossini_dance_04.png");
+
+ s1->setPosition(ccp(50, 50));
+ s2->setPosition(ccp(60, 50));
+ s3->setPosition(ccp(70, 50));
+ s4->setPosition(ccp(80, 50));
+ s5->setPosition(ccp(90, 50));
+
+ this->addChild(s1);
+ this->addChild(s2);
+ this->addChild(s3);
+ this->addChild(s4);
+ this->addChild(s5);
+}
+
+void PrettyPrinterDemo::onEnter()
+{
+ CCLayer::onEnter();
+ CCSize s = CCDirector::sharedDirector()->getWinSize();
+
+ CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28);
+ label->setPosition( ccp(s.width/2, s.height * 4/5) );
+ this->addChild(label, 1);
+
+ std::string strSubtitle = subtitle();
+ if(strSubtitle.empty() == false)
+ {
+ CCLabelTTF* subLabel = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16);
+ subLabel->setPosition( ccp(s.width/2, s.height * 3/5) );
+ this->addChild(subLabel, 1);
+ }
+
+ // Test code
+ CCPrettyPrinter vistor;
+
+ // print dictionary
+ CCDictionary* pDict = CCDictionary::createWithContentsOfFile("animations/animations.plist");
+ pDict->acceptVisitor(vistor);
+ CCLog("%s", vistor.getResult().c_str());
+ CCLog("-------------------------------");
+
+ CCSet myset;
+ for (int i = 0; i < 30; ++i) {
+ myset.addObject(CCString::createWithFormat("str: %d", i));
+ }
+ vistor.clear();
+ myset.acceptVisitor(vistor);
+ CCLog("%s", vistor.getResult().c_str());
+ CCLog("-------------------------------");
+
+ vistor.clear();
+ addSprite();
+ pDict = CCTextureCache::sharedTextureCache()->snapshotTextures();
+ pDict->acceptVisitor(vistor);
+ CCLog("%s", vistor.getResult().c_str());
+}
+
+void DataVisitorTestScene::runThisTest()
+{
+ CCLayer *layer = new PrettyPrinterDemo();
+ layer->autorelease();
+ addChild(layer);
+
+ CCDirector::sharedDirector()->replaceScene(this);
+}
diff --git a/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.h b/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.h
new file mode 100644
index 000000000000..e5d3c0258d85
--- /dev/null
+++ b/samples/Cpp/TestCpp/Classes/DataVisitorTest/DataVisitorTest.h
@@ -0,0 +1,27 @@
+#ifndef __DATAVISITOR_TEST_H__
+#define __DATAVISITOR_TEST_H__
+
+#include "../testBasic.h"
+
+#include
+
+class PrettyPrinterDemo : public CCLayer
+{
+public:
+ virtual std::string title();
+ virtual std::string subtitle();
+ virtual void onEnter();
+ void addSprite();
+protected:
+ std::string m_strTitle;
+};
+
+class DataVisitorTestScene : public TestScene
+{
+public:
+ virtual void runThisTest();
+
+ CREATE_FUNC(DataVisitorTestScene);
+};
+
+#endif // __DATAVISITOR_TEST_H__
diff --git a/samples/Cpp/TestCpp/Classes/controller.cpp b/samples/Cpp/TestCpp/Classes/controller.cpp
index a17cc2567e6e..ff2dde877971 100644
--- a/samples/Cpp/TestCpp/Classes/controller.cpp
+++ b/samples/Cpp/TestCpp/Classes/controller.cpp
@@ -125,6 +125,9 @@ static TestScene* CreateTestScene(int nIdx)
case TEST_TEXTUREPACKER_ENCRYPTION:
pScene = new TextureAtlasEncryptionTestScene();
break;
+ case TEST_DATAVISTOR:
+ pScene = new DataVisitorTestScene();
+ break;
default:
break;
}
diff --git a/samples/Cpp/TestCpp/Classes/tests.h b/samples/Cpp/TestCpp/Classes/tests.h
index b2653a8f8daa..7ddbcdd6c83a 100644
--- a/samples/Cpp/TestCpp/Classes/tests.h
+++ b/samples/Cpp/TestCpp/Classes/tests.h
@@ -57,6 +57,7 @@
#include "FileUtilsTest/FileUtilsTest.h"
#include "SpineTest/SpineTest.h"
#include "TexturePackerEncryptionTest/TextureAtlasEncryptionTest.h"
+#include "DataVisitorTest/DataVisitorTest.h"
enum
{
@@ -115,6 +116,7 @@ enum
TEST_FILEUTILS,
TEST_SPINE,
TEST_TEXTUREPACKER_ENCRYPTION,
+ TEST_DATAVISTOR,
TESTS_COUNT,
};
@@ -175,7 +177,8 @@ const std::string g_aTestNames[TESTS_COUNT] = {
#endif
"FileUtilsTest",
"SpineTest",
- "TexturePackerEncryption"
+ "TexturePackerEncryption",
+ "DataVistorTest"
};
#endif
diff --git a/samples/Cpp/TestCpp/proj.emscripten/Makefile b/samples/Cpp/TestCpp/proj.emscripten/Makefile
index fa80d06d3295..c6fa4bbe7460 100644
--- a/samples/Cpp/TestCpp/proj.emscripten/Makefile
+++ b/samples/Cpp/TestCpp/proj.emscripten/Makefile
@@ -83,6 +83,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/UserDefaultTest/UserDefaultTest.cpp \
../Classes/ZwoptexTest/ZwoptexTest.cpp \
../Classes/FileUtilsTest/FileUtilsTest.cpp \
+ ../Classes/DataVisitorTest/DataVisitorTest.cpp \
../Classes/controller.cpp \
../Classes/testBasic.cpp \
../Classes/AppDelegate.cpp \
diff --git a/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj b/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj
index 3477f91e036b..6b5e473d37f1 100644
--- a/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj
+++ b/samples/Cpp/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj
@@ -228,6 +228,7 @@
1A27573F1697CF2B00504026 /* CCEditBoxImplAndroid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A27573D1697CF2B00504026 /* CCEditBoxImplAndroid.cpp */; };
1A4D4A2615FD7E2200F61EEB /* CustomTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4D4A2215FD7E2200F61EEB /* CustomTableViewCell.cpp */; };
1A4D4A2715FD7E2200F61EEB /* TableViewTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A4D4A2415FD7E2200F61EEB /* TableViewTestScene.cpp */; };
+ 1A60BF54173CCCF80054773B /* DataVisitorTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A60BF52173CCCF80054773B /* DataVisitorTest.cpp */; };
1A75E95A16F84FDD00BA80BD /* TimelineCallbackTestLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A75E95816F84FDD00BA80BD /* TimelineCallbackTestLayer.cpp */; };
1A9FE96B17277E9D00B21905 /* Animation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9FE94417277E9D00B21905 /* Animation.cpp */; };
1A9FE96C17277E9D00B21905 /* AnimationState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A9FE94617277E9D00B21905 /* AnimationState.cpp */; };
@@ -809,6 +810,8 @@
1A4D4A2315FD7E2200F61EEB /* CustomTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomTableViewCell.h; sourceTree = ""; };
1A4D4A2415FD7E2200F61EEB /* TableViewTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TableViewTestScene.cpp; sourceTree = ""; };
1A4D4A2515FD7E2200F61EEB /* TableViewTestScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewTestScene.h; sourceTree = ""; };
+ 1A60BF52173CCCF80054773B /* DataVisitorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataVisitorTest.cpp; sourceTree = ""; };
+ 1A60BF53173CCCF80054773B /* DataVisitorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataVisitorTest.h; sourceTree = ""; };
1A75E95716F84FDD00BA80BD /* TimelineCallbackLayerLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineCallbackLayerLoader.h; sourceTree = ""; };
1A75E95816F84FDD00BA80BD /* TimelineCallbackTestLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineCallbackTestLayer.cpp; sourceTree = ""; };
1A75E95916F84FDD00BA80BD /* TimelineCallbackTestLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineCallbackTestLayer.h; sourceTree = ""; };
@@ -1460,6 +1463,7 @@
15AA9CAB15B7EC460033D6C2 /* controller.h */,
15AA9CAC15B7EC460033D6C2 /* CurlTest */,
15AA9CAF15B7EC460033D6C2 /* CurrentLanguageTest */,
+ 1A60BF51173CCCF80054773B /* DataVisitorTest */,
15AA9CB215B7EC460033D6C2 /* DrawPrimitivesTest */,
15AA9CB515B7EC460033D6C2 /* EffectsAdvancedTest */,
15AA9CB815B7EC460033D6C2 /* EffectsTest */,
@@ -2205,6 +2209,16 @@
path = ../../Classes/ExtensionsTest/TableViewTest;
sourceTree = "";
};
+ 1A60BF51173CCCF80054773B /* DataVisitorTest */ = {
+ isa = PBXGroup;
+ children = (
+ 1A60BF52173CCCF80054773B /* DataVisitorTest.cpp */,
+ 1A60BF53173CCCF80054773B /* DataVisitorTest.h */,
+ );
+ name = DataVisitorTest;
+ path = ../Classes/DataVisitorTest;
+ sourceTree = "";
+ };
1A75E95616F84FDD00BA80BD /* TimelineCallbackTest */ = {
isa = PBXGroup;
children = (
@@ -2711,6 +2725,7 @@
1A9FE97D17277E9D00B21905 /* spine-cocos2dx.cpp in Sources */,
1A144289172788AF0096438B /* SpineTest.cpp in Sources */,
6442E66D17297DB40008499D /* TextureAtlasEncryptionTest.cpp in Sources */,
+ 1A60BF54173CCCF80054773B /* DataVisitorTest.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/samples/Cpp/TestCpp/proj.linux/Makefile b/samples/Cpp/TestCpp/proj.linux/Makefile
index e5b7557cad6f..94f79cfd7a0c 100644
--- a/samples/Cpp/TestCpp/proj.linux/Makefile
+++ b/samples/Cpp/TestCpp/proj.linux/Makefile
@@ -86,6 +86,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/ZwoptexTest/ZwoptexTest.cpp \
../Classes/FileUtilsTest/FileUtilsTest.cpp \
../Classes/SpineTest/SpineTest.cpp \
+ ../Classes/DataVisitorTest/DataVisitorTest.cpp \
../Classes/controller.cpp \
../Classes/testBasic.cpp \
../Classes/AppDelegate.cpp \
diff --git a/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj b/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj
index 2d465479125c..90d267b6c461 100644
--- a/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj
+++ b/samples/Cpp/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj
@@ -270,6 +270,7 @@
1A40DFDB1727AE7E006D4861 /* spine-cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A40DFC61727AE7E006D4861 /* spine-cocos2dx.cpp */; };
1A40DFDF1727AF48006D4861 /* SpineTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A40DFDD1727AF48006D4861 /* SpineTest.cpp */; };
1A40DFE11727AFBF006D4861 /* spine in Resources */ = {isa = PBXBuildFile; fileRef = 1A40DFE01727AFBF006D4861 /* spine */; };
+ 1A60BF64173CD9E80054773B /* DataVisitorTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A60BF62173CD9E80054773B /* DataVisitorTest.cpp */; };
1A75E96016F85FDB00BA80BD /* TimelineCallbackTestLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A75E95E16F85FDB00BA80BD /* TimelineCallbackTestLayer.cpp */; };
1AB2D72816B6804D00D72C48 /* FileUtilsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB2D72616B6804D00D72C48 /* FileUtilsTest.cpp */; };
1AB2D72A16B681F900D72C48 /* Misc in Resources */ = {isa = PBXBuildFile; fileRef = 1AB2D72916B681F900D72C48 /* Misc */; };
@@ -863,6 +864,8 @@
1A40DFDD1727AF48006D4861 /* SpineTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpineTest.cpp; sourceTree = ""; };
1A40DFDE1727AF48006D4861 /* SpineTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpineTest.h; sourceTree = ""; };
1A40DFE01727AFBF006D4861 /* spine */ = {isa = PBXFileReference; lastKnownFileType = folder; path = spine; sourceTree = ""; };
+ 1A60BF62173CD9E80054773B /* DataVisitorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataVisitorTest.cpp; sourceTree = ""; };
+ 1A60BF63173CD9E80054773B /* DataVisitorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataVisitorTest.h; sourceTree = ""; };
1A75E95D16F85FDB00BA80BD /* TimelineCallbackLayerLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineCallbackLayerLoader.h; sourceTree = ""; };
1A75E95E16F85FDB00BA80BD /* TimelineCallbackTestLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineCallbackTestLayer.cpp; sourceTree = ""; };
1A75E95F16F85FDB00BA80BD /* TimelineCallbackTestLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineCallbackTestLayer.h; sourceTree = ""; };
@@ -927,21 +930,13 @@
15AA9C4015B7EC450033D6C2 /* Classes */ = {
isa = PBXGroup;
children = (
- 15AA9F3A15B7EF960033D6C2 /* AppDelegate.cpp */,
- 15AA9CAA15B7EC460033D6C2 /* controller.cpp */,
- 15AA9D3115B7EC460033D6C2 /* testBasic.cpp */,
- 15A048CE163784C700F7CC0A /* VisibleRect.cpp */,
- 15AA9F3B15B7EF960033D6C2 /* AppDelegate.h */,
- 15AA9CAB15B7EC460033D6C2 /* controller.h */,
- 15AA9D3215B7EC460033D6C2 /* testBasic.h */,
- 15AA9D3315B7EC460033D6C2 /* testResource.h */,
- 15AA9D3415B7EC460033D6C2 /* tests.h */,
- 15A048CF163784C700F7CC0A /* VisibleRect.h */,
15AA9C4115B7EC450033D6C2 /* AccelerometerTest */,
15AA9C4415B7EC450033D6C2 /* ActionManagerTest */,
15AA9C4715B7EC450033D6C2 /* ActionsEaseTest */,
15AA9C4A15B7EC450033D6C2 /* ActionsProgressTest */,
15AA9C4D15B7EC450033D6C2 /* ActionsTest */,
+ 15AA9F3A15B7EF960033D6C2 /* AppDelegate.cpp */,
+ 15AA9F3B15B7EF960033D6C2 /* AppDelegate.h */,
15AA9C5015B7EC450033D6C2 /* Box2DTest */,
15AA9C5315B7EC450033D6C2 /* Box2DTestBed */,
15AA9C8915B7EC460033D6C2 /* BugsTest */,
@@ -949,8 +944,11 @@
15AA9CA415B7EC460033D6C2 /* ClickAndMoveTest */,
15C647E9165F2B39007D4F18 /* ClippingNodeTest */,
15AA9CA715B7EC460033D6C2 /* CocosDenshionTest */,
+ 15AA9CAA15B7EC460033D6C2 /* controller.cpp */,
+ 15AA9CAB15B7EC460033D6C2 /* controller.h */,
15AA9CAC15B7EC460033D6C2 /* CurlTest */,
15AA9CAF15B7EC460033D6C2 /* CurrentLanguageTest */,
+ 1A60BF61173CD9E80054773B /* DataVisitorTest */,
15AA9CB215B7EC460033D6C2 /* DrawPrimitivesTest */,
15AA9CB515B7EC460033D6C2 /* EffectsAdvancedTest */,
15AA9CB815B7EC460033D6C2 /* EffectsTest */,
@@ -975,6 +973,10 @@
15AA9D2B15B7EC460033D6C2 /* ShaderTest */,
1A40DFDC1727AF48006D4861 /* SpineTest */,
15AA9D2E15B7EC460033D6C2 /* SpriteTest */,
+ 15AA9D3115B7EC460033D6C2 /* testBasic.cpp */,
+ 15AA9D3215B7EC460033D6C2 /* testBasic.h */,
+ 15AA9D3315B7EC460033D6C2 /* testResource.h */,
+ 15AA9D3415B7EC460033D6C2 /* tests.h */,
15AA9D3515B7EC460033D6C2 /* TextInputTest */,
15AA9D3815B7EC460033D6C2 /* Texture2dTest */,
15AA9D3B15B7EC460033D6C2 /* TextureCacheTest */,
@@ -983,6 +985,8 @@
15AA9D4115B7EC460033D6C2 /* TouchesTest */,
15AA9D4815B7EC460033D6C2 /* TransitionsTest */,
15AA9D4B15B7EC460033D6C2 /* UserDefaultTest */,
+ 15A048CE163784C700F7CC0A /* VisibleRect.cpp */,
+ 15A048CF163784C700F7CC0A /* VisibleRect.h */,
15AA9D4E15B7EC460033D6C2 /* ZwoptexTest */,
);
name = Classes;
@@ -2213,6 +2217,16 @@
path = ../Classes/SpineTest;
sourceTree = "";
};
+ 1A60BF61173CD9E80054773B /* DataVisitorTest */ = {
+ isa = PBXGroup;
+ children = (
+ 1A60BF62173CD9E80054773B /* DataVisitorTest.cpp */,
+ 1A60BF63173CD9E80054773B /* DataVisitorTest.h */,
+ );
+ name = DataVisitorTest;
+ path = ../Classes/DataVisitorTest;
+ sourceTree = "";
+ };
1A75E95C16F85FDB00BA80BD /* TimelineCallbackTest */ = {
isa = PBXGroup;
children = (
@@ -2708,6 +2722,7 @@
1A40DFDB1727AE7E006D4861 /* spine-cocos2dx.cpp in Sources */,
1A40DFDF1727AF48006D4861 /* SpineTest.cpp in Sources */,
467373111739F4270034BF94 /* TextureAtlasEncryptionTest.cpp in Sources */,
+ 1A60BF64173CD9E80054773B /* DataVisitorTest.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/samples/Cpp/TestCpp/proj.marmalade/TestCPP.mkb b/samples/Cpp/TestCpp/proj.marmalade/TestCPP.mkb
index 4090afefc5bc..0b73cf386720 100644
--- a/samples/Cpp/TestCpp/proj.marmalade/TestCPP.mkb
+++ b/samples/Cpp/TestCpp/proj.marmalade/TestCPP.mkb
@@ -475,6 +475,11 @@ files
(../Classes/SpineTest)
SpineTest.cpp
SpineTest.h
+
+ [Test/DataVisitorTest]
+ (../Classes/DataVisitorTest)
+ DataVisitorTest.cpp
+ DataVisitorTest.h
}
diff --git a/samples/Cpp/TestCpp/proj.nacl/Makefile b/samples/Cpp/TestCpp/proj.nacl/Makefile
index a3eeeee411ab..2df7cc44d5a7 100644
--- a/samples/Cpp/TestCpp/proj.nacl/Makefile
+++ b/samples/Cpp/TestCpp/proj.nacl/Makefile
@@ -91,6 +91,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \
../Classes/UserDefaultTest/UserDefaultTest.cpp \
../Classes/ZwoptexTest/ZwoptexTest.cpp \
../Classes/SpineTest/SpineTest.cpp \
+ ../Classes/DataVisitorTest/DataVisitorTest.cpp \
../Classes/controller.cpp \
../Classes/testBasic.cpp \
../Classes/AppDelegate.cpp \
diff --git a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj
index 046b5534a059..3565b3bea3ce 100644
--- a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj
+++ b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj
@@ -121,6 +121,7 @@
+
@@ -215,6 +216,7 @@
+
diff --git a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters
index 94ef2ce46d3e..bcf951779217 100644
--- a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters
+++ b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj.filters
@@ -220,6 +220,9 @@
{4031c3bb-97f8-4b43-91e5-48dd94ca2d24}
+
+ {8049d378-12f7-46ba-ba96-091f3c0a4600}
+
@@ -498,6 +501,9 @@
Classes\TexturePackerEncryptionTest
+
+ Classes\DataVisitorTest
+
@@ -956,5 +962,8 @@
Classes\TexturePackerEncryptionTest
+
+ Classes\DataVisitorTest
+
\ No newline at end of file