diff --git a/cocos/2d/CCActionInterval.cpp b/cocos/2d/CCActionInterval.cpp index ba76229207..c4d46df023 100644 --- a/cocos/2d/CCActionInterval.cpp +++ b/cocos/2d/CCActionInterval.cpp @@ -159,6 +159,19 @@ Sequence* Sequence::createWithTwoActions(FiniteTimeAction *actionOne, FiniteTime return sequence; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +Sequence* Sequence::variadicCreate(FiniteTimeAction *action1, ...) +{ + va_list params; + va_start(params, action1); + + Sequence *ret = Sequence::createWithVariableList(action1, params); + + va_end(params); + + return ret; +} +#else Sequence* Sequence::create(FiniteTimeAction *action1, ...) { va_list params; @@ -170,6 +183,7 @@ Sequence* Sequence::create(FiniteTimeAction *action1, ...) return ret; } +#endif Sequence* Sequence::createWithVariableList(FiniteTimeAction *action1, va_list args) { @@ -532,6 +546,19 @@ RepeatForever *RepeatForever::reverse() const // Spawn // +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +Spawn* Spawn::variadicCreate(FiniteTimeAction *action1, ...) +{ + va_list params; + va_start(params, action1); + + Spawn *ret = Spawn::createWithVariableList(action1, params); + + va_end(params); + + return ret; +} +#else Spawn* Spawn::create(FiniteTimeAction *action1, ...) { va_list params; @@ -543,6 +570,7 @@ Spawn* Spawn::create(FiniteTimeAction *action1, ...) return ret; } +#endif Spawn* Spawn::createWithVariableList(FiniteTimeAction *action1, va_list args) { diff --git a/cocos/2d/CCActionInterval.h b/cocos/2d/CCActionInterval.h index fd55545e6d..5f52e7b8a4 100644 --- a/cocos/2d/CCActionInterval.h +++ b/cocos/2d/CCActionInterval.h @@ -93,7 +93,26 @@ class CC_DLL Sequence : public ActionInterval { public: /** helper constructor to create an array of sequenceable actions */ +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + // WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported + typedef FiniteTimeAction* M; + static Sequence* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); } + static Sequence* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); } + static Sequence* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); } + static Sequence* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); } + + // On WP8 for variable argument lists longer than 10 items, use the other create functions or variadicCreate with NULL as the last argument + static Sequence* variadicCreate(FiniteTimeAction* item, ...); +#else static Sequence* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION; +#endif + /** helper constructor to create an array of sequenceable actions given an array * @code * When this funtion bound to the js or lua,the input params changed @@ -248,7 +267,25 @@ public: * in lua :local create(local object1,local object2, ...) * @endcode */ +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + // WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported + typedef FiniteTimeAction* M; + static Spawn* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); } + static Spawn* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); } + static Spawn* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); } + static Spawn* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); } + + // On WP8 for variable argument lists longer than 10 items, use the other create functions or createSpawn with NULL as the last argument + static Spawn* variadicCreate(FiniteTimeAction* item, ...); +#else static Spawn* create(FiniteTimeAction *action1, ...) CC_REQUIRES_NULL_TERMINATION; +#endif /** helper constructor to create an array of spawned actions */ static Spawn* createWithVariableList(FiniteTimeAction *action1, va_list args); diff --git a/cocos/2d/CCDeprecated.h b/cocos/2d/CCDeprecated.h index 89808e5c59..51c2cb98bd 100644 --- a/cocos/2d/CCDeprecated.h +++ b/cocos/2d/CCDeprecated.h @@ -963,6 +963,8 @@ CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetBlackBerry = Applic CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetNaCl = Application::Platform::OS_NACL; CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetEmscripten = Application::Platform::OS_EMSCRIPTEN; CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetTizen = Application::Platform::OS_TIZEN; +CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetWinRT = Application::Platform::OS_WINRT; +CC_DEPRECATED_ATTRIBUTE const Application::Platform kTargetWP8 = Application::Platform::OS_WP8; CC_DEPRECATED_ATTRIBUTE typedef Application::Platform TargetPlatform; CC_DEPRECATED_ATTRIBUTE const ResolutionPolicy kResolutionExactFit = ResolutionPolicy::EXACT_FIT; diff --git a/cocos/2d/CCDirector.cpp b/cocos/2d/CCDirector.cpp index baec3f1127..43f440a334 100644 --- a/cocos/2d/CCDirector.cpp +++ b/cocos/2d/CCDirector.cpp @@ -45,6 +45,7 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "CCApplication.h" #include "CCFontFNT.h" +#include "CCFontAtlasCache.h" #include "CCActionManager.h" #include "CCAnimationCache.h" #include "CCTouch.h" @@ -157,8 +158,10 @@ bool Director::init(void) initTextureCache(); _renderer = new Renderer; - _console = new Console; +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) + _console = new Console; +#endif return true; } @@ -182,7 +185,10 @@ Director::~Director(void) delete _eventProjectionChanged; delete _renderer; + +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) delete _console; +#endif // clean auto release pool PoolManager::destroyInstance(); @@ -432,6 +438,12 @@ void Director::setProjection(Projection projection) case Projection::_2D: kmGLMatrixMode(KM_GL_PROJECTION); kmGLLoadIdentity(); +#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 + if(getOpenGLView() != nullptr) + { + kmGLMultMatrix( getOpenGLView()->getOrientationMatrix()); + } +#endif kmMat4 orthoMatrix; kmMat4OrthographicProjection(&orthoMatrix, 0, size.width, 0, size.height, -1024, 1024); kmGLMultMatrix(&orthoMatrix); @@ -447,7 +459,15 @@ void Director::setProjection(Projection projection) kmGLMatrixMode(KM_GL_PROJECTION); kmGLLoadIdentity(); - + +#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 + //if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode + GLView* view = getOpenGLView(); + if(getOpenGLView() != nullptr) + { + kmGLMultMatrix(getOpenGLView()->getOrientationMatrix()); + } +#endif // issue #1334 kmMat4PerspectiveProjection(&matrixPerspective, 60, (GLfloat)size.width/size.height, 10, zeye+size.height/2); // kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500); @@ -485,10 +505,16 @@ void Director::setProjection(Projection projection) void Director::purgeCachedData(void) { FontFNT::purgeCachedData(); + FontAtlasCache::purgeCachedData(); + if (s_SharedDirector->getOpenGLView()) { SpriteFrameCache::getInstance()->removeUnusedSpriteFrames(); _textureCache->removeUnusedTextures(); + + // Note: some tests such as ActionsTest are leaking refcounted textures + // There should be no test textures left in the cache + log("%s\n", _textureCache->getCachedTextureInfo().c_str()); } FileUtils::getInstance()->purgeCachedEntries(); } @@ -533,6 +559,11 @@ static void GLToClipTransform(kmMat4 *transformOut) kmMat4 projection; kmGLGetMatrix(KM_GL_PROJECTION, &projection); +#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 + //if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions + kmMat4Multiply(&projection, Director::getInstance()->getOpenGLView()->getReverseOrientationMatrix(), &projection); +#endif + kmMat4 modelview; kmGLGetMatrix(KM_GL_MODELVIEW, &modelview); diff --git a/cocos/2d/CCDirector.h b/cocos/2d/CCDirector.h index f6c8e1f6e1..c58214b57b 100644 --- a/cocos/2d/CCDirector.h +++ b/cocos/2d/CCDirector.h @@ -59,7 +59,10 @@ class EventCustom; class EventListenerCustom; class TextureCache; class Renderer; + +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) class Console; +#endif /** @brief Class that creates and handles the main Window and manages how @@ -368,7 +371,9 @@ public: /** Returns the Console @since v3.0 */ +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) Console* getConsole() const { return _console; } +#endif /* Gets delta time since last tick to main loop */ float getDeltaTime() const; @@ -477,9 +482,11 @@ protected: /* Renderer for the Director */ Renderer *_renderer; +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) /* Console for the director */ Console *_console; - +#endif + // GLViewProtocol will recreate stats labels to fit visible rect friend class GLViewProtocol; }; diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index 11f9998d6c..9198993d21 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -185,7 +185,9 @@ void FontAtlas::listenToForeground(EventCustom *event) auto contentSize = Size(CacheTextureWidth,CacheTextureHeight); auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; - _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, contentSize ); + // this is a memory leak as the texture previously in _atlasTextures[_currentPage] is not deleted from OpenGL + // see CCTexture2D::initWithData for the temporary fix + _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, contentSize ); } } #endif @@ -257,8 +259,10 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String) _currentPageOrigY += _commonLineHeight; _currentPageOrigX = 0; if(_currentPageOrigY + _commonLineHeight >= CacheTextureHeight) - { - _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, contentSize ); + { + // this is a memory leak as the texture previously in _atlasTextures[_currentPage] is not deleted from OpenGL + // see CCTexture2D::initWithData for the temporary fix + _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, contentSize ); _currentPageOrigY = 0; memset(_currentPageData, 0, _currentPageDataSize); _currentPage++; @@ -303,6 +307,8 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String) if(existNewLetter) { + // this is a memory leak as the texture previously in _atlasTextures[_currentPage] is not deleted from OpenGL + // see CCTexture2D::initWithData for the temporary fix _atlasTextures[_currentPage]->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, contentSize ); } return true; diff --git a/cocos/2d/CCFontFreeType.h b/cocos/2d/CCFontFreeType.h index a103ee6570..00ecc41bac 100644 --- a/cocos/2d/CCFontFreeType.h +++ b/cocos/2d/CCFontFreeType.h @@ -26,15 +26,29 @@ #ifndef _FontFreetype_h_ #define _FontFreetype_h_ + + + #include "CCFont.h" #include "CCData.h" #include #include +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#define generic GenericFromFreeTypeLibrary +#define internal InternalFromFreeTypeLibrary +#endif + #include FT_FREETYPE_H #include FT_STROKER_H +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#undef generic +#undef internal +#endif + + NS_CC_BEGIN class CC_DLL FontFreeType : public Font diff --git a/cocos/2d/CCGLProgram.cpp b/cocos/2d/CCGLProgram.cpp index ee6b53cb42..6f3bce0f3b 100644 --- a/cocos/2d/CCGLProgram.cpp +++ b/cocos/2d/CCGLProgram.cpp @@ -37,6 +37,10 @@ THE SOFTWARE. #include "kazmath/GL/matrix.h" #include "kazmath/kazmath.h" +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +#include "CCPrecompiledShaders.h" +#endif + NS_CC_BEGIN typedef struct _hashUniformEntry @@ -116,6 +120,18 @@ GLProgram::~GLProgram() bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) { + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + GLboolean hasCompiler = false; + glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler); + _hasShaderCompiler = (hasCompiler == GL_TRUE); + + if(!_hasShaderCompiler) + { + return initWithPrecompiledProgramByteArray(vShaderByteArray,fShaderByteArray); + } +#endif + _program = glCreateProgram(); CHECK_GL_ERROR_DEBUG(); @@ -126,7 +142,8 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* if (!compileShader(&_vertShader, GL_VERTEX_SHADER, vShaderByteArray)) { CCLOG("cocos2d: ERROR: Failed to compile vertex shader"); - } + return false; + } } // Create and compile fragment shader @@ -135,6 +152,7 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* if (!compileShader(&_fragShader, GL_FRAGMENT_SHADER, fShaderByteArray)) { CCLOG("cocos2d: ERROR: Failed to compile fragment shader"); + return false; } } @@ -152,9 +170,34 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* CHECK_GL_ERROR_DEBUG(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + _shaderId = CCPrecompiledShaders::getInstance()->addShaders(vShaderByteArray, fShaderByteArray); +#endif + return true; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) +{ + bool haveProgram = false; + + _program = glCreateProgram(); + CHECK_GL_ERROR_DEBUG(); + + _vertShader = _fragShader = 0; + + haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray); + + CHECK_GL_ERROR_DEBUG(); + _hashForUniforms = NULL; + + CHECK_GL_ERROR_DEBUG(); + + return haveProgram; +} +#endif + bool GLProgram::initWithFilenames(const std::string &vShaderFilename, const std::string &fShaderFilename) { auto fileUtils = FileUtils::getInstance(); @@ -275,6 +318,15 @@ bool GLProgram::link() { CCASSERT(_program != 0, "Cannot link invalid program"); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + if(!_hasShaderCompiler) + { + // precompiled shader program is already linked + return true; + } +#endif + GLint status = GL_TRUE; glLinkProgram(_program); @@ -291,7 +343,7 @@ bool GLProgram::link() _vertShader = _fragShader = 0; -#if COCOS2D_DEBUG +#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) glGetProgramiv(_program, GL_LINK_STATUS, &status); if (status == GL_FALSE) @@ -301,7 +353,14 @@ bool GLProgram::link() _program = 0; } #endif - + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + if (status == GL_TRUE) + { + CCPrecompiledShaders::getInstance()->addProgram(_program, _shaderId); + } +#endif + return (status == GL_TRUE); } diff --git a/cocos/2d/CCGLProgram.h b/cocos/2d/CCGLProgram.h index c111c0c724..19c9865f7d 100644 --- a/cocos/2d/CCGLProgram.h +++ b/cocos/2d/CCGLProgram.h @@ -126,7 +126,18 @@ public: * @js initWithString * @lua initWithString */ + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + /** Initializes the CCGLProgram with precompiled shader program */ + bool initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); +#endif + + /** Initializes the GLProgram with a vertex and fragment with bytes array + * @js initWithString + * @lua initWithString + */ bool initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); + /** Initializes the GLProgram with a vertex and fragment with contents of filenames * @js init * @lua init @@ -266,6 +277,10 @@ private: GLuint _fragShader; GLint _uniforms[UNIFORM_MAX]; struct _hashUniformEntry* _hashForUniforms; + bool _hasShaderCompiler; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + std::string _shaderId; +#endif struct flag_struct { unsigned int usesTime:1; diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index feb6c9c12e..ea79ce6ea5 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -852,7 +852,7 @@ LayerMultiplex * LayerMultiplex::create(Layer * layer, ...) LayerMultiplex * LayerMultiplex::createWithLayer(Layer* layer) { - return LayerMultiplex::create(layer, nullptr); + return LayerMultiplex::create(layer, NULL); } LayerMultiplex* LayerMultiplex::create() diff --git a/cocos/2d/CCLayer.h b/cocos/2d/CCLayer.h index b1f96f5c78..86443b75c3 100644 --- a/cocos/2d/CCLayer.h +++ b/cocos/2d/CCLayer.h @@ -431,7 +431,25 @@ public: * In lua:local create(...) * @endcode */ +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + // WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported + typedef Layer* M; + static LayerMultiplex* create(M m1, std::nullptr_t listEnd) { return createVariadic(m1, NULL); } + static LayerMultiplex* create(M m1, M m2, std::nullptr_t listEnd) { return createVariadic(m1, m2, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, m6, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, m6, m7, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, m6, m7, m8, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); } + static LayerMultiplex* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return createVariadic(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); } + + // On WP8 for variable argument lists longer than 10 items, use createWithArray or createVariadic with NULL as the last argument + static LayerMultiplex* createVariadic(Layer* item, ...) CC_REQUIRES_NULL_TERMINATION; +#else static LayerMultiplex * create(Layer* layer, ... ); +#endif /** * lua script can not init with undetermined number of variables diff --git a/cocos/2d/CCMenu.cpp b/cocos/2d/CCMenu.cpp index c6cb20c5c1..da226b8d28 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -53,11 +53,27 @@ Menu::~Menu() CCLOGINFO("In the destructor of Menu. %p", this); } + Menu* Menu::create() { return Menu::create(nullptr, nullptr); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) +Menu * Menu::variadicCreate(MenuItem* item, ...) +{ + va_list args; + va_start(args,item); + + Menu *ret = Menu::createWithItems(item, args); + + va_end(args); + + return ret; +} +#else + + Menu * Menu::create(MenuItem* item, ...) { va_list args; @@ -69,6 +85,8 @@ Menu * Menu::create(MenuItem* item, ...) return ret; } +#endif + Menu* Menu::createWithArray(const Vector& arrayOfItems) { diff --git a/cocos/2d/CCMenu.h b/cocos/2d/CCMenu.h index 02287693c1..9fdb05e82b 100644 --- a/cocos/2d/CCMenu.h +++ b/cocos/2d/CCMenu.h @@ -60,9 +60,27 @@ public: /** creates an empty Menu */ static Menu* create(); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + // WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported + typedef MenuItem* M; + static Menu* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); } + static Menu* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); } + static Menu* create(M m1, M m2, M m3, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); } + static Menu* create(M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return variadicCreate(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); } + // On WP8 for lists longer than 10 items, use createWithArray or variadicCreate with NULL as the last argument + static Menu* variadicCreate(MenuItem* item, ...); +#else /** creates a Menu with MenuItem objects */ static Menu* create(MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION; +#endif /** creates a Menu with a Array of MenuItem objects */ static Menu* createWithArray(const Vector& arrayOfItems); @@ -136,6 +154,9 @@ CC_CONSTRUCTOR_ACCESS: bool initWithArray(const Vector& arrayOfItems); protected: + + + /** whether or not the menu will receive events */ bool _enabled; diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index d1f6859315..52d9d19c95 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1458,7 +1458,9 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Node); }; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - NodeRGBA +#endif /** NodeRGBA is a subclass of Node that implements the RGBAProtocol protocol. diff --git a/cocos/2d/CCParticleSystem.h b/cocos/2d/CCParticleSystem.h index 53f6f968ea..31e25952d3 100644 --- a/cocos/2d/CCParticleSystem.h +++ b/cocos/2d/CCParticleSystem.h @@ -125,6 +125,13 @@ emitter.startSpin = 0; @endcode */ + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) +#ifdef RELATIVE +#undef RELATIVE +#endif +#endif + class CC_DLL ParticleSystem : public Node, public TextureProtocol { public: diff --git a/cocos/2d/CCProfiling.cpp b/cocos/2d/CCProfiling.cpp index 3f6979a951..11ee529ce6 100644 --- a/cocos/2d/CCProfiling.cpp +++ b/cocos/2d/CCProfiling.cpp @@ -31,7 +31,10 @@ using namespace std; NS_CC_BEGIN +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - Profiling Categories +#endif + /* set to false the categories that you don't want to profile */ bool kProfilerCategorySprite = false; bool kProfilerCategoryBatchSprite = false; diff --git a/cocos/2d/CCScriptSupport.cpp b/cocos/2d/CCScriptSupport.cpp index 78cd476547..ccc8ed48a5 100644 --- a/cocos/2d/CCScriptSupport.cpp +++ b/cocos/2d/CCScriptSupport.cpp @@ -41,8 +41,10 @@ bool CC_DLL cc_assert_script_compatible(const char *msg) NS_CC_BEGIN +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark ScriptHandlerEntry +#endif ScriptHandlerEntry* ScriptHandlerEntry::create(int handler) { @@ -61,8 +63,10 @@ ScriptHandlerEntry::~ScriptHandlerEntry(void) } } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark SchedulerScriptHandlerEntry +#endif SchedulerScriptHandlerEntry* SchedulerScriptHandlerEntry::create(int handler, float interval, bool paused) { @@ -87,9 +91,10 @@ SchedulerScriptHandlerEntry::~SchedulerScriptHandlerEntry(void) LUALOG("[LUA] DEL script schedule %d, entryID: %d", _handler, _entryId); } - +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark TouchScriptHandlerEntry +#endif TouchScriptHandlerEntry* TouchScriptHandlerEntry::create(int handler, bool isMultiTouches, @@ -115,8 +120,10 @@ bool TouchScriptHandlerEntry::init(bool isMultiTouches, int priority, bool swall return true; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark ScriptEngineManager +#endif static ScriptEngineManager* s_pSharedScriptEngineManager = nullptr; diff --git a/cocos/2d/CCTexture2D.cpp b/cocos/2d/CCTexture2D.cpp index 564298eca3..2185a841cc 100644 --- a/cocos/2d/CCTexture2D.cpp +++ b/cocos/2d/CCTexture2D.cpp @@ -51,6 +51,8 @@ THE SOFTWARE. NS_CC_BEGIN + + namespace { typedef Texture2D::PixelFormatInfoMap::value_type PixelFormatInfoMapValue; static const PixelFormatInfoMapValue TexturePixelFormatInfoTablesValue[] = @@ -549,6 +551,15 @@ bool Texture2D::initWithData(const void *data, ssize_t dataLen, Texture2D::Pixel bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat pixelFormat, int pixelsWide, int pixelsHigh) { + // cocos2d-x is currently calling this multiple times on the same Texture2D + // if the GL texture has already been created,it will be leaked in OpenGL + // For now, call deleteTexture if the texture already exists + if(_name) + { + GL::deleteTexture(_name); + _name = 0; + } + //the pixelFormat must be a certain value CCASSERT(pixelFormat != PixelFormat::NONE && pixelFormat != PixelFormat::AUTO, "the \"pixelFormat\" param must be a certain value!"); CCASSERT(pixelsWide>0 && pixelsHigh>0, "Invalid size"); diff --git a/cocos/2d/ZipUtils.h b/cocos/2d/ZipUtils.h index 3611679248..8a342d9ac5 100644 --- a/cocos/2d/ZipUtils.h +++ b/cocos/2d/ZipUtils.h @@ -32,7 +32,7 @@ THE SOFTWARE. #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #include "platform/android/CCFileUtilsAndroid.h" -#elif(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#elif(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) // for import ssize_t on win32 platform #include "CCStdC.h" #endif diff --git a/cocos/2d/ccCArray.cpp b/cocos/2d/ccCArray.cpp index 69dd34f24e..a25a636239 100644 --- a/cocos/2d/ccCArray.cpp +++ b/cocos/2d/ccCArray.cpp @@ -278,8 +278,10 @@ void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr) arr->num -= back; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark ccCArray for Values (c structures) +#endif /** Allocates and initializes a new C array with specified capacity */ ccCArray* ccCArrayNew(ssize_t capacity) diff --git a/cocos/2d/ccCArray.h b/cocos/2d/ccCArray.h index 5cc80bbecd..0529d83ac3 100644 --- a/cocos/2d/ccCArray.h +++ b/cocos/2d/ccCArray.h @@ -130,8 +130,10 @@ void ccArrayRemoveArray(ccArray *arr, ccArray *minusArr); matching instances in arr will be removed. */ void ccArrayFullRemoveArray(ccArray *arr, ccArray *minusArr); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - // #pragma mark ccCArray for Values (c structures) +#endif typedef struct _ccCArray { ssize_t num, max; diff --git a/cocos/2d/ccGLStateCache.cpp b/cocos/2d/ccGLStateCache.cpp index d8a620f463..cb0c5bc56c 100644 --- a/cocos/2d/ccGLStateCache.cpp +++ b/cocos/2d/ccGLStateCache.cpp @@ -217,7 +217,9 @@ void bindVAO(GLuint vaoId) } } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - GL Vertex Attrib functions +#endif void enableVertexAttribs( unsigned int flags ) { @@ -260,8 +262,9 @@ void enableVertexAttribs( unsigned int flags ) } } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - GL Uniforms functions - +#endif void setProjectionMatrixDirty( void ) { s_currentProjectionMatrix = -1; diff --git a/cocos/2d/cocos2d.h b/cocos/2d/cocos2d.h index 6e4b798715..e1699ab5af 100644 --- a/cocos/2d/cocos2d.h +++ b/cocos/2d/cocos2d.h @@ -195,6 +195,22 @@ THE SOFTWARE. #include "platform/linux/CCStdC.h" #endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + #include "platform/winrt/CCApplication.h" + #include "platform/winrt/CCGLView.h" + #include "platform/winrt/CCGL.h" + #include "platform/winrt/CCStdC.h" + #include "platform/winrt/CCPrecompiledShaders.h" +#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + #include "platform/winrt/CCApplication.h" + #include "platform/wp8/CCGLView.h" + #include "platform/winrt/CCGL.h" + #include "platform/winrt/CCStdC.h" + #include "platform/winrt/CCPrecompiledShaders.h" +#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8 + // script_support #include "CCScriptSupport.h" diff --git a/cocos/2d/platform/CCApplicationProtocol.h b/cocos/2d/platform/CCApplicationProtocol.h index 7c47c46e81..ed948ebff5 100644 --- a/cocos/2d/platform/CCApplicationProtocol.h +++ b/cocos/2d/platform/CCApplicationProtocol.h @@ -52,7 +52,9 @@ public: OS_BLACKBERRY, OS_NACL, OS_EMSCRIPTEN, - OS_TIZEN + OS_TIZEN, + OS_WINRT, + OS_WP8 }; /** diff --git a/cocos/2d/platform/CCImage.cpp b/cocos/2d/platform/CCImage.cpp index 918a4cedfc..4a991c8939 100644 --- a/cocos/2d/platform/CCImage.cpp +++ b/cocos/2d/platform/CCImage.cpp @@ -46,7 +46,9 @@ extern "C" #include "atitc.h" #include "TGAlib.h" +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) #include "decode.h" +#endif #include "ccMacros.h" #include "CCCommon.h" @@ -1832,7 +1834,11 @@ bool Image::initWithPVRData(const unsigned char * data, ssize_t dataLen) bool Image::initWithWebpData(const unsigned char * data, ssize_t dataLen) { - bool bRet = false; + bool bRet = false; + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + CCLOG("WEBP image format not supported on WinRT or WP8"); +#else do { WebPDecoderConfig config; @@ -1862,9 +1868,11 @@ bool Image::initWithWebpData(const unsigned char * data, ssize_t dataLen) bRet = true; } while (0); +#endif return bRet; } + bool Image::initWithRawData(const unsigned char * data, ssize_t dataLen, int width, int height, int bitsPerComponent, bool preMulti) { bool bRet = false; diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index c58b933384..0f9d7f625f 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -106,6 +106,8 @@ static bool isFloat( std::string myString ) { return iss.eof() && !iss.fail(); } +#if CC_TARGET_PLATFORM != CC_PLATFORM_WINRT && CC_TARGET_PLATFORM != CC_PLATFORM_WP8 + // helper free functions // dprintf() is not defined in Android @@ -176,6 +178,7 @@ static void printFileUtils(int fd) } sendPrompt(fd); } +#endif #if defined(__MINGW32__) @@ -210,20 +213,22 @@ static void _log(const char *format, va_list args) #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf); -#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 +#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 WCHAR wszBuf[MAX_LOG_LENGTH] = {0}; MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(wszBuf)); OutputDebugStringW(wszBuf); WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), NULL, FALSE); printf("%s", buf); - #else // Linux, Mac, iOS, etc fprintf(stdout, "cocos2d: %s", buf); fflush(stdout); #endif +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) Director::getInstance()->getConsole()->log(buf); +#endif + } // XXX: Deprecated @@ -243,6 +248,8 @@ void log(const char * format, ...) va_end(args); } +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) + // // Console code // @@ -1081,4 +1088,7 @@ void Console::loop() _running = false; } +#endif /* #if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) */ + + NS_CC_END diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index 66ae38e54e..04d1d622ae 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -68,6 +68,8 @@ void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2); scheduler->performFunctionInCocosThread( ... ); ``` */ + +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) class CC_DLL Console { public: @@ -142,6 +144,7 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Console); }; +#endif /* #if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) */ NS_CC_END #endif /* defined(__CCCONSOLE_H__) */ diff --git a/cocos/base/CCPlatformConfig.h b/cocos/base/CCPlatformConfig.h index 7d171b8d8b..f9e5e698a3 100644 --- a/cocos/base/CCPlatformConfig.h +++ b/cocos/base/CCPlatformConfig.h @@ -48,6 +48,8 @@ Config of cocos2d-x project, per target platform. #define CC_PLATFORM_EMSCRIPTEN 10 #define CC_PLATFORM_TIZEN 11 #define CC_PLATFORM_QT5 12 +#define CC_PLATFORM_WP8 13 +#define CC_PLATFORM_WINRT 14 // Determine target platform by compile environment macro. #define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN @@ -124,6 +126,19 @@ Config of cocos2d-x project, per target platform. #define CC_TARGET_PLATFORM CC_PLATFORM_QT5 #endif +// WinRT (Windows Store App) +#if defined(WINRT) + #undef CC_TARGET_PLATFORM + #define CC_TARGET_PLATFORM CC_PLATFORM_WINRT +#endif + +// WP8 (Windows Phone 8 App) +#if defined(WP8) + #undef CC_TARGET_PLATFORM + #define CC_TARGET_PLATFORM CC_PLATFORM_WP8 +#endif + + ////////////////////////////////////////////////////////////////////////// // post configure ////////////////////////////////////////////////////////////////////////// diff --git a/cocos/base/CCPlatformMacros.h b/cocos/base/CCPlatformMacros.h index 426d898420..f711cbfdee 100644 --- a/cocos/base/CCPlatformMacros.h +++ b/cocos/base/CCPlatformMacros.h @@ -82,7 +82,7 @@ to be different from other platforms unless there's a good reason. It's new in cocos2d-x since v0.99.5 */ -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #define CC_ENABLE_CACHE_TEXTURE_DATA 1 #else #define CC_ENABLE_CACHE_TEXTURE_DATA 0 diff --git a/cocos/editor-support/cocosbuilder/CCBReader.h b/cocos/editor-support/cocosbuilder/CCBReader.h index 0fc9bef999..6fbcb3ef19 100644 --- a/cocos/editor-support/cocosbuilder/CCBReader.h +++ b/cocos/editor-support/cocosbuilder/CCBReader.h @@ -128,7 +128,12 @@ public: PERCENT, MULTIPLY_RESOLUTION, }; - + +#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 +#ifdef ABSOLUTE +#undef ABSOLUTE +#endif +#endif enum class SizeType { ABSOLUTE, diff --git a/cocos/editor-support/cocostudio/CCComAudio.cpp b/cocos/editor-support/cocostudio/CCComAudio.cpp index e232d07569..04d4efd235 100644 --- a/cocos/editor-support/cocostudio/CCComAudio.cpp +++ b/cocos/editor-support/cocostudio/CCComAudio.cpp @@ -97,6 +97,15 @@ bool ComAudio::serialize(void* r) CC_BREAK_IF(resType != 0); if (strcmp(className, "CCBackgroundAudio") == 0) { +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + // no MP3 support for CC_PLATFORM_WP8 + std::string::size_type pos = filePath.find(".mp3"); + if (pos == filePath.npos) + { + continue; + } + filePath.replace(pos, filePath.length(), ".wav"); +#endif preloadBackgroundMusic(filePath.c_str()); bool loop = DICTOOL->getIntValue_json(*v, "loop") != 0? true:false; setLoop(loop); diff --git a/cocos/ui/GUIDefine.h b/cocos/ui/GUIDefine.h index 788439e7aa..59d36a0b34 100644 --- a/cocos/ui/GUIDefine.h +++ b/cocos/ui/GUIDefine.h @@ -30,9 +30,12 @@ #include #include "cocostudio/ObjectFactory.h" -//#pragma mark - -//#pragma mark Widget macro -//#pragma mark - +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) +#pragma mark - +#pragma mark Widget macro +#pragma mark - +#endif + #define DECLARE_CLASS_GUI_INFO \ public: \ @@ -50,9 +53,12 @@ cocostudio::ObjectFactory::TInfo(#className, &className::createInstance) \ -//#pragma mark - -//#pragma mark Reader macro -//#pragma mark - +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) +#pragma mark - +#pragma mark Reader macro +#pragma mark - +#endif + #define DECLARE_CLASS_WIDGET_READER_INFO \ public: \ diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index c5e3bd41c2..099b02bcc2 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -190,8 +190,11 @@ bool ControlStepper::isContinuous() const { return _continuous; } + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - //#pragma mark ControlStepper Public Methods +#endif void ControlStepper::setValueWithSendingEvent(double value, bool send) { diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index ef943f9228..afaac3ee2d 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -238,7 +238,7 @@ void ScrollView::setContentOffsetInDuration(Point offset, float dt) scroll = MoveTo::create(dt, offset); expire = CallFuncN::create(CC_CALLBACK_1(ScrollView::stoppedAnimatedScroll,this)); - _container->runAction(Sequence::create(scroll, expire, NULL)); + _container->runAction(Sequence::create(scroll, expire, nullptr)); this->schedule(schedule_selector(ScrollView::performedAnimatedScroll)); } diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index b8a3717de5..51aba846bb 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -30,7 +30,7 @@ #include #include -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) #include #include #include diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index e55b5c235e..fbf786ec22 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -1432,7 +1432,9 @@ std::string ActionTargetedReverse::subtitle() const return "Action that runs reversely on another target. Useful for sequences"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ActionStacked +#endif void ActionStacked::onEnter() { @@ -1486,8 +1488,9 @@ std::string ActionStacked::subtitle() const return "Tap screen"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ActionMoveStacked - +#endif void ActionMoveStacked::runActionsInSprite(Sprite *sprite) { @@ -1513,7 +1516,9 @@ std::string ActionMoveStacked::title() const return "Stacked MoveBy/To actions"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ActionMoveJumpStacked +#endif void ActionMoveJumpStacked::runActionsInSprite(Sprite *sprite) { @@ -1538,7 +1543,9 @@ std::string ActionMoveJumpStacked::title() const return "tacked Move + Jump actions"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ActionMoveBezierStacked +#endif void ActionMoveBezierStacked::runActionsInSprite(Sprite *sprite) { @@ -1692,7 +1699,9 @@ std::string ActionCatmullRomStacked::subtitle() const } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ActionCardinalSplineStacked +#endif void ActionCardinalSplineStacked::onEnter() { diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index d62b6c9ef9..9c36a00913 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -102,19 +102,28 @@ bool AppDelegate::applicationDidFinishLaunching() fileUtils->setSearchPaths(searchPaths); // glview->setDesignResolutionSize(screenSize.width, screenSize.height, ResolutionPolicy::NO_BORDER); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); +#else glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); +#endif auto scene = Scene::create(); auto layer = new TestController(); +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) layer->addConsoleAutoTest(); +#endif + layer->autorelease(); scene->addChild(layer); director->runWithScene(scene); // Enable Remote Console +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) auto console = director->getConsole(); console->listenOnTCP(5678); +#endif return true; } diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index da1423de7f..301e397be1 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -130,7 +130,9 @@ void BaseClippingNodeTest::setup() } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - BasicTest +#endif std::string BasicTest::title() const { @@ -209,7 +211,9 @@ Node* BasicTest::content() } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ShapeTest +#endif std::string ShapeTest::title() const { @@ -235,8 +239,9 @@ Node* ShapeTest::content() return node; } - +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ShapeInvertedTest +#endif std::string ShapeInvertedTest::title() const { @@ -255,7 +260,9 @@ ClippingNode* ShapeInvertedTest::clipper() return clipper; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - SpriteTest +#endif std::string SpriteTest::title() const { @@ -288,7 +295,9 @@ Node* SpriteTest::content() return node; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - SpriteNoAlphaTest +#endif std::string SpriteNoAlphaTest::title() const { @@ -307,7 +316,9 @@ ClippingNode* SpriteNoAlphaTest::clipper() return clipper; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - SpriteInvertedTest +#endif std::string SpriteInvertedTest::title() const { @@ -327,7 +338,9 @@ ClippingNode* SpriteInvertedTest::clipper() return clipper; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - NestedTest +#endif std::string NestedTest::title() const { @@ -372,7 +385,9 @@ void NestedTest::setup() } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - HoleDemo +#endif HoleDemo::~HoleDemo() { @@ -467,7 +482,9 @@ void HoleDemo::onTouchesBegan(const std::vector& touches, Event* event) this->pokeHoleAtPoint(point); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - ScrollViewDemo +#endif std::string ScrollViewDemo::title() const { @@ -543,7 +560,9 @@ void ScrollViewDemo::onTouchesEnded(const std::vector& touches, Event * _scrolling = false; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - RawStencilBufferTests +#endif //#if COCOS2D_DEBUG > 1 diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index 9ae653f43b..66ec4c4a02 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -14,6 +14,8 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #define MUSIC_FILE "music.mid" +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) + #define MUSIC_FILE "background.wav" #elif (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX ) #define MUSIC_FILE "background.ogg" #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h index d5b5788488..e188228ed2 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.h @@ -40,9 +40,9 @@ public: virtual std::string title() const override; virtual void onEnter() override; - void restartCallback(Ref* sender) override; - void nextCallback(Ref* sender) override; - void backCallback(Ref* sender) override; + virtual void restartCallback(Ref* sender) override; + virtual void nextCallback(Ref* sender) override; + virtual void backCallback(Ref* sender) override; }; @@ -59,7 +59,10 @@ protected: ConsoleCustomCommand(); virtual ~ConsoleCustomCommand(); +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) cocos2d::Console *_console; +#endif + private: CC_DISALLOW_COPY_AND_ASSIGN(ConsoleCustomCommand); }; diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp index 4c65ddaae0..e32efbf736 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp @@ -10,9 +10,11 @@ USING_NS_CC; USING_NS_CC_EXT; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #pragma mark - #pragma mark CustomImageLayer #pragma mark - +#endif void CustomImageLayer::onEnter() { @@ -28,9 +30,11 @@ void CustomImageLayer::onEnter() addChild(layout); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #pragma mark - #pragma mark CustomImageScene #pragma mark - +#endif void CustomImageScene::onEnter() { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp index 2b328fdbda..ae956b8097 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp @@ -18,9 +18,11 @@ USING_NS_CC_EXT; using namespace ui; using namespace cocostudio; +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #pragma mark - #pragma mark CustomParticleWidgetLayer #pragma mark - +#endif void CustomParticleWidgetLayer::onEnter() { @@ -38,9 +40,11 @@ void CustomParticleWidgetLayer::onEnter() addChild(custom, 10, -1); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) #pragma mark - #pragma mark CustomImageScene #pragma mark - +#endif void CustomParticleWidgetScene::onEnter() { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp index da2f82c47b..1cc279395e 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioGUITest/GUIEditorTest.cpp @@ -337,8 +337,8 @@ void GUIEditorTestScene::onEnter() auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(GUIEditorTestScene::BackCallback, this)); - Menu* pMenu =CCMenu::create(pMenuItem, NULL); - + Menu* pMenu =CCMenu::create(pMenuItem, nullptr); + pMenu->setPosition( Point::ZERO ); pMenuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp index 98ca91efd0..5e4c84f5a9 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp @@ -3,7 +3,7 @@ #include "NotificationCenterTest/NotificationCenterTest.h" #include "ControlExtensionTest/CCControlSceneManager.h" #include "CocosBuilderTest/CocosBuilderTest.h" -#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_NACL) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_NACL) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) #include "NetworkTest/HttpClientTest.h" #endif #include "TableViewTest/TableViewTestScene.h" @@ -58,7 +58,7 @@ static struct { scene->release(); } }}, -#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_NACL) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) && (CC_TARGET_PLATFORM != CC_PLATFORM_NACL) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) { "HttpClientTest", [](Ref *sender){ runHttpClientTest();} }, #endif diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index 140371d63f..856350b2e7 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -45,7 +45,9 @@ void FileUtilsTestScene::runThisTest() Director::getInstance()->replaceScene(this); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) // #pragma mark - FileUtilsDemo +#endif void FileUtilsDemo::onEnter() { @@ -92,7 +94,9 @@ std::string FileUtilsDemo::subtitle() const return ""; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - TestResolutionDirectories +#endif void TestResolutionDirectories::onEnter() { @@ -146,7 +150,9 @@ std::string TestResolutionDirectories::subtitle() const return "See the console"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - TestSearchPath +#endif void TestSearchPath::onEnter() { @@ -225,7 +231,9 @@ std::string TestSearchPath::subtitle() const return "See the console"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - TestFilenameLookup +#endif void TestFilenameLookup::onEnter() { @@ -263,7 +271,9 @@ std::string TestFilenameLookup::title() const return "FileUtils: filename lookup"; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - TestIsFileExist +#endif void TestIsFileExist::onEnter() { @@ -307,7 +317,9 @@ std::string TestIsFileExist::subtitle() const return ""; } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - TestWritePlist +#endif void TextWritePlist::onEnter() { diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index 4597a9a716..a3c82737c8 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -111,7 +111,9 @@ void LayerTest::backCallback(Ref* sender) s->release(); } +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) //#pragma mark - Cascading support extensions +#endif static void setEnableRecursiveCascading(Node* node, bool enable) { diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 05e2fc128a..ceaa76a937 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -80,7 +80,9 @@ static std::function createFunctions[] = CL(TextureJPEG), CL(TextureTIFF), CL(TextureTGA), +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_INRT) CL(TextureWEBP), +#endif CL(TexturePixelFormat), CL(TextureBlend), CL(TextureAsync), diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 3c391c6b3e..e6213f337e 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -12,7 +12,7 @@ #include "testResource.h" #include "tests.h" -#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) #include #include #else @@ -42,7 +42,13 @@ Controller g_aTestNames[] = { { "Chipmunk", []() { return new ChipmunkAccelTouchTestScene(); } }, { "Click and Move", [](){return new ClickAndMoveTestScene(); } }, { "Configuration", []() { return new ConfigurationTestScene(); } }, +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) { "Console", []() { return new ConsoleTestScene(); } }, +#endif +#endif +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) #if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN) #if (CC_TARGET_PLATFORM != CC_PLATFORM_NACL) #if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) @@ -51,6 +57,8 @@ Controller g_aTestNames[] = { #endif #endif #endif +#endif +#endif #endif { "Current Language", []() { return new CurrentLanguageTestScene(); } }, { "EventDispatcher", []() { return new EventDispatcherTestScene(); } }, @@ -180,6 +188,11 @@ void TestController::menuCallback(Ref * sender) void TestController::closeCallback(Ref * sender) { +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) + MessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert"); + return; +#endif + Director::getInstance()->end(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) exit(0); @@ -241,6 +254,7 @@ void TestController::onMouseScroll(Event *event) s_tCurPos = nextPos; } +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) void TestController::addConsoleAutoTest() { auto console = Director::getInstance()->getConsole(); @@ -435,4 +449,5 @@ void TestController::addConsoleAutoTest() }; console->addCommand(autotest); } +#endif