From 94235d3602559d12b61c971a50de4f622e48394b Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 11 Jun 2012 10:41:52 +0800 Subject: [PATCH] issue #1310: make tests and HelloWorld work ok --- .../project.pbxproj.REMOVED.git-id | 2 +- cocos2dx/CCDirector.cpp | 2 +- cocos2dx/actions/CCActionCatmullRom.cpp | 2 +- cocos2dx/actions/CCActionCatmullRom.h | 2 +- cocos2dx/platform/ios/CCFileUtils.mm | 13 ++++++++++++- cocos2dx/platform/ios/CCGL.h | 1 + cocos2dx/platform/ios/CCImage.mm | 5 +++-- js/JSBindings/cocos2d_generated.cpp.REMOVED.git-id | 2 +- js/JSBindings/cocos2d_generated.hpp.REMOVED.git-id | 2 +- .../testjs.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- .../test.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 11 files changed, 24 insertions(+), 11 deletions(-) diff --git a/HelloWorld/proj.ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id b/HelloWorld/proj.ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id index 58cbc28d2d..43f6702dd0 100644 --- a/HelloWorld/proj.ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/HelloWorld/proj.ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -5e8bc2ebea93cf60f4c5992e1175c43fffffb7e8 \ No newline at end of file +e725a16819b832fcdbd8496ae63d0b24c76af31a \ No newline at end of file diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 5c840fded0..e17278a8c0 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -371,7 +371,7 @@ void CCDirector::setProjection(ccDirectorProjection kProjection) kmGLLoadIdentity(); // issue #1334 - kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2); + kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2); // kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500); //TODO: if (m_pobOpenGLView && m_pobOpenGLView->isIpad() && m_pobOpenGLView->getMainScreenScale() > 1.0f) diff --git a/cocos2dx/actions/CCActionCatmullRom.cpp b/cocos2dx/actions/CCActionCatmullRom.cpp index 7a4d3339dd..50ea1d1bc7 100644 --- a/cocos2dx/actions/CCActionCatmullRom.cpp +++ b/cocos2dx/actions/CCActionCatmullRom.cpp @@ -150,7 +150,7 @@ void CCPointArray::reverseInline() } // CatmullRom Spline formula: -inline CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, CCFloat tension, float t) +CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, float tension, float t) { float t2 = t * t; float t3 = t2 * t; diff --git a/cocos2dx/actions/CCActionCatmullRom.h b/cocos2dx/actions/CCActionCatmullRom.h index 984f63db78..62a0c2576b 100644 --- a/cocos2dx/actions/CCActionCatmullRom.h +++ b/cocos2dx/actions/CCActionCatmullRom.h @@ -181,7 +181,7 @@ public: }; /** Returns the Cardinal Spline position for a given set of control points, tension and time */ -extern CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, CCFloat tension, float t); +extern CCPoint ccCardinalSplineAt(CCPoint &p0, CCPoint &p1, CCPoint &p2, CCPoint &p3, float tension, float t); NS_CC_END; diff --git a/cocos2dx/platform/ios/CCFileUtils.mm b/cocos2dx/platform/ios/CCFileUtils.mm index 2cc27f59af..3f87b9f0e0 100644 --- a/cocos2dx/platform/ios/CCFileUtils.mm +++ b/cocos2dx/platform/ios/CCFileUtils.mm @@ -212,6 +212,17 @@ static void static_addValueToCCDict(id key, id value, CCDictionary* pDict) NS_CC_BEGIN +CCFileUtils* CCFileUtils::sharedFileUtils() +{ + static CCFileUtils *fileUtils = NULL; + if (fileUtils == NULL) + { + fileUtils = new CCFileUtils(); + } + + return fileUtils; +} + void CCFileUtils::setResourcePath(const char *pszResourcePath) { assert(0); @@ -389,7 +400,7 @@ const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const CCDictionary* ccFileUtils_dictionaryWithContentsOfFileThreadSafe(const char *pFileName) { - const char* pszFullPath = CCFileUtils::fullPathFromRelativePath(pFileName); + const char* pszFullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pFileName); NSString* pPath = [NSString stringWithUTF8String:pszFullPath]; NSDictionary* pDict = [NSDictionary dictionaryWithContentsOfFile:pPath]; diff --git a/cocos2dx/platform/ios/CCGL.h b/cocos2dx/platform/ios/CCGL.h index faad8e010d..e1b95d5104 100644 --- a/cocos2dx/platform/ios/CCGL.h +++ b/cocos2dx/platform/ios/CCGL.h @@ -29,6 +29,7 @@ THE SOFTWARE. #define glDeleteVertexArrays glDeleteVertexArraysOES #define glGenVertexArrays glGenVertexArraysOES #define glBindVertexArray glBindVertexArrayOES +#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES #include #include diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index 8ab0bf4c83..5cf6edc95a 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -348,7 +348,8 @@ CCImage::~CCImage() bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = eFmtPng*/) { unsigned long nSize; - unsigned char *pBuffer = CCFileUtils::getFileData(CCFileUtils::fullPathFromRelativePath(strPath), "rb", &nSize); + CCFileUtils *fileUtils = CCFileUtils::sharedFileUtils(); + unsigned char *pBuffer = fileUtils->getFileData(fileUtils->fullPathFromRelativePath(strPath), "rb", &nSize); return initWithImageData(pBuffer, nSize, eImgFmt); } @@ -360,7 +361,7 @@ bool CCImage::initWithImageFileThreadSafe(const char *fullpath, EImageFormat ima * CCFileUtils::fullPathFromRelativePath() is not thread-safe, it use autorelease(). */ unsigned long nSize; - unsigned char *pBuffer = CCFileUtils::getFileData(fullpath, "rb", &nSize); + unsigned char *pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullpath, "rb", &nSize); return initWithImageData(pBuffer, nSize, imageType); } diff --git a/js/JSBindings/cocos2d_generated.cpp.REMOVED.git-id b/js/JSBindings/cocos2d_generated.cpp.REMOVED.git-id index 3d85d029c4..05cd982ee9 100644 --- a/js/JSBindings/cocos2d_generated.cpp.REMOVED.git-id +++ b/js/JSBindings/cocos2d_generated.cpp.REMOVED.git-id @@ -1 +1 @@ -2d4adf9bb3276c7884f16637eb15bd5090ad7ca2 \ No newline at end of file +2ef6f502d16098ac1a18aee1ab7a64815c241af6 \ No newline at end of file diff --git a/js/JSBindings/cocos2d_generated.hpp.REMOVED.git-id b/js/JSBindings/cocos2d_generated.hpp.REMOVED.git-id index 4a62df2fde..650571e3ce 100644 --- a/js/JSBindings/cocos2d_generated.hpp.REMOVED.git-id +++ b/js/JSBindings/cocos2d_generated.hpp.REMOVED.git-id @@ -1 +1 @@ -f15b1b846b94b2d2b69438899124884963fd9f09 \ No newline at end of file +27f42f585ea7195531f863d34fff314117000630 \ No newline at end of file diff --git a/testjs/proj.ios/testjs.xcodeproj/project.pbxproj.REMOVED.git-id b/testjs/proj.ios/testjs.xcodeproj/project.pbxproj.REMOVED.git-id index 17c493db58..2997ec0aac 100644 --- a/testjs/proj.ios/testjs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/testjs/proj.ios/testjs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -59d857c1050d96d698c58eaf20c0c3cd1a808cbf \ No newline at end of file +594b0f9fe97d6f6dd1d56c71ccd7e1c61b5522b3 \ No newline at end of file diff --git a/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id b/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id index 3a2f28fb74..1b9507a40b 100644 --- a/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/tests/proj.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -277bc57b726290085c72db62cf656b66594440dc \ No newline at end of file +b77ecad7976dbe21bb61300c73e06ddbad3a4bd8 \ No newline at end of file