Merge pull request #5924 from MSOpenTech/wp8-3.0-cocos2d-changes

Windows Phone 8,0 cocos2d-x 3.0  changes
This commit is contained in:
minggo 2014-03-26 13:58:46 +08:00
commit a374241f65
48 changed files with 488 additions and 37 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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;

View File

@ -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);
@ -448,6 +460,14 @@ 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);

View File

@ -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,8 +482,10 @@ 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;

View File

@ -185,6 +185,8 @@ void FontAtlas::listenToForeground(EventCustom *event)
auto contentSize = Size(CacheTextureWidth,CacheTextureHeight);
auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8;
// 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 );
}
}
@ -258,6 +260,8 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
_currentPageOrigX = 0;
if(_currentPageOrigY + _commonLineHeight >= CacheTextureHeight)
{
// 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);
@ -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;

View File

@ -26,15 +26,29 @@
#ifndef _FontFreetype_h_
#define _FontFreetype_h_
#include "CCFont.h"
#include "CCData.h"
#include <string>
#include <ft2build.h>
#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

View File

@ -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,6 +142,7 @@ 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;
}
}
@ -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)
@ -302,6 +354,13 @@ bool GLProgram::link()
}
#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);
}

View File

@ -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;

View File

@ -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()

View File

@ -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

View File

@ -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<MenuItem*>& arrayOfItems)
{

View File

@ -61,8 +61,26 @@ 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<MenuItem*>& arrayOfItems);
@ -136,6 +154,9 @@ CC_CONSTRUCTOR_ACCESS:
bool initWithArray(const Vector<MenuItem*>& arrayOfItems);
protected:
/** whether or not the menu will receive events */
bool _enabled;

View File

@ -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.

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -52,7 +52,9 @@ public:
OS_BLACKBERRY,
OS_NACL,
OS_EMSCRIPTEN,
OS_TIZEN
OS_TIZEN,
OS_WINRT,
OS_WP8
};
/**

View File

@ -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"
@ -1833,6 +1835,10 @@ bool Image::initWithPVRData(const unsigned char * data, ssize_t dataLen)
bool Image::initWithWebpData(const unsigned char * data, ssize_t dataLen)
{
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;

View File

@ -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

View File

@ -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__) */

View File

@ -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
//////////////////////////////////////////////////////////////////////////

View File

@ -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

View File

@ -129,6 +129,11 @@ public:
MULTIPLY_RESOLUTION,
};
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#ifdef ABSOLUTE
#undef ABSOLUTE
#endif
#endif
enum class SizeType
{
ABSOLUTE,

View File

@ -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);

View File

@ -30,9 +30,12 @@
#include <string>
#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: \

View File

@ -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)
{

View File

@ -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));
}

View File

@ -30,7 +30,7 @@
#include <vector>
#include <thread>
#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 <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

View File

@ -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()
{

View File

@ -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;
}

View File

@ -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<Touch*>& 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<Touch*>& 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

View File

@ -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)

View File

@ -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);
};

View File

@ -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()
{

View File

@ -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()
{

View File

@ -337,7 +337,7 @@ 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) );

View File

@ -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

View File

@ -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()
{

View File

@ -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)
{

View File

@ -80,7 +80,9 @@ static std::function<Layer*()> 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),

View File

@ -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 <unistd.h>
#include <sys/socket.h>
#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