From da00d82117032a1efac2afc5b48e2000877a5b86 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 30 Dec 2010 10:28:13 +0800 Subject: [PATCH] fix some error in CCGrid and CCDirector.h --- cocos2dx/include/CCDirector.h | 5 ++++- cocos2dx/platform/CCDirector_mobile.cpp | 2 +- cocos2dx/platform/CCGrid_mobile.cpp | 18 ++++++++---------- cocos2dx/platform/mac/CCDirector_mac.mm | 2 +- cocos2dx/platform/mac/CCGrid_mac.cpp | 19 +++++++++---------- cocos2dx/proj.uphone/cocos2d-uphone.vcproj | 16 ++++++++++++---- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/cocos2dx/include/CCDirector.h b/cocos2dx/include/CCDirector.h index e117b2c7ce..9c9b50cde4 100644 --- a/cocos2dx/include/CCDirector.h +++ b/cocos2dx/include/CCDirector.h @@ -35,6 +35,7 @@ THE SOFTWARE. #include "CCXEGLView.h" #include "ccxCommon.h" #include "CCGL.h" +#include "platform/CCNS.h" #include namespace cocos2d { @@ -181,6 +182,8 @@ class CCLabelTTF; class CCScene; class cocos2d::CCXEGLView; class NSEvent; +class CCNode; +class CCProjectionProtocol; /** @brief Class that creates and handle the main Window and manages how @@ -264,7 +267,7 @@ public: /** returns the display size of the OpenGL view in pixels. It doesn't take into account any possible rotation of the window. */ - CGSize getDisplaySizeInPiXels(void); + CGSize getDisplaySizeInPixels(void); /** changes the projection size */ void reshapeProjection(CGSize newWindowSize); diff --git a/cocos2dx/platform/CCDirector_mobile.cpp b/cocos2dx/platform/CCDirector_mobile.cpp index 81351234f1..639271232e 100644 --- a/cocos2dx/platform/CCDirector_mobile.cpp +++ b/cocos2dx/platform/CCDirector_mobile.cpp @@ -474,7 +474,7 @@ CGSize CCDirector::getWinSizeInPixels() } // return the current frame size -CGSize CCDirector::getDisplaySizeInPiXels(void) +CGSize CCDirector::getDisplaySizeInPixels(void) { return m_obWinSizeInPixels; } diff --git a/cocos2dx/platform/CCGrid_mobile.cpp b/cocos2dx/platform/CCGrid_mobile.cpp index 3da44997ca..9b65fedb53 100644 --- a/cocos2dx/platform/CCGrid_mobile.cpp +++ b/cocos2dx/platform/CCGrid_mobile.cpp @@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "ccMacros.h" -#include "CCGrid.h" +#include "effects/CCGrid.h" #include "CCDirector.h" -#include "CCGrabber.h" +#include "effects/CCGrabber.h" +#include "support/ccUtils.h" #include "CCGL.h" #include "CGPointExtension.h" @@ -108,8 +109,8 @@ namespace cocos2d CCDirector *pDirector = CCDirector::sharedDirector(); CGSize s = pDirector->getWinSizeInPixels(); - unsigned int POTWide = ccNextPOT(s.width); - unsigned int POTHigh = ccNextPOT(s.height); + unsigned int POTWide = ccNextPOT((unsigned int)s.width); + unsigned int POTHigh = ccNextPOT((unsigned int)s.height); CCTexture2DPixelFormat format = pDirector->getPiexFormat() == kCCPixelFormatRGB565 ? kCCTexture2DPixelFormat_RGB565 : kCCTexture2DPixelFormat_RGBA8888; @@ -122,7 +123,7 @@ namespace cocos2d } CCTexture2D *pTexture = new CCTexture2D(); - pTexture->initWithData(data, format, textureSize, textureSize, s); + pTexture->initWithData(data, format, POTWide, POTHigh, s); free(data); @@ -133,10 +134,7 @@ namespace cocos2d return false; } - if (initWithSize(gridSize, pTexture, false)) - { - // do something - } + initWithSize(gridSize, pTexture, false); pTexture->release(); @@ -178,7 +176,7 @@ namespace cocos2d { CCDirector *pDirector = CCDirector::sharedDirector(); - CGSize winSize = pDirector->getDisplaySize(); + CGSize winSize = pDirector->getDisplaySizeInPixels(); float w = winSize.width / 2; float h = winSize.height / 2; diff --git a/cocos2dx/platform/mac/CCDirector_mac.mm b/cocos2dx/platform/mac/CCDirector_mac.mm index a485a9151e..a24d834465 100644 --- a/cocos2dx/platform/mac/CCDirector_mac.mm +++ b/cocos2dx/platform/mac/CCDirector_mac.mm @@ -456,7 +456,7 @@ CGSize CCDirector::getWinSizeInPixels() } // return the current frame size -CGSize CCDirector::getDisplaySizeInPiXels(void) +CGSize CCDirector::getDisplaySizeInPixels(void) { return m_obWinSizeInPixels; } diff --git a/cocos2dx/platform/mac/CCGrid_mac.cpp b/cocos2dx/platform/mac/CCGrid_mac.cpp index 599cef7a22..5070acbb9e 100644 --- a/cocos2dx/platform/mac/CCGrid_mac.cpp +++ b/cocos2dx/platform/mac/CCGrid_mac.cpp @@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "ccMacros.h" -#include "CCGrid.h" +#include "effects/CCGrid.h" #include "CCDirector.h" -#include "CCGrabber.h" +#include "effects/CCGrabber.h" +#include "support/ccUtils.h" #include "CCGL.h" #include "CGPointExtension.h" @@ -108,8 +109,8 @@ namespace cocos2d CCDirector *pDirector = CCDirector::sharedDirector(); CGSize s = pDirector->getWinSizeInPixels(); - unsigned int POTWide = ccNextPOT(s.width); - unsigned int POTHigh = ccNextPOT(s.height); + unsigned int POTWide = ccNextPOT((unsigned int)s.width); + unsigned int POTHigh = ccNextPOT((unsigned int)s.height); // on mac, it use kCCTexture2DPixelFormat_RGBA8888 CCTexture2DPixelFormat format = kCCTexture2DPixelFormat_RGBA8888; @@ -123,7 +124,7 @@ namespace cocos2d } CCTexture2D *pTexture = new CCTexture2D(); - pTexture->initWithData(data, format, textureSize, textureSize, s); + pTexture->initWithData(data, format, POTWide, POTHigh, s); free(data); @@ -134,10 +135,7 @@ namespace cocos2d return false; } - if (initWithSize(gridSize, pTexture, false)) - { - // do something - } + initWithSize(gridSize, pTexture, false); pTexture->release(); @@ -176,7 +174,8 @@ namespace cocos2d // mac can not applay land space void CCGridBase::applyLandscape(void) - { + { + CCLOG("unsupported"); } void CCGridBase::set2DProjection() diff --git a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj index 98725e298a..7f3f33743e 100644 --- a/cocos2dx/proj.uphone/cocos2d-uphone.vcproj +++ b/cocos2dx/proj.uphone/cocos2d-uphone.vcproj @@ -232,6 +232,14 @@ RelativePath="..\actions\CCActionTiledGrid.cpp" > + + + + - - @@ -336,6 +340,10 @@ RelativePath="..\include\CCDrawingPrimitives.h" > + +