mirror of https://github.com/axmolengine/axmol.git
merge commit 928a28e37d3469fcd41aff14cb136b1415f2fc86
This commit is contained in:
parent
40ec8a3b3d
commit
355e27dada
|
@ -66,7 +66,7 @@ using namespace cocos2d;
|
||||||
unsigned int g_uNumberOfDraws = 0;
|
unsigned int g_uNumberOfDraws = 0;
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
// XXX it shoul be a Director ivar. Move it there once support for multiple directors is added
|
// XXX it shoul be a Director ivar. Move it there once support for multiple directors is added
|
||||||
|
|
||||||
// singleton stuff
|
// singleton stuff
|
||||||
static CCDisplayLinkDirector s_sharedDirector;
|
static CCDisplayLinkDirector s_sharedDirector;
|
||||||
|
|
|
@ -504,9 +504,10 @@ void CCRepeatForever::step(ccTime dt)
|
||||||
m_pInnerAction->step(dt);
|
m_pInnerAction->step(dt);
|
||||||
if (m_pInnerAction->isDone())
|
if (m_pInnerAction->isDone())
|
||||||
{
|
{
|
||||||
ccTime diff = dt + m_pInnerAction->getDuration() - m_pInnerAction->getElapsed();
|
ccTime diff = m_pInnerAction->getElapsed() - m_pInnerAction->getDuration();
|
||||||
m_pInnerAction->startWithTarget(m_pTarget);
|
m_pInnerAction->startWithTarget(m_pTarget);
|
||||||
// to prevent jerk. issue #390
|
// to prevent jerk. issue #390, 1247
|
||||||
|
m_pInnerAction->step(0.0f);
|
||||||
m_pInnerAction->step(diff);
|
m_pInnerAction->step(diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,11 +126,10 @@ public:
|
||||||
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).
|
Note that RGBA type textures will have their alpha premultiplied - use the blending mode (GL_ONE, GL_ONE_MINUS_SRC_ALPHA).
|
||||||
*/
|
*/
|
||||||
/** Initializes a texture from a UIImage object */
|
/** Initializes a texture from a UIImage object */
|
||||||
#if 0// TODO: (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
|
||||||
bool initWithImage(CCImage * uiImage, ccResolutionType resolution);
|
bool initWithImage(CCImage * uiImage);
|
||||||
#else
|
|
||||||
bool initWithImage(CCImage * uiImage);
|
bool initWithImage(CCImage *uiImage, ccResolutionType resolution);
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extensions to make it easy to create a CCTexture2D object from a string of text.
|
Extensions to make it easy to create a CCTexture2D object from a string of text.
|
||||||
|
@ -247,19 +246,19 @@ private:
|
||||||
/** whether or not the texture has their Alpha premultiplied */
|
/** whether or not the texture has their Alpha premultiplied */
|
||||||
CC_PROPERTY_READONLY(bool, m_bHasPremultipliedAlpha, HasPremultipliedAlpha);
|
CC_PROPERTY_READONLY(bool, m_bHasPremultipliedAlpha, HasPremultipliedAlpha);
|
||||||
|
|
||||||
/** shader program used by drawAtPoint and drawInRect */
|
/** shader program used by drawAtPoint and drawInRect */
|
||||||
CC_PROPERTY(CCGLProgram*, m_pShaderProgram, ShaderProgram);
|
CC_PROPERTY(CCGLProgram*, m_pShaderProgram, ShaderProgram);
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
/** Returns the resolution type of the texture.
|
/** Returns the resolution type of the texture.
|
||||||
Is it a RetinaDisplay texture, an iPad texture or an standard texture ?
|
Is it a RetinaDisplay texture, an iPad texture or an standard texture ?
|
||||||
Only valid on iOS. Not valid on OS X.
|
Only valid on iOS. Not valid on OS X.
|
||||||
|
|
||||||
Should be a readonly property. It is readwrite as a hack.
|
Should be a readonly property. It is readwrite as a hack.
|
||||||
|
|
||||||
@since v1.1
|
@since v1.1
|
||||||
*/
|
*/
|
||||||
CC_SYNTHESIZE(ccResolutionType, m_resolutionType, ResolutionType);
|
CC_SYNTHESIZE(ccResolutionType, m_eResolutionType, ResolutionType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -211,36 +211,6 @@ Only valid for cocos2d-mac. Not supported on cocos2d-ios.
|
||||||
#define CC_TEXTURE_NPOT_SUPPORT 0
|
#define CC_TEXTURE_NPOT_SUPPORT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @def CC_RETINA_DISPLAY_SUPPORT
|
|
||||||
If enabled, cocos2d supports retina display.
|
|
||||||
For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.
|
|
||||||
|
|
||||||
To enable set it to 1. Use 0 to disable it. Enabled by default.
|
|
||||||
|
|
||||||
This value governs only the PNG, GIF, BMP, images.
|
|
||||||
This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.
|
|
||||||
|
|
||||||
@deprecated This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
|
|
||||||
|
|
||||||
@since v0.99.5
|
|
||||||
*/
|
|
||||||
#ifndef CC_RETINA_DISPLAY_SUPPORT
|
|
||||||
#define CC_RETINA_DISPLAY_SUPPORT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @def CC_RETINA_DISPLAY_FILENAME_SUFFIX
|
|
||||||
It's the suffix that will be appended to the files in order to load "retina display" images.
|
|
||||||
|
|
||||||
On an iPhone4 with Retina Display support enabled, the file @"sprite-hd.png" will be loaded instead of @"sprite.png".
|
|
||||||
If the file doesn't exist it will use the non-retina display image.
|
|
||||||
|
|
||||||
Platforms: Only used on Retina Display devices like iPhone 4.
|
|
||||||
|
|
||||||
@since v0.99.5
|
|
||||||
*/
|
|
||||||
#ifndef CC_RETINA_DISPLAY_FILENAME_SUFFIX
|
|
||||||
#define CC_RETINA_DISPLAY_FILENAME_SUFFIX "-hd"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @def CC_USE_LA88_LABELS
|
/** @def CC_USE_LA88_LABELS
|
||||||
If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabelTTF objects.
|
If enabled, it will use LA88 (Luminance Alpha 16-bit textures) for CCLabelTTF objects.
|
||||||
|
@ -312,12 +282,6 @@ To enable set it to a value different than 0. Disabled by default.
|
||||||
#define CC_ENABLE_PROFILERS 0
|
#define CC_ENABLE_PROFILERS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CC_RETINA_DISPLAY_SUPPORT
|
|
||||||
#define CC_IS_RETINA_DISPLAY_SUPPORTED 1
|
|
||||||
#else
|
|
||||||
#define CC_IS_RETINA_DISPLAY_SUPPORTED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Enable Lua engine debug log */
|
/** Enable Lua engine debug log */
|
||||||
#ifndef CC_LUA_ENGINE_DEBUG
|
#ifndef CC_LUA_ENGINE_DEBUG
|
||||||
#define CC_LUA_ENGINE_DEBUG 0
|
#define CC_LUA_ENGINE_DEBUG 0
|
||||||
|
|
|
@ -1,337 +1,361 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Copyright (c) 2010-2011 cocos2d-x.org
|
Copyright (c) 2010-2011 cocos2d-x.org
|
||||||
Copyright (c) 2008-2010 Ricardo Quesada
|
Copyright (c) 2008-2010 Ricardo Quesada
|
||||||
Copyright (c) 2011 Zynga Inc.
|
Copyright (c) 2011 Zynga Inc.
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __CCTYPES_H__
|
#ifndef __CCTYPES_H__
|
||||||
#define __CCTYPES_H__
|
#define __CCTYPES_H__
|
||||||
|
|
||||||
#include "CCGeometry.h"
|
#include "CCGeometry.h"
|
||||||
|
|
||||||
#include "CCGL.h"
|
#include "CCGL.h"
|
||||||
|
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
||||||
/** RGB color composed of bytes 3 bytes
|
/** RGB color composed of bytes 3 bytes
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccColor3B
|
typedef struct _ccColor3B
|
||||||
{
|
{
|
||||||
GLubyte r;
|
GLubyte r;
|
||||||
GLubyte g;
|
GLubyte g;
|
||||||
GLubyte b;
|
GLubyte b;
|
||||||
} ccColor3B;
|
} ccColor3B;
|
||||||
|
|
||||||
//! helper macro that creates an ccColor3B type
|
//! helper macro that creates an ccColor3B type
|
||||||
static inline ccColor3B
|
static inline ccColor3B
|
||||||
ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
|
ccc3(const GLubyte r, const GLubyte g, const GLubyte b)
|
||||||
{
|
{
|
||||||
ccColor3B c = {r, g, b};
|
ccColor3B c = {r, g, b};
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
//ccColor3B predefined colors
|
//ccColor3B predefined colors
|
||||||
//! White color (255,255,255)
|
//! White color (255,255,255)
|
||||||
static const ccColor3B ccWHITE={255,255,255};
|
static const ccColor3B ccWHITE={255,255,255};
|
||||||
//! Yellow color (255,255,0)
|
//! Yellow color (255,255,0)
|
||||||
static const ccColor3B ccYELLOW={255,255,0};
|
static const ccColor3B ccYELLOW={255,255,0};
|
||||||
//! Blue color (0,0,255)
|
//! Blue color (0,0,255)
|
||||||
static const ccColor3B ccBLUE={0,0,255};
|
static const ccColor3B ccBLUE={0,0,255};
|
||||||
//! Green Color (0,255,0)
|
//! Green Color (0,255,0)
|
||||||
static const ccColor3B ccGREEN={0,255,0};
|
static const ccColor3B ccGREEN={0,255,0};
|
||||||
//! Red Color (255,0,0,)
|
//! Red Color (255,0,0,)
|
||||||
static const ccColor3B ccRED={255,0,0};
|
static const ccColor3B ccRED={255,0,0};
|
||||||
//! Magenta Color (255,0,255)
|
//! Magenta Color (255,0,255)
|
||||||
static const ccColor3B ccMAGENTA={255,0,255};
|
static const ccColor3B ccMAGENTA={255,0,255};
|
||||||
//! Black Color (0,0,0)
|
//! Black Color (0,0,0)
|
||||||
static const ccColor3B ccBLACK={0,0,0};
|
static const ccColor3B ccBLACK={0,0,0};
|
||||||
//! Orange Color (255,127,0)
|
//! Orange Color (255,127,0)
|
||||||
static const ccColor3B ccORANGE={255,127,0};
|
static const ccColor3B ccORANGE={255,127,0};
|
||||||
//! Gray Color (166,166,166)
|
//! Gray Color (166,166,166)
|
||||||
static const ccColor3B ccGRAY={166,166,166};
|
static const ccColor3B ccGRAY={166,166,166};
|
||||||
|
|
||||||
/** RGBA color composed of 4 bytes
|
/** RGBA color composed of 4 bytes
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccColor4B
|
typedef struct _ccColor4B
|
||||||
{
|
{
|
||||||
GLubyte r;
|
GLubyte r;
|
||||||
GLubyte g;
|
GLubyte g;
|
||||||
GLubyte b;
|
GLubyte b;
|
||||||
GLubyte a;
|
GLubyte a;
|
||||||
} ccColor4B;
|
} ccColor4B;
|
||||||
//! helper macro that creates an ccColor4B type
|
//! helper macro that creates an ccColor4B type
|
||||||
static inline ccColor4B
|
static inline ccColor4B
|
||||||
ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
|
ccc4(const GLubyte r, const GLubyte g, const GLubyte b, const GLubyte o)
|
||||||
{
|
{
|
||||||
ccColor4B c = {r, g, b, o};
|
ccColor4B c = {r, g, b, o};
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** RGBA color composed of 4 floats
|
/** RGBA color composed of 4 floats
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
typedef struct _ccColor4F {
|
typedef struct _ccColor4F {
|
||||||
GLfloat r;
|
GLfloat r;
|
||||||
GLfloat g;
|
GLfloat g;
|
||||||
GLfloat b;
|
GLfloat b;
|
||||||
GLfloat a;
|
GLfloat a;
|
||||||
} ccColor4F;
|
} ccColor4F;
|
||||||
|
|
||||||
static inline ccColor4F
|
|
||||||
ccc4f(const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a)
|
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
|
||||||
{
|
@since v0.99.1
|
||||||
ccColor4F c = {r, g, b, a};
|
*/
|
||||||
return c;
|
static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
|
||||||
}
|
{
|
||||||
|
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, 1.f};
|
||||||
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
|
return c4;
|
||||||
@since v0.99.1
|
}
|
||||||
*/
|
|
||||||
static inline ccColor4F ccc4FFromccc3B(ccColor3B c)
|
//! helper that creates a ccColor4f type
|
||||||
{
|
static inline ccColor4F
|
||||||
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, 1.f};
|
ccc4f(const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a)
|
||||||
return c4;
|
{
|
||||||
}
|
return (ccColor4F){r, g, b, a};
|
||||||
|
}
|
||||||
/** Returns a ccColor4F from a ccColor4B.
|
|
||||||
@since v0.99.1
|
/** Returns a ccColor4F from a ccColor4B.
|
||||||
*/
|
@since v0.99.1
|
||||||
static inline ccColor4F ccc4FFromccc4B(ccColor4B c)
|
*/
|
||||||
{
|
static inline ccColor4F ccc4FFromccc4B(ccColor4B c)
|
||||||
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f};
|
{
|
||||||
return c4;
|
ccColor4F c4 = {c.r/255.f, c.g/255.f, c.b/255.f, c.a/255.f};
|
||||||
}
|
return c4;
|
||||||
|
}
|
||||||
/** returns YES if both ccColor4F are equal. Otherwise it returns NO.
|
|
||||||
@since v0.99.1
|
/** returns YES if both ccColor4F are equal. Otherwise it returns NO.
|
||||||
*/
|
@since v0.99.1
|
||||||
static inline bool ccc4FEqual(ccColor4F a, ccColor4F b)
|
*/
|
||||||
{
|
static inline bool ccc4FEqual(ccColor4F a, ccColor4F b)
|
||||||
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
|
{
|
||||||
}
|
return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
|
||||||
|
}
|
||||||
/** A vertex composed of 2 floats: x, y
|
|
||||||
@since v0.8
|
/** A vertex composed of 2 floats: x, y
|
||||||
*/
|
@since v0.8
|
||||||
typedef struct _ccVertex2F
|
*/
|
||||||
{
|
typedef struct _ccVertex2F
|
||||||
GLfloat x;
|
{
|
||||||
GLfloat y;
|
GLfloat x;
|
||||||
} ccVertex2F;
|
GLfloat y;
|
||||||
|
} ccVertex2F;
|
||||||
static inline ccVertex2F vertex2(const float x, const float y)
|
|
||||||
{
|
static inline ccVertex2F vertex2(const float x, const float y)
|
||||||
ccVertex2F c = {x, y};
|
{
|
||||||
return c;
|
ccVertex2F c = {x, y};
|
||||||
}
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
/** A vertex composed of 2 floats: x, y
|
|
||||||
@since v0.8
|
/** A vertex composed of 2 floats: x, y
|
||||||
*/
|
@since v0.8
|
||||||
typedef struct _ccVertex3F
|
*/
|
||||||
{
|
typedef struct _ccVertex3F
|
||||||
GLfloat x;
|
{
|
||||||
GLfloat y;
|
GLfloat x;
|
||||||
GLfloat z;
|
GLfloat y;
|
||||||
} ccVertex3F;
|
GLfloat z;
|
||||||
|
} ccVertex3F;
|
||||||
static inline ccVertex3F vertex3(const float x, const float y, const float z)
|
|
||||||
{
|
static inline ccVertex3F vertex3(const float x, const float y, const float z)
|
||||||
ccVertex3F c = {x, y, z};
|
{
|
||||||
return c;
|
ccVertex3F c = {x, y, z};
|
||||||
}
|
return c;
|
||||||
|
}
|
||||||
/** A texcoord composed of 2 floats: u, y
|
|
||||||
@since v0.8
|
/** A texcoord composed of 2 floats: u, y
|
||||||
*/
|
@since v0.8
|
||||||
typedef struct _ccTex2F {
|
*/
|
||||||
GLfloat u;
|
typedef struct _ccTex2F {
|
||||||
GLfloat v;
|
GLfloat u;
|
||||||
} ccTex2F;
|
GLfloat v;
|
||||||
|
} ccTex2F;
|
||||||
static inline ccTex2F tex2(const float u, const float v)
|
|
||||||
{
|
static inline ccTex2F tex2(const float u, const float v)
|
||||||
ccTex2F t = {u , v};
|
{
|
||||||
return t;
|
ccTex2F t = {u , v};
|
||||||
}
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
//! Point Sprite component
|
|
||||||
typedef struct _ccPointSprite
|
//! Point Sprite component
|
||||||
{
|
typedef struct _ccPointSprite
|
||||||
ccVertex2F pos; // 8 bytes
|
{
|
||||||
ccColor4B color; // 4 bytes
|
ccVertex2F pos; // 8 bytes
|
||||||
GLfloat size; // 4 bytes
|
ccColor4B color; // 4 bytes
|
||||||
} ccPointSprite;
|
GLfloat size; // 4 bytes
|
||||||
|
} ccPointSprite;
|
||||||
//! A 2D Quad. 4 * 2 floats
|
|
||||||
typedef struct _ccQuad2 {
|
//! A 2D Quad. 4 * 2 floats
|
||||||
ccVertex2F tl;
|
typedef struct _ccQuad2 {
|
||||||
ccVertex2F tr;
|
ccVertex2F tl;
|
||||||
ccVertex2F bl;
|
ccVertex2F tr;
|
||||||
ccVertex2F br;
|
ccVertex2F bl;
|
||||||
} ccQuad2;
|
ccVertex2F br;
|
||||||
|
} ccQuad2;
|
||||||
|
|
||||||
//! A 3D Quad. 4 * 3 floats
|
|
||||||
typedef struct _ccQuad3 {
|
//! A 3D Quad. 4 * 3 floats
|
||||||
ccVertex3F bl;
|
typedef struct _ccQuad3 {
|
||||||
ccVertex3F br;
|
ccVertex3F bl;
|
||||||
ccVertex3F tl;
|
ccVertex3F br;
|
||||||
ccVertex3F tr;
|
ccVertex3F tl;
|
||||||
} ccQuad3;
|
ccVertex3F tr;
|
||||||
|
} ccQuad3;
|
||||||
//! A 2D grid size
|
|
||||||
typedef struct _ccGridSize
|
//! A 2D grid size
|
||||||
{
|
typedef struct _ccGridSize
|
||||||
int x;
|
{
|
||||||
int y;
|
int x;
|
||||||
} ccGridSize;
|
int y;
|
||||||
|
} ccGridSize;
|
||||||
//! helper function to create a ccGridSize
|
|
||||||
static inline ccGridSize
|
//! helper function to create a ccGridSize
|
||||||
ccg(const int x, const int y)
|
static inline ccGridSize
|
||||||
{
|
ccg(const int x, const int y)
|
||||||
ccGridSize v = {x, y};
|
{
|
||||||
return v;
|
ccGridSize v = {x, y};
|
||||||
}
|
return v;
|
||||||
|
}
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4B
|
|
||||||
typedef struct _ccV2F_C4B_T2F
|
//! a Point with a vertex point, a tex coord point and a color 4B
|
||||||
{
|
typedef struct _ccV2F_C4B_T2F
|
||||||
//! vertices (2F)
|
{
|
||||||
ccVertex2F vertices;
|
//! vertices (2F)
|
||||||
//! colors (4B)
|
ccVertex2F vertices;
|
||||||
ccColor4B colors;
|
//! colors (4B)
|
||||||
//! tex coords (2F)
|
ccColor4B colors;
|
||||||
ccTex2F texCoords;
|
//! tex coords (2F)
|
||||||
} ccV2F_C4B_T2F;
|
ccTex2F texCoords;
|
||||||
|
} ccV2F_C4B_T2F;
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4F
|
|
||||||
typedef struct _ccV2F_C4F_T2F
|
//! a Point with a vertex point, a tex coord point and a color 4F
|
||||||
{
|
typedef struct _ccV2F_C4F_T2F
|
||||||
//! vertices (2F)
|
{
|
||||||
ccVertex2F vertices;
|
//! vertices (2F)
|
||||||
//! colors (4F)
|
ccVertex2F vertices;
|
||||||
ccColor4F colors;
|
//! colors (4F)
|
||||||
//! tex coords (2F)
|
ccColor4F colors;
|
||||||
ccTex2F texCoords;
|
//! tex coords (2F)
|
||||||
} ccV2F_C4F_T2F;
|
ccTex2F texCoords;
|
||||||
|
} ccV2F_C4F_T2F;
|
||||||
//! a Point with a vertex point, a tex coord point and a color 4B
|
|
||||||
typedef struct _ccV3F_C4B_T2F
|
//! a Point with a vertex point, a tex coord point and a color 4B
|
||||||
{
|
typedef struct _ccV3F_C4B_T2F
|
||||||
//! vertices (3F)
|
{
|
||||||
ccVertex3F vertices; // 12 bytes
|
//! vertices (3F)
|
||||||
// char __padding__[4];
|
ccVertex3F vertices; // 12 bytes
|
||||||
|
// char __padding__[4];
|
||||||
//! colors (4B)
|
|
||||||
ccColor4B colors; // 4 bytes
|
//! colors (4B)
|
||||||
// char __padding2__[4];
|
ccColor4B colors; // 4 bytes
|
||||||
|
// char __padding2__[4];
|
||||||
// tex coords (2F)
|
|
||||||
ccTex2F texCoords; // 8 byts
|
// tex coords (2F)
|
||||||
} ccV3F_C4B_T2F;
|
ccTex2F texCoords; // 8 byts
|
||||||
|
} ccV3F_C4B_T2F;
|
||||||
//! 4 ccVertex2FTex2FColor4B Quad
|
|
||||||
typedef struct _ccV2F_C4B_T2F_Quad
|
//! 4 ccVertex2FTex2FColor4B Quad
|
||||||
{
|
typedef struct _ccV2F_C4B_T2F_Quad
|
||||||
//! bottom left
|
{
|
||||||
ccV2F_C4B_T2F bl;
|
//! bottom left
|
||||||
//! bottom right
|
ccV2F_C4B_T2F bl;
|
||||||
ccV2F_C4B_T2F br;
|
//! bottom right
|
||||||
//! top left
|
ccV2F_C4B_T2F br;
|
||||||
ccV2F_C4B_T2F tl;
|
//! top left
|
||||||
//! top right
|
ccV2F_C4B_T2F tl;
|
||||||
ccV2F_C4B_T2F tr;
|
//! top right
|
||||||
} ccV2F_C4B_T2F_Quad;
|
ccV2F_C4B_T2F tr;
|
||||||
|
} ccV2F_C4B_T2F_Quad;
|
||||||
//! 4 ccVertex3FTex2FColor4B
|
|
||||||
typedef struct _ccV3F_C4B_T2F_Quad
|
//! 4 ccVertex3FTex2FColor4B
|
||||||
{
|
typedef struct _ccV3F_C4B_T2F_Quad
|
||||||
//! top left
|
{
|
||||||
ccV3F_C4B_T2F tl;
|
//! top left
|
||||||
//! bottom left
|
ccV3F_C4B_T2F tl;
|
||||||
ccV3F_C4B_T2F bl;
|
//! bottom left
|
||||||
//! top right
|
ccV3F_C4B_T2F bl;
|
||||||
ccV3F_C4B_T2F tr;
|
//! top right
|
||||||
//! bottom right
|
ccV3F_C4B_T2F tr;
|
||||||
ccV3F_C4B_T2F br;
|
//! bottom right
|
||||||
} ccV3F_C4B_T2F_Quad;
|
ccV3F_C4B_T2F br;
|
||||||
|
} ccV3F_C4B_T2F_Quad;
|
||||||
//! 4 ccVertex2FTex2FColor4F Quad
|
|
||||||
typedef struct _ccV2F_C4F_T2F_Quad
|
//! 4 ccVertex2FTex2FColor4F Quad
|
||||||
{
|
typedef struct _ccV2F_C4F_T2F_Quad
|
||||||
//! bottom left
|
{
|
||||||
ccV2F_C4F_T2F bl;
|
//! bottom left
|
||||||
//! bottom right
|
ccV2F_C4F_T2F bl;
|
||||||
ccV2F_C4F_T2F br;
|
//! bottom right
|
||||||
//! top left
|
ccV2F_C4F_T2F br;
|
||||||
ccV2F_C4F_T2F tl;
|
//! top left
|
||||||
//! top right
|
ccV2F_C4F_T2F tl;
|
||||||
ccV2F_C4F_T2F tr;
|
//! top right
|
||||||
} ccV2F_C4F_T2F_Quad;
|
ccV2F_C4F_T2F tr;
|
||||||
|
} ccV2F_C4F_T2F_Quad;
|
||||||
//! Blend Function used for textures
|
|
||||||
typedef struct _ccBlendFunc
|
//! Blend Function used for textures
|
||||||
{
|
typedef struct _ccBlendFunc
|
||||||
//! source blend function
|
{
|
||||||
GLenum src;
|
//! source blend function
|
||||||
//! destination blend function
|
GLenum src;
|
||||||
GLenum dst;
|
//! destination blend function
|
||||||
} ccBlendFunc;
|
GLenum dst;
|
||||||
|
} ccBlendFunc;
|
||||||
|
|
||||||
//! ccResolutionType
|
//! ccResolutionType
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
//! Unknonw resolution type
|
//! Unknonw resolution type
|
||||||
kCCResolutionUnknown,
|
kCCResolutionUnknown,
|
||||||
//! iPhone resolution type
|
//! iPhone resolution type
|
||||||
kCCResolutioniPhone,
|
kCCResolutioniPhone,
|
||||||
//! RetinaDisplay resolution type
|
//! RetinaDisplay resolution type
|
||||||
kCCResolutioniPhoneRetinaDisplay,
|
kCCResolutioniPhoneRetinaDisplay,
|
||||||
//! iPad resolution type
|
//! iPad resolution type
|
||||||
kCCResolutioniPad,
|
kCCResolutioniPad,
|
||||||
//! iPad Retina Display resolution type
|
//! iPad Retina Display resolution type
|
||||||
kCCResolutioniPadRetinaDisplay,
|
kCCResolutioniPadRetinaDisplay,
|
||||||
|
|
||||||
|
} ccResolutionType;
|
||||||
|
|
||||||
} ccResolutionType;
|
//! delta time type
|
||||||
|
//! if you want more resolution redefine it as a double
|
||||||
//! delta time type
|
typedef float ccTime;
|
||||||
//! if you want more resolution redefine it as a double
|
//typedef double ccTime;
|
||||||
typedef float ccTime;
|
|
||||||
//typedef double ccTime;
|
typedef enum
|
||||||
|
{
|
||||||
typedef enum
|
CCTextAlignmentLeft,
|
||||||
{
|
CCTextAlignmentCenter,
|
||||||
CCTextAlignmentLeft,
|
CCTextAlignmentRight,
|
||||||
CCTextAlignmentCenter,
|
} CCTextAlignment;
|
||||||
CCTextAlignmentRight,
|
|
||||||
} CCTextAlignment;
|
// types for animation in particle systems
|
||||||
|
|
||||||
}//namespace cocos2d
|
// texture coordinates for a quad
|
||||||
|
typedef struct _ccT2F_Quad
|
||||||
#endif //__CCTYPES_H__
|
{
|
||||||
|
//! bottom left
|
||||||
|
ccTex2F bl;
|
||||||
|
//! bottom right
|
||||||
|
ccTex2F br;
|
||||||
|
//! top left
|
||||||
|
ccTex2F tl;
|
||||||
|
//! top right
|
||||||
|
ccTex2F tr;
|
||||||
|
} ccT2F_Quad;
|
||||||
|
|
||||||
|
// struct that holds the size in pixels, texture coordinates and delays for animated CCParticleSystemQuad
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ccT2F_Quad texCoords;
|
||||||
|
ccTime delay;
|
||||||
|
CCSize size;
|
||||||
|
} ccAnimationFrameData;
|
||||||
|
|
||||||
|
}//namespace cocos2d
|
||||||
|
|
||||||
|
#endif //__CCTYPES_H__
|
||||||
|
|
|
@ -32,11 +32,11 @@ THE SOFTWARE.
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "CCPointExtension.h"
|
#include "CCPointExtension.h"
|
||||||
#include "CCScriptSupport.h"
|
#include "CCScriptSupport.h"
|
||||||
#include "CCShaderCache.h"
|
#include "CCShaderCache.h"
|
||||||
#include "CCGLProgram.h"
|
#include "CCGLProgram.h"
|
||||||
#include "ccGLStateCache.h"
|
#include "ccGLStateCache.h"
|
||||||
#include "support/TransformUtils.h"
|
#include "support/TransformUtils.h"
|
||||||
// extern
|
// extern
|
||||||
#include "kazmath/GL/matrix.h"
|
#include "kazmath/GL/matrix.h"
|
||||||
|
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
@ -453,26 +453,26 @@ bool CCLayerColor::init()
|
||||||
|
|
||||||
bool CCLayerColor::initWithColor(const ccColor4B& color, GLfloat w, GLfloat h)
|
bool CCLayerColor::initWithColor(const ccColor4B& color, GLfloat w, GLfloat h)
|
||||||
{
|
{
|
||||||
if( CCLayer::init() ) {
|
if( CCLayer::init() ) {
|
||||||
|
|
||||||
// default blend function
|
// default blend function
|
||||||
m_tBlendFunc.src = GL_SRC_ALPHA;
|
m_tBlendFunc.src = GL_SRC_ALPHA;
|
||||||
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
m_tBlendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
|
||||||
m_tColor.r = color.r;
|
m_tColor.r = color.r;
|
||||||
m_tColor.g = color.g;
|
m_tColor.g = color.g;
|
||||||
m_tColor.b = color.b;
|
m_tColor.b = color.b;
|
||||||
m_cOpacity = color.a;
|
m_cOpacity = color.a;
|
||||||
|
|
||||||
for (int i = 0; i<sizeof(m_pSquareVertices) / sizeof( m_pSquareVertices[0]); i++ ) {
|
for (int i = 0; i<sizeof(m_pSquareVertices) / sizeof( m_pSquareVertices[0]); i++ ) {
|
||||||
m_pSquareVertices[i].x = 0.0f;
|
m_pSquareVertices[i].x = 0.0f;
|
||||||
m_pSquareVertices[i].y = 0.0f;
|
m_pSquareVertices[i].y = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateColor();
|
updateColor();
|
||||||
setContentSize(CCSizeMake(w, h));
|
setContentSize(CCSizeMake(w, h));
|
||||||
|
|
||||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionColor));
|
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionColor));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -523,18 +523,18 @@ void CCLayerColor::updateColor()
|
||||||
|
|
||||||
void CCLayerColor::draw()
|
void CCLayerColor::draw()
|
||||||
{
|
{
|
||||||
CC_NODE_DRAW_SETUP();
|
CC_NODE_DRAW_SETUP();
|
||||||
|
|
||||||
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );
|
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_Color );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attributes
|
// Attributes
|
||||||
//
|
//
|
||||||
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pSquareVertices);
|
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pSquareVertices);
|
||||||
glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, m_pSquareColors);
|
glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_FALSE, 0, m_pSquareColors);
|
||||||
|
|
||||||
ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
|
ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWS(1);
|
CC_INCREMENT_GL_DRAWS(1);
|
||||||
|
|
|
@ -38,6 +38,10 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_CC_BEGIN;
|
NS_CC_BEGIN;
|
||||||
|
|
||||||
|
static const char *__suffixiPhoneRetinaDisplay = "-hd";
|
||||||
|
static const char *__suffixiPad = "-ipad";
|
||||||
|
static const char *__suffixiPadRetinaDisplay = "-ipadhd";
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SAX_NONE = 0,
|
SAX_NONE = 0,
|
||||||
|
@ -266,25 +270,24 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string& CCFileUtils::ccRemoveHDSuffixFromFile(std::string& path)
|
std::string& CCFileUtils::removeSuffixFromFile(std::string& path)
|
||||||
{
|
{
|
||||||
#if CC_IS_RETINA_DISPLAY_SUPPORTED
|
// XXX win32 now can only support iphone retina, because
|
||||||
|
// we don't know it is ipad retina or iphone retina.
|
||||||
|
// fixe me later
|
||||||
if( CC_CONTENT_SCALE_FACTOR() == 2 )
|
if( CC_CONTENT_SCALE_FACTOR() == 2 )
|
||||||
{
|
{
|
||||||
std::string::size_type pos = path.rfind("/") + 1; // the begin index of last part of path
|
std::string::size_type pos = path.rfind("/") + 1; // the begin index of last part of path
|
||||||
|
|
||||||
std::string::size_type suffixPos = path.rfind(CC_RETINA_DISPLAY_FILENAME_SUFFIX);
|
std::string::size_type suffixPos = path.rfind(__suffixiPhoneRetinaDisplay);
|
||||||
if (std::string::npos != suffixPos && suffixPos > pos)
|
if (std::string::npos != suffixPos && suffixPos > pos)
|
||||||
{
|
{
|
||||||
CCLog("cocos2d: FilePath(%s) contains suffix(%s), remove it.", path.c_str(),
|
CCLog("cocos2d: FilePath(%s) contains suffix(%s), remove it.", path.c_str(),
|
||||||
CC_RETINA_DISPLAY_FILENAME_SUFFIX);
|
__suffixiPhoneRetinaDisplay);
|
||||||
path.replace(suffixPos, strlen(CC_RETINA_DISPLAY_FILENAME_SUFFIX), "");
|
path.replace(suffixPos, strlen(__suffixiPhoneRetinaDisplay), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED
|
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,6 +347,47 @@ unsigned char* CCFileUtils::getFileDataFromZip(const char* pszZipFilePath, const
|
||||||
return pBuffer;
|
return pBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// functions iOS specific
|
||||||
|
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPhoneRetinaDisplaySuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPadSuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPadRetinaDisplaySuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPadFileExistsAtPath(const char *filename)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPadRetinaDisplayFileExistsAtPath(const char *filename)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath(const char *filename)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Notification support when getFileData from invalid file path.
|
// Notification support when getFileData from invalid file path.
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -53,11 +53,15 @@ public:
|
||||||
*/
|
*/
|
||||||
static unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize);
|
static unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize);
|
||||||
|
|
||||||
/** removes the HD suffix from a path
|
/** removes the suffix from a path
|
||||||
@returns const char * without the HD suffix
|
* On RetinaDisplay it will remove the -hd suffix
|
||||||
@since v0.99.5
|
* On iPad it will remove the -ipad suffix
|
||||||
*/
|
* On iPhone it will remove the (empty) suffix
|
||||||
static std::string& ccRemoveHDSuffixFromFile(std::string& path);
|
Only valid on iOS. Not valid for OS X.
|
||||||
|
|
||||||
|
@since v0.99.5
|
||||||
|
*/
|
||||||
|
static std::string& removeSuffixFromFile(std::string& path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Generate the absolute path of the file.
|
@brief Generate the absolute path of the file.
|
||||||
|
@ -69,10 +73,68 @@ public:
|
||||||
*/
|
*/
|
||||||
static const char* fullPathFromRelativePath(const char *pszRelativePath);
|
static const char* fullPathFromRelativePath(const char *pszRelativePath);
|
||||||
|
|
||||||
|
/** Returns the fullpath of an filename including the resolution of the image.
|
||||||
|
|
||||||
|
If in RetinaDisplay mode, and a RetinaDisplay file is found, it will return that path.
|
||||||
|
If in iPad mode, and an iPad file is found, it will return that path.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
* In iPad mode: "image.png" -> "/full/path/image-ipad.png" (in case the -ipad file exists)
|
||||||
|
* In RetinaDisplay mode: "image.png" -> "/full/path/image-hd.png" (in case the -hd file exists)
|
||||||
|
|
||||||
|
If an iPad file is found, it will set resolution type to kCCResolutioniPad
|
||||||
|
If a RetinaDisplay file is found, it will set resolution type to kCCResolutionRetinaDisplay
|
||||||
|
|
||||||
|
*/
|
||||||
|
static const char* fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType);
|
||||||
|
|
||||||
/// @cond
|
/// @cond
|
||||||
static const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
|
static const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
|
/** Sets the iPhone RetinaDisplay suffix to load resources.
|
||||||
|
By default it is "-hd".
|
||||||
|
Only valid on iOS. Not valid for OS X.
|
||||||
|
|
||||||
|
@since v1.1
|
||||||
|
*/
|
||||||
|
static void setiPhoneRetinaDisplaySuffix(const char *suffix);
|
||||||
|
|
||||||
|
/** Sets the iPad suffix to load resources.
|
||||||
|
By default it is "".
|
||||||
|
Only valid on iOS. Not valid for OS X.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
static void setiPadSuffix(const char *suffix);
|
||||||
|
|
||||||
|
/** Sets the iPad Retina Display suffix to load resources.
|
||||||
|
By default it is "-ipadhd".
|
||||||
|
Only valid on iOS. Not valid for OS X.
|
||||||
|
|
||||||
|
@since v1.1
|
||||||
|
*/
|
||||||
|
static void setiPadRetinaDisplaySuffix(const char *suffix);
|
||||||
|
|
||||||
|
/** Returns whether or not a given filename exists with the iPad suffix.
|
||||||
|
Only available on iOS. Not supported on OS X.
|
||||||
|
@since v1.1
|
||||||
|
*/
|
||||||
|
bool iPadFileExistsAtPath(const char *filename);
|
||||||
|
|
||||||
|
/** Returns whether or not a given filename exists with the iPad RetinaDisplay suffix.
|
||||||
|
Only available on iOS. Not supported on OS X.
|
||||||
|
|
||||||
|
*/
|
||||||
|
bool iPadRetinaDisplayFileExistsAtPath(const char *filename);
|
||||||
|
|
||||||
|
/** Returns whether or not a given path exists with the iPhone RetinaDisplay suffix.
|
||||||
|
Only available on iOS. Not supported on OS X.
|
||||||
|
@since v1.1
|
||||||
|
*/
|
||||||
|
bool iPhoneRetinaDisplayFileExistsAtPath(const char *filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Set the ResourcePath,we will find resource in this path
|
@brief Set the ResourcePath,we will find resource in this path
|
||||||
@param pszResourcePath The absolute resource path
|
@param pszResourcePath The absolute resource path
|
||||||
|
|
|
@ -61,6 +61,11 @@ void CCEGLView::setFrameWidthAndHeight(int width, int height)
|
||||||
m_sSizeInPixel.height = height;
|
m_sSizeInPixel.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::create(int width, int height)
|
void CCEGLView::create(int width, int height)
|
||||||
{
|
{
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
|
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
/**
|
/**
|
||||||
* the width and height is the real size of phone
|
* the width and height is the real size of phone
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -241,6 +241,11 @@ CCRect CCEGLView::getFrame()
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CCEGLView::isOpenGLReady()
|
bool CCEGLView::isOpenGLReady()
|
||||||
{
|
{
|
||||||
return (NULL != m_pEGL);
|
return (NULL != m_pEGL);
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
CCRect getFrame();
|
CCRect getFrame();
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
void release();
|
void release();
|
||||||
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||||
void swapBuffers();
|
void swapBuffers();
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
bool canSetContentScaleFactor();
|
bool canSetContentScaleFactor();
|
||||||
|
bool isIpad();
|
||||||
void setContentScaleFactor(float contentScaleFactor);
|
void setContentScaleFactor(float contentScaleFactor);
|
||||||
|
|
||||||
// keep compatible
|
// keep compatible
|
||||||
|
|
|
@ -47,6 +47,11 @@ cocos2d::CCSize CCEGLView::getSize()
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
|
||||||
|
}
|
||||||
|
|
||||||
bool CCEGLView::isOpenGLReady()
|
bool CCEGLView::isOpenGLReady()
|
||||||
{
|
{
|
||||||
return [EAGLView sharedEGLView] != NULL;
|
return [EAGLView sharedEGLView] != NULL;
|
||||||
|
|
|
@ -23,6 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIDevice.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
@ -42,104 +43,74 @@ using namespace cocos2d;
|
||||||
static void static_addValueToCCDict(id key, id value, CCDictionary* pDict);
|
static void static_addValueToCCDict(id key, id value, CCDictionary* pDict);
|
||||||
static void static_addItemToCCArray(id item, CCArray* pArray);
|
static void static_addItemToCCArray(id item, CCArray* pArray);
|
||||||
|
|
||||||
static const char *static_ccRemoveHDSuffixFromFile( const char *pszPath)
|
static NSString *__suffixiPhoneRetinaDisplay =@"-hd";
|
||||||
|
static NSString *__suffixiPad =@"-ipad";
|
||||||
|
static NSString *__suffixiPadRetinaDisplay =@"-ipadhd";
|
||||||
|
static NSFileManager *__localFileManager= [[NSFileManager alloc] init];
|
||||||
|
|
||||||
|
static NSString* removeSuffixFromPath(NSString *suffix, NSString *path)
|
||||||
{
|
{
|
||||||
#if CC_IS_RETINA_DISPLAY_SUPPORTED
|
// quick return
|
||||||
|
if( ! suffix || [suffix length] == 0 )
|
||||||
if(cocos2d::CC_CONTENT_SCALE_FACTOR() == 2 ) {
|
|
||||||
NSString *path = [NSString stringWithUTF8String: pszPath];
|
|
||||||
NSString *name = [path lastPathComponent];
|
|
||||||
NSString *suffix = [NSString stringWithUTF8String: CC_RETINA_DISPLAY_FILENAME_SUFFIX];
|
|
||||||
|
|
||||||
// check if path already has the suffix.
|
|
||||||
if( [name rangeOfString: suffix].location != NSNotFound ) {
|
|
||||||
|
|
||||||
CCLOG("cocos2d: Filename(%@) contains %@ suffix. Removing it. See cocos2d issue #1040", path, CC_RETINA_DISPLAY_FILENAME_SUFFIX);
|
|
||||||
|
|
||||||
NSString *newLastname = [name stringByReplacingOccurrencesOfString: suffix withString:@""];
|
|
||||||
|
|
||||||
NSString *pathWithoutLastname = [path stringByDeletingLastPathComponent];
|
|
||||||
return [[pathWithoutLastname stringByAppendingPathComponent:newLastname] UTF8String];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED
|
|
||||||
|
|
||||||
return pszPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSString* getDoubleResolutionImage(NSString* path)
|
|
||||||
{
|
|
||||||
#if CC_IS_RETINA_DISPLAY_SUPPORTED
|
|
||||||
|
|
||||||
if( cocos2d::CC_CONTENT_SCALE_FACTOR() == 2 )
|
|
||||||
{
|
|
||||||
|
|
||||||
NSString *pathWithoutExtension = [path stringByDeletingPathExtension];
|
|
||||||
NSString *name = [pathWithoutExtension lastPathComponent];
|
|
||||||
NSString *suffix = [NSString stringWithUTF8String: CC_RETINA_DISPLAY_FILENAME_SUFFIX];
|
|
||||||
|
|
||||||
// check if path already has the suffix.
|
|
||||||
if( [name rangeOfString: suffix].location != NSNotFound ) {
|
|
||||||
|
|
||||||
CCLOG("cocos2d: WARNING Filename(%@) already has the suffix %@. Using it.", name, CC_RETINA_DISPLAY_FILENAME_SUFFIX);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NSString *extension = [path pathExtension];
|
|
||||||
|
|
||||||
if( [extension isEqualToString:@"ccz"] || [extension isEqualToString:@"gz"] )
|
|
||||||
{
|
|
||||||
// All ccz / gz files should be in the format filename.xxx.ccz
|
|
||||||
// so we need to pull off the .xxx part of the extension as well
|
|
||||||
extension = [NSString stringWithFormat:@"%@.%@", [pathWithoutExtension pathExtension], extension];
|
|
||||||
pathWithoutExtension = [pathWithoutExtension stringByDeletingPathExtension];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NSString *retinaName = [pathWithoutExtension stringByAppendingString: suffix];
|
|
||||||
retinaName = [retinaName stringByAppendingPathExtension:extension];
|
|
||||||
|
|
||||||
NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
|
|
||||||
if( [fileManager fileExistsAtPath:retinaName] )
|
|
||||||
return retinaName;
|
|
||||||
|
|
||||||
CCLOG("cocos2d: CCFileUtils: Warning HD file not found: %@", [retinaName lastPathComponent] );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* static_fullPathFromRelativePath(const char *pszRelativePath)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
// NSAssert(pszRelativePath != nil, @"CCFileUtils: Invalid path");
|
|
||||||
|
|
||||||
// do not convert an absolute path (starting with '/')
|
|
||||||
NSString *relPath = [NSString stringWithUTF8String: pszRelativePath];
|
|
||||||
NSString *fullpath = nil;
|
|
||||||
|
|
||||||
// only if it is not an absolute path
|
|
||||||
if( ! [relPath isAbsolutePath] )
|
|
||||||
{
|
{
|
||||||
NSString *file = [relPath lastPathComponent];
|
return path;
|
||||||
NSString *imageDirectory = [relPath stringByDeletingLastPathComponent];
|
}
|
||||||
|
|
||||||
fullpath = [[NSBundle mainBundle] pathForResource:file
|
NSString *name = [path lastPathComponent];
|
||||||
ofType:nil
|
|
||||||
inDirectory:imageDirectory];
|
// check if path already has the suffix.
|
||||||
|
if( [name rangeOfString:suffix].location != NSNotFound ) {
|
||||||
|
|
||||||
|
CCLOG("cocos2d: Filename(%s) contains %s suffix. Removing it. See cocos2d issue #1040", [path UTF8String], [suffix UTF8String]);
|
||||||
|
|
||||||
|
NSString *newLastname = [name stringByReplacingOccurrencesOfString:suffix withString:@""];
|
||||||
|
|
||||||
|
NSString *pathWithoutLastname = [path stringByDeletingLastPathComponent];
|
||||||
|
return [pathWithoutLastname stringByAppendingPathComponent:newLastname];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullpath == nil)
|
return path;
|
||||||
fullpath = relPath;
|
}
|
||||||
|
|
||||||
fullpath = getDoubleResolutionImage(fullpath);
|
static NSString* getPathForSuffix(NSString *path, NSString *suffix)
|
||||||
|
{
|
||||||
return [fullpath UTF8String];
|
// quick return
|
||||||
|
if( ! suffix || [suffix length] == 0 )
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *pathWithoutExtension = [path stringByDeletingPathExtension];
|
||||||
|
NSString *name = [pathWithoutExtension lastPathComponent];
|
||||||
|
|
||||||
|
// check if path already has the suffix.
|
||||||
|
if( [name rangeOfString:suffix].location != NSNotFound ) {
|
||||||
|
|
||||||
|
CCLOG("cocos2d: WARNING Filename(%s) already has the suffix %s. Using it.", [name UTF8String], [suffix UTF8String]);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NSString *extension = [path pathExtension];
|
||||||
|
|
||||||
|
if( [extension isEqualToString:@"ccz"] || [extension isEqualToString:@"gz"] )
|
||||||
|
{
|
||||||
|
// All ccz / gz files should be in the format filename.xxx.ccz
|
||||||
|
// so we need to pull off the .xxx part of the extension as well
|
||||||
|
extension = [NSString stringWithFormat:@"%@.%@", [pathWithoutExtension pathExtension], extension];
|
||||||
|
pathWithoutExtension = [pathWithoutExtension stringByDeletingPathExtension];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NSString *newName = [pathWithoutExtension stringByAppendingString:suffix];
|
||||||
|
newName = [newName stringByAppendingPathExtension:extension];
|
||||||
|
|
||||||
|
if( [__localFileManager fileExistsAtPath:newName] )
|
||||||
|
return newName;
|
||||||
|
|
||||||
|
CCLOG("cocos2d: CCFileUtils: Warning file not found: %s", [[newName lastPathComponent] UTF8String] );
|
||||||
|
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void static_addItemToCCArray(id item, CCArray *pArray)
|
static void static_addItemToCCArray(id item, CCArray *pArray)
|
||||||
|
@ -274,15 +245,164 @@ namespace cocos2d {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string& CCFileUtils::ccRemoveHDSuffixFromFile(std::string& path )
|
std::string& CCFileUtils::removeSuffixFromFile(std::string& cpath )
|
||||||
{
|
{
|
||||||
path = static_ccRemoveHDSuffixFromFile(path.c_str());
|
NSString *ret = nil;
|
||||||
return path;
|
NSString *path = [NSString stringWithUTF8String:cpath.c_str()];
|
||||||
|
|
||||||
|
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
|
||||||
|
{
|
||||||
|
if( CC_CONTENT_SCALE_FACTOR() == 2 )
|
||||||
|
{
|
||||||
|
ret = removeSuffixFromPath(__suffixiPadRetinaDisplay, path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = removeSuffixFromPath(__suffixiPad, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( CC_CONTENT_SCALE_FACTOR() == 2 )
|
||||||
|
{
|
||||||
|
ret = removeSuffixFromPath(__suffixiPhoneRetinaDisplay, [NSString stringWithUTF8String:cpath.c_str()]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cpath = [ret UTF8String];
|
||||||
|
return cpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPhoneRetinaDisplaySuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
[__suffixiPhoneRetinaDisplay release];
|
||||||
|
__suffixiPhoneRetinaDisplay = [[NSString stringWithUTF8String:suffix] retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPadSuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
[__suffixiPad release];
|
||||||
|
__suffixiPad = [[NSString stringWithUTF8String:suffix] retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCFileUtils::setiPadRetinaDisplaySuffix(const char *suffix)
|
||||||
|
{
|
||||||
|
[__suffixiPadRetinaDisplay release];
|
||||||
|
__suffixiPadRetinaDisplay = [[NSString stringWithUTF8String:suffix] retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool fileExistsAtPath(const char *cpath, const char *csuffix)
|
||||||
|
{
|
||||||
|
NSString *fullpath = nil;
|
||||||
|
NSString *relPath = [NSString stringWithUTF8String:cpath];
|
||||||
|
NSString *suffix = [NSString stringWithUTF8String:csuffix];
|
||||||
|
|
||||||
|
// only if it is not an absolute path
|
||||||
|
if( ! [relPath isAbsolutePath] ) {
|
||||||
|
// pathForResource also searches in .lproj directories. issue #1230
|
||||||
|
NSString *file = [relPath lastPathComponent];
|
||||||
|
NSString *imageDirectory = [relPath stringByDeletingLastPathComponent];
|
||||||
|
|
||||||
|
fullpath = [[NSBundle mainBundle] pathForResource:file
|
||||||
|
ofType:nil
|
||||||
|
inDirectory:imageDirectory];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullpath == nil)
|
||||||
|
fullpath = relPath;
|
||||||
|
|
||||||
|
NSString *path = getPathForSuffix(fullpath, suffix);
|
||||||
|
|
||||||
|
return ( path != nil );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath(const char *cpath)
|
||||||
|
{
|
||||||
|
return fileExistsAtPath(cpath, [__suffixiPhoneRetinaDisplay UTF8String]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPadFileExistsAtPath(const char *cpath)
|
||||||
|
{
|
||||||
|
return fileExistsAtPath(cpath, [__suffixiPad UTF8String]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CCFileUtils::iPadRetinaDisplayFileExistsAtPath(const char *cpath)
|
||||||
|
{
|
||||||
|
return fileExistsAtPath(cpath, [__suffixiPadRetinaDisplay UTF8String]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
|
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
|
||||||
{
|
{
|
||||||
return static_fullPathFromRelativePath(pszRelativePath);
|
ccResolutionType ignore;
|
||||||
|
return fullPathFromRelativePath(pszRelativePath, &ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType)
|
||||||
|
{
|
||||||
|
CCAssert(pszRelativePath != NULL, "CCFileUtils: Invalid path");
|
||||||
|
|
||||||
|
NSString *fullpath = nil;
|
||||||
|
NSString *relPath = [NSString stringWithUTF8String:pszRelativePath];
|
||||||
|
|
||||||
|
// only if it is not an absolute path
|
||||||
|
if( ! [relPath isAbsolutePath] ) {
|
||||||
|
|
||||||
|
// pathForResource also searches in .lproj directories. issue #1230
|
||||||
|
NSString *file = [relPath lastPathComponent];
|
||||||
|
NSString *imageDirectory = [relPath stringByDeletingLastPathComponent];
|
||||||
|
|
||||||
|
fullpath = [[NSBundle mainBundle] pathForResource:file
|
||||||
|
ofType:nil
|
||||||
|
inDirectory:imageDirectory];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fullpath == nil)
|
||||||
|
{
|
||||||
|
fullpath = relPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *ret = nil;
|
||||||
|
|
||||||
|
// iPad?
|
||||||
|
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
|
||||||
|
{
|
||||||
|
// Retina Display ?
|
||||||
|
if( CC_CONTENT_SCALE_FACTOR() == 2 ) {
|
||||||
|
ret = getPathForSuffix(fullpath, __suffixiPadRetinaDisplay);
|
||||||
|
*pResolutionType = kCCResolutioniPadRetinaDisplay;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = getPathForSuffix(fullpath, __suffixiPad);
|
||||||
|
*pResolutionType = kCCResolutioniPad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// iPhone ?
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Retina Display ?
|
||||||
|
if( CC_CONTENT_SCALE_FACTOR() == 2 ) {
|
||||||
|
ret = getPathForSuffix(fullpath, __suffixiPhoneRetinaDisplay);
|
||||||
|
*pResolutionType = kCCResolutioniPhoneRetinaDisplay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it is iPhone Non RetinaDisplay, or if the previous "getPath" failed, then use iPhone images.
|
||||||
|
if( ret == nil )
|
||||||
|
{
|
||||||
|
*pResolutionType = kCCResolutioniPhone;
|
||||||
|
ret = fullpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ret UTF8String];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
|
const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
|
||||||
|
|
|
@ -278,6 +278,11 @@ bool CCEGLView::isOpenGLReady()
|
||||||
return bIsInit;
|
return bIsInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::release()
|
void CCEGLView::release()
|
||||||
{
|
{
|
||||||
/* Exits from GLFW */
|
/* Exits from GLFW */
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
|
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
void release();
|
void release();
|
||||||
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||||
void swapBuffers();
|
void swapBuffers();
|
||||||
|
|
|
@ -265,6 +265,11 @@ bool CCEGLView::isOpenGLReady()
|
||||||
return (IwGLIsInitialised() && m_sSizeInPixel.width != 0 && m_sSizeInPixel.height !=0);
|
return (IwGLIsInitialised() && m_sSizeInPixel.width != 0 && m_sSizeInPixel.height !=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::release()
|
void CCEGLView::release()
|
||||||
{
|
{
|
||||||
IW_CALLSTACK("CCEGLView::release");
|
IW_CALLSTACK("CCEGLView::release");
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
|
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
/**
|
/**
|
||||||
* the width and height is the real size of phone
|
* the width and height is the real size of phone
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -786,6 +786,11 @@ bool CCEGLView::isOpenGLReady()
|
||||||
return (m_isGLInitialized && m_sSizeInPixel.width != 0 && m_sSizeInPixel.height != 0);
|
return (m_isGLInitialized && m_sSizeInPixel.width != 0 && m_sSizeInPixel.height != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::release()
|
void CCEGLView::release()
|
||||||
{
|
{
|
||||||
if (!m_eglContext || !m_eglDisplay)
|
if (!m_eglContext || !m_eglDisplay)
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
|
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
/**
|
/**
|
||||||
* the width and height is the real size of phone
|
* the width and height is the real size of phone
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -419,6 +419,11 @@ bool CCEGLView::isOpenGLReady()
|
||||||
return (NULL != m_pEGL);
|
return (NULL != m_pEGL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCEGLView::isIpad()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void CCEGLView::release()
|
void CCEGLView::release()
|
||||||
{
|
{
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
CCSize getSize();
|
CCSize getSize();
|
||||||
bool isOpenGLReady();
|
bool isOpenGLReady();
|
||||||
|
bool isIpad();
|
||||||
void release();
|
void release();
|
||||||
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||||
void swapBuffers();
|
void swapBuffers();
|
||||||
|
|
|
@ -218,9 +218,7 @@ bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFor
|
||||||
|
|
||||||
m_bHasPremultipliedAlpha = false;
|
m_bHasPremultipliedAlpha = false;
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
m_eResolutionType = kCCResolutionUnknown;
|
||||||
m_resolutionType = kCCResolutionUnknown;
|
|
||||||
#endif
|
|
||||||
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture));
|
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -235,11 +233,13 @@ char * CCTexture2D::description(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation CCTexture2D (Image)
|
// implementation CCTexture2D (Image)
|
||||||
#if 0// TODO: #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
|
||||||
|
bool CCTexture2D::initWithImage(CCImage *uiImage)
|
||||||
|
{
|
||||||
|
return initWithImage(uiImage, kCCResolutionUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
bool CCTexture2D::initWithImage(CCImage * uiImage, ccResolutionType resolution)
|
bool CCTexture2D::initWithImage(CCImage * uiImage, ccResolutionType resolution)
|
||||||
#else
|
|
||||||
bool CCTexture2D::initWithImage(CCImage * uiImage)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
unsigned int POTWide, POTHigh;
|
unsigned int POTWide, POTHigh;
|
||||||
|
|
||||||
|
@ -273,9 +273,7 @@ bool CCTexture2D::initWithImage(CCImage * uiImage)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0//TODO (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
m_eResolutionType = resolution;
|
||||||
m_resolutionType = resolution;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// always load premultiplied images
|
// always load premultiplied images
|
||||||
return initPremultipliedATextureWithImage(uiImage, POTWide, POTHigh);
|
return initPremultipliedATextureWithImage(uiImage, POTWide, POTHigh);
|
||||||
|
@ -486,11 +484,8 @@ bool CCTexture2D::initWithString(const char *text, const CCSize& dimensions, CCT
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if 0// TODO: (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
|
||||||
return initWithImage(&image, m_resolutionType);
|
|
||||||
#else
|
|
||||||
return initWithImage(&image);
|
return initWithImage(&image);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ void CCTextureCache::addImageAsync(const char *path, CCObject *target, SEL_CallF
|
||||||
// optimization
|
// optimization
|
||||||
|
|
||||||
std::string pathKey = path;
|
std::string pathKey = path;
|
||||||
CCFileUtils::ccRemoveHDSuffixFromFile(pathKey);
|
CCFileUtils::removeSuffixFromFile(pathKey);
|
||||||
|
|
||||||
pathKey = CCFileUtils::fullPathFromRelativePath(pathKey.c_str());
|
pathKey = CCFileUtils::fullPathFromRelativePath(pathKey.c_str());
|
||||||
texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str());
|
texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str());
|
||||||
|
@ -330,7 +330,8 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
||||||
|
|
||||||
// remove possible -HD suffix to prevent caching the same image twice (issue #1040)
|
// remove possible -HD suffix to prevent caching the same image twice (issue #1040)
|
||||||
std::string pathKey = path;
|
std::string pathKey = path;
|
||||||
CCFileUtils::ccRemoveHDSuffixFromFile(pathKey);
|
ccResolutionType resolution;
|
||||||
|
CCFileUtils::removeSuffixFromFile(pathKey);
|
||||||
|
|
||||||
pathKey = CCFileUtils::fullPathFromRelativePath(pathKey.c_str());
|
pathKey = CCFileUtils::fullPathFromRelativePath(pathKey.c_str());
|
||||||
texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str());
|
texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str());
|
||||||
|
@ -360,7 +361,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
||||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtJpg));
|
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtJpg));
|
||||||
|
|
||||||
texture = new CCTexture2D();
|
texture = new CCTexture2D();
|
||||||
texture->initWithImage(&image);
|
texture->initWithImage(&image, resolution);
|
||||||
|
|
||||||
if( texture )
|
if( texture )
|
||||||
{
|
{
|
||||||
|
@ -388,7 +389,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
||||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtPng));
|
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtPng));
|
||||||
|
|
||||||
texture = new CCTexture2D();
|
texture = new CCTexture2D();
|
||||||
texture->initWithImage(&image);
|
texture->initWithImage(&image, resolution);
|
||||||
|
|
||||||
if( texture )
|
if( texture )
|
||||||
{
|
{
|
||||||
|
@ -423,7 +424,7 @@ CCTexture2D* CCTextureCache::addPVRTCImage(const char* path, int bpp, bool hasAl
|
||||||
CCTexture2D * texture;
|
CCTexture2D * texture;
|
||||||
|
|
||||||
std::string temp(path);
|
std::string temp(path);
|
||||||
CCFileUtils::ccRemoveHDSuffixFromFile(temp);
|
CCFileUtils::removeSuffixFromFile(temp);
|
||||||
|
|
||||||
if ( (texture = (CCTexture2D*)m_pTextures->objectForKey(temp.c_str())) )
|
if ( (texture = (CCTexture2D*)m_pTextures->objectForKey(temp.c_str())) )
|
||||||
{
|
{
|
||||||
|
@ -459,7 +460,7 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path)
|
||||||
CCTexture2D * tex;
|
CCTexture2D * tex;
|
||||||
std::string key(path);
|
std::string key(path);
|
||||||
// remove possible -HD suffix to prevent caching the same image twice (issue #1040)
|
// remove possible -HD suffix to prevent caching the same image twice (issue #1040)
|
||||||
CCFileUtils::ccRemoveHDSuffixFromFile(key);
|
CCFileUtils::removeSuffixFromFile(key);
|
||||||
|
|
||||||
if( (tex = (CCTexture2D*)m_pTextures->objectForKey(key.c_str())) )
|
if( (tex = (CCTexture2D*)m_pTextures->objectForKey(key.c_str())) )
|
||||||
{
|
{
|
||||||
|
@ -471,9 +472,9 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path)
|
||||||
tex = new CCTexture2D();
|
tex = new CCTexture2D();
|
||||||
if( tex->initWithPVRFile(fullpath.c_str()) )
|
if( tex->initWithPVRFile(fullpath.c_str()) )
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||||
// cache the texture file name
|
// cache the texture file name
|
||||||
VolatileTexture::addImageTexture(tex, fullpath.c_str(), CCImage::kFmtRawData);
|
VolatileTexture::addImageTexture(tex, fullpath.c_str(), CCImage::kFmtRawData);
|
||||||
#endif
|
#endif
|
||||||
m_pTextures->setObject(tex, key.c_str());
|
m_pTextures->setObject(tex, key.c_str());
|
||||||
tex->autorelease();
|
tex->autorelease();
|
||||||
|
@ -511,7 +512,7 @@ CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key)
|
||||||
|
|
||||||
// prevents overloading the autorelease pool
|
// prevents overloading the autorelease pool
|
||||||
texture = new CCTexture2D();
|
texture = new CCTexture2D();
|
||||||
texture->initWithImage(image);
|
texture->initWithImage(image, kCCResolutionUnknown);
|
||||||
|
|
||||||
if(key && texture)
|
if(key && texture)
|
||||||
{
|
{
|
||||||
|
@ -743,38 +744,38 @@ void VolatileTexture::reloadAllTextures()
|
||||||
|
|
||||||
switch (vt->m_eCashedImageType)
|
switch (vt->m_eCashedImageType)
|
||||||
{
|
{
|
||||||
case kImageFile:
|
case kImageFile:
|
||||||
{
|
{
|
||||||
CCImage image;
|
CCImage image;
|
||||||
std::string lowerCase(vt->m_strFileName.c_str());
|
std::string lowerCase(vt->m_strFileName.c_str());
|
||||||
for (unsigned int i = 0; i < lowerCase.length(); ++i)
|
for (unsigned int i = 0; i < lowerCase.length(); ++i)
|
||||||
{
|
{
|
||||||
lowerCase[i] = tolower(lowerCase[i]);
|
lowerCase[i] = tolower(lowerCase[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::string::npos != lowerCase.find(".pvr"))
|
if (std::string::npos != lowerCase.find(".pvr"))
|
||||||
{
|
{
|
||||||
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
|
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
|
||||||
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
|
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
|
||||||
|
|
||||||
vt->texture->initWithPVRFile(vt->m_strFileName.c_str());
|
vt->texture->initWithPVRFile(vt->m_strFileName.c_str());
|
||||||
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
|
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCFileData data(vt->m_strFileName.c_str(), "rb");
|
CCFileData data(vt->m_strFileName.c_str(), "rb");
|
||||||
unsigned long nSize = data.getSize();
|
unsigned long nSize = data.getSize();
|
||||||
unsigned char* pBuffer = data.getBuffer();
|
unsigned char* pBuffer = data.getBuffer();
|
||||||
|
|
||||||
if (image.initWithImageData((void*)pBuffer, nSize, vt->m_FmtImage))
|
if (image.initWithImageData((void*)pBuffer, nSize, vt->m_FmtImage))
|
||||||
{
|
{
|
||||||
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
|
CCTexture2DPixelFormat oldPixelFormat = CCTexture2D::defaultAlphaPixelFormat();
|
||||||
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
|
CCTexture2D::setDefaultAlphaPixelFormat(vt->m_PixelFormat);
|
||||||
vt->texture->initWithImage(&image);
|
vt->texture->initWithImage(&image);
|
||||||
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
|
CCTexture2D::setDefaultAlphaPixelFormat(oldPixelFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kImageData:
|
case kImageData:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "EffectsAdvancedTest.h"
|
#include "EffectsAdvancedTest.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kTagTextLayer = 1,
|
kTagTextLayer = 1,
|
||||||
|
@ -9,17 +9,17 @@ enum
|
||||||
|
|
||||||
kTagBackground = 1,
|
kTagBackground = 1,
|
||||||
kTagLabel = 2,
|
kTagLabel = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect1
|
// Effect1
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Effect1::onEnter()
|
void Effect1::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
CCNode* target = getChildByTag(kTagBackground);
|
CCNode* target = getChildByTag(kTagBackground);
|
||||||
|
|
||||||
// To reuse a grid the grid size and the grid type must be the same.
|
// To reuse a grid the grid size and the grid type must be the same.
|
||||||
|
@ -38,23 +38,23 @@ void Effect1::onEnter()
|
||||||
CCActionInterval* orbit_back = orbit->reverse();
|
CCActionInterval* orbit_back = orbit->reverse();
|
||||||
|
|
||||||
target->runAction( CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions( orbit, orbit_back, NULL) ) ) );
|
target->runAction( CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions( orbit, orbit_back, NULL) ) ) );
|
||||||
target->runAction( CCSequence::actions(lens, delay, reuse, waves, NULL) );
|
target->runAction( CCSequence::actions(lens, delay, reuse, waves, NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Effect1::title()
|
std::string Effect1::title()
|
||||||
{
|
{
|
||||||
return "Lens + Waves3d and OrbitCamera";
|
return "Lens + Waves3d and OrbitCamera";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect2
|
// Effect2
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Effect2::onEnter()
|
void Effect2::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
CCNode* target = getChildByTag(kTagBackground);
|
CCNode* target = getChildByTag(kTagBackground);
|
||||||
|
|
||||||
// To reuse a grid the grid size and the grid type must be the same.
|
// To reuse a grid the grid size and the grid type must be the same.
|
||||||
|
@ -79,24 +79,24 @@ void Effect2::onEnter()
|
||||||
// id orbit_back = [orbit reverse];
|
// id orbit_back = [orbit reverse];
|
||||||
//
|
//
|
||||||
// [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
|
// [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
|
||||||
target->runAction( (CCActionInterval *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) );
|
target->runAction( (CCActionInterval *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Effect2::title()
|
std::string Effect2::title()
|
||||||
{
|
{
|
||||||
return "ShakyTiles + ShuffleTiles + TurnOffTiles";
|
return "ShakyTiles + ShuffleTiles + TurnOffTiles";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect3
|
// Effect3
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Effect3::onEnter()
|
void Effect3::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
CCNode* bg = getChildByTag(kTagBackground);
|
CCNode* bg = getChildByTag(kTagBackground);
|
||||||
CCNode* target1 = bg->getChildByTag(kTagSprite1);
|
CCNode* target1 = bg->getChildByTag(kTagSprite1);
|
||||||
CCNode* target2 = bg->getChildByTag(kTagSprite2);
|
CCNode* target2 = bg->getChildByTag(kTagSprite2);
|
||||||
|
@ -109,51 +109,51 @@ void Effect3::onEnter()
|
||||||
|
|
||||||
// moving background. Testing issue #244
|
// moving background. Testing issue #244
|
||||||
CCActionInterval* move = CCMoveBy::actionWithDuration(3, ccp(200,0) );
|
CCActionInterval* move = CCMoveBy::actionWithDuration(3, ccp(200,0) );
|
||||||
bg->runAction(CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions(move, move->reverse(), NULL) ) ) );
|
bg->runAction(CCRepeatForever::actionWithAction( (CCActionInterval *)(CCSequence::actions(move, move->reverse(), NULL) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Effect3::title()
|
std::string Effect3::title()
|
||||||
{
|
{
|
||||||
return "Effects on 2 sprites";
|
return "Effects on 2 sprites";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect4
|
// Effect4
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Effect4::onEnter()
|
void Effect4::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
CCActionInterval* lens = CCLens3D::actionWithPosition(ccp(100,180), 150, ccg(32,24), 10);
|
CCActionInterval* lens = CCLens3D::actionWithPosition(ccp(100,180), 150, ccg(32,24), 10);
|
||||||
//id move = [MoveBy::actionWithDuration:5 position:ccp(400,0)];
|
//id move = [MoveBy::actionWithDuration:5 position:ccp(400,0)];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@todo we only support CCNode run actions now.
|
@todo we only support CCNode run actions now.
|
||||||
*/
|
*/
|
||||||
// CCActionInterval* move = CCJumpBy::actionWithDuration(5, ccp(380,0), 100, 4);
|
// CCActionInterval* move = CCJumpBy::actionWithDuration(5, ccp(380,0), 100, 4);
|
||||||
// CCActionInterval* move_back = move->reverse();
|
// CCActionInterval* move_back = move->reverse();
|
||||||
// CCActionInterval* seq = (CCActionInterval *)(CCSequence::actions( move, move_back, NULL));
|
// CCActionInterval* seq = (CCActionInterval *)(CCSequence::actions( move, move_back, NULL));
|
||||||
// CCActionManager::sharedManager()->addAction(seq, lens, false);
|
// CCActionManager::sharedManager()->addAction(seq, lens, false);
|
||||||
|
|
||||||
runAction( lens );
|
runAction( lens );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Effect4::title()
|
std::string Effect4::title()
|
||||||
{
|
{
|
||||||
return "Jumpy Lens3D";
|
return "Jumpy Lens3D";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect5
|
// Effect5
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Effect5::onEnter()
|
void Effect5::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
//CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D);
|
//CCDirector::sharedDirector()->setProjection(CCDirectorProjection2D);
|
||||||
|
|
||||||
|
@ -168,80 +168,80 @@ void Effect5::onEnter()
|
||||||
NULL) );
|
NULL) );
|
||||||
|
|
||||||
CCNode* bg = getChildByTag(kTagBackground);
|
CCNode* bg = getChildByTag(kTagBackground);
|
||||||
bg->runAction(stopEffect);
|
bg->runAction(stopEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Effect5::title()
|
std::string Effect5::title()
|
||||||
{
|
{
|
||||||
return "Test Stop-Copy-Restar";
|
return "Test Stop-Copy-Restar";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect5::onExit()
|
void Effect5::onExit()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onExit();
|
EffectAdvanceTextLayer::onExit();
|
||||||
|
|
||||||
CCDirector::sharedDirector()->setProjection(CCDirectorProjection3D);
|
CCDirector::sharedDirector()->setProjection(CCDirectorProjection3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Effect5
|
// Effect5
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
void Issue631::onEnter()
|
void Issue631::onEnter()
|
||||||
{
|
{
|
||||||
EffectAdvanceTextLayer::onEnter();
|
EffectAdvanceTextLayer::onEnter();
|
||||||
|
|
||||||
CCActionInterval* effect = (CCActionInterval*)(CCSequence::actions( CCDelayTime::actionWithDuration(2.0f), CCShaky3D::actionWithRange(16, false, ccg(5, 5), 5.0f), NULL));
|
CCActionInterval* effect = (CCActionInterval*)(CCSequence::actions( CCDelayTime::actionWithDuration(2.0f), CCShaky3D::actionWithRange(16, false, ccg(5, 5), 5.0f), NULL));
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
CCNode* bg = getChildByTag(kTagBackground);
|
CCNode* bg = getChildByTag(kTagBackground);
|
||||||
removeChild(bg, true);
|
removeChild(bg, true);
|
||||||
|
|
||||||
// background
|
// background
|
||||||
CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4(255,0,0,255) );
|
CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4(255,0,0,255) );
|
||||||
addChild(layer, -10);
|
addChild(layer, -10);
|
||||||
CCSprite* sprite = CCSprite::spriteWithFile("Images/grossini.png");
|
CCSprite* sprite = CCSprite::spriteWithFile("Images/grossini.png");
|
||||||
sprite->setPosition( ccp(50,80) );
|
sprite->setPosition( ccp(50,80) );
|
||||||
layer->addChild(sprite, 10);
|
layer->addChild(sprite, 10);
|
||||||
|
|
||||||
// foreground
|
// foreground
|
||||||
CCLayerColor* layer2 = CCLayerColor::layerWithColor(ccc4( 0, 255,0,255 ) );
|
CCLayerColor* layer2 = CCLayerColor::layerWithColor(ccc4( 0, 255,0,255 ) );
|
||||||
CCSprite* fog = CCSprite::spriteWithFile("Images/Fog.png");
|
CCSprite* fog = CCSprite::spriteWithFile("Images/Fog.png");
|
||||||
|
|
||||||
ccBlendFunc bf = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
|
ccBlendFunc bf = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
|
||||||
fog->setBlendFunc(bf);
|
fog->setBlendFunc(bf);
|
||||||
layer2->addChild(fog, 1);
|
layer2->addChild(fog, 1);
|
||||||
addChild(layer2, 1);
|
addChild(layer2, 1);
|
||||||
|
|
||||||
layer2->runAction( CCRepeatForever::actionWithAction(effect) );
|
layer2->runAction( CCRepeatForever::actionWithAction(effect) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Issue631::title()
|
std::string Issue631::title()
|
||||||
{
|
{
|
||||||
return "Testing Opacity";
|
return "Testing Opacity";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Issue631::subtitle()
|
std::string Issue631::subtitle()
|
||||||
{
|
{
|
||||||
return "Effect image should be 100% opaque. Testing issue #631";
|
return "Effect image should be 100% opaque. Testing issue #631";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// EffectAdvanceTextLayer
|
// EffectAdvanceTextLayer
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
IDC_NEXT = 100,
|
IDC_NEXT = 100,
|
||||||
IDC_BACK,
|
IDC_BACK,
|
||||||
IDC_RESTART
|
IDC_RESTART
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 6
|
#define MAX_LAYER 6
|
||||||
|
|
||||||
CCLayer* nextEffectAdvanceAction();
|
CCLayer* nextEffectAdvanceAction();
|
||||||
|
@ -293,12 +293,12 @@ CCLayer* restartEffectAdvanceAction()
|
||||||
pLayer->autorelease();
|
pLayer->autorelease();
|
||||||
|
|
||||||
return pLayer;
|
return pLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EffectAdvanceTextLayer::onEnter(void)
|
void EffectAdvanceTextLayer::onEnter(void)
|
||||||
{
|
{
|
||||||
CCLayer::onEnter();
|
CCLayer::onEnter();
|
||||||
float x,y;
|
float x,y;
|
||||||
|
|
||||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
@ -329,13 +329,13 @@ void EffectAdvanceTextLayer::onEnter(void)
|
||||||
addChild(label);
|
addChild(label);
|
||||||
label->setTag( kTagLabel );
|
label->setTag( kTagLabel );
|
||||||
|
|
||||||
std::string strSubtitle = subtitle();
|
std::string strSubtitle = subtitle();
|
||||||
if( ! strSubtitle.empty() )
|
if( ! strSubtitle.empty() )
|
||||||
{
|
{
|
||||||
CCLabelTTF* l = CCLabelTTF::labelWithString(strSubtitle.c_str(), "Thonburi", 16);
|
CCLabelTTF* l = CCLabelTTF::labelWithString(strSubtitle.c_str(), "Thonburi", 16);
|
||||||
addChild(l, 101);
|
addChild(l, 101);
|
||||||
l->setPosition( ccp(size.width/2, size.height-80) );
|
l->setPosition( ccp(size.width/2, size.height-80) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
CCMenuItemImage *item1 = CCMenuItemImage::itemWithNormalImage("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) );
|
||||||
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
CCMenuItemImage *item2 = CCMenuItemImage::itemWithNormalImage("Images/r1.png","Images/r2.png", this, menu_selector(EffectAdvanceTextLayer::restartCallback) );
|
||||||
|
@ -349,12 +349,12 @@ void EffectAdvanceTextLayer::onEnter(void)
|
||||||
item3->setPosition( ccp( size.width/2 + 100,30) );
|
item3->setPosition( ccp( size.width/2 + 100,30) );
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectAdvanceTextLayer::~EffectAdvanceTextLayer(void)
|
EffectAdvanceTextLayer::~EffectAdvanceTextLayer(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EffectAdvanceTextLayer::title()
|
std::string EffectAdvanceTextLayer::title()
|
||||||
{
|
{
|
||||||
return "No title";
|
return "No title";
|
||||||
|
@ -389,12 +389,12 @@ void EffectAdvanceTextLayer::backCallback(CCObject* pSender)
|
||||||
s->addChild( backEffectAdvanceAction() );
|
s->addChild( backEffectAdvanceAction() );
|
||||||
CCDirector::sharedDirector()->replaceScene(s);
|
CCDirector::sharedDirector()->replaceScene(s);
|
||||||
s->release();
|
s->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectAdvanceScene::runThisTest()
|
void EffectAdvanceScene::runThisTest()
|
||||||
{
|
{
|
||||||
CCLayer* pLayer = nextEffectAdvanceAction();
|
CCLayer* pLayer = nextEffectAdvanceAction();
|
||||||
|
|
||||||
addChild(pLayer);
|
addChild(pLayer);
|
||||||
CCDirector::sharedDirector()->replaceScene(this);
|
CCDirector::sharedDirector()->replaceScene(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,50 +300,50 @@ std::string LayerTestBlend::title()
|
||||||
// LayerGradient
|
// LayerGradient
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
LayerGradient::LayerGradient()
|
LayerGradient::LayerGradient()
|
||||||
{
|
{
|
||||||
CCLayerGradient* layer1 = CCLayerGradient::layerWithColor(ccc4(255,0,0,255), ccc4(0,255,0,255), ccp(0.9f, 0.9f));
|
CCLayerGradient* layer1 = CCLayerGradient::layerWithColor(ccc4(255,0,0,255), ccc4(0,255,0,255), ccp(0.9f, 0.9f));
|
||||||
addChild(layer1, 0, kTagLayer);
|
addChild(layer1, 0, kTagLayer);
|
||||||
|
|
||||||
setIsTouchEnabled(true);
|
setIsTouchEnabled(true);
|
||||||
|
|
||||||
CCLabelTTF *label1 = CCLabelTTF::labelWithString("Compressed Interpolation: Enabled", "Marker Felt", 26);
|
CCLabelTTF *label1 = CCLabelTTF::labelWithString("Compressed Interpolation: Enabled", "Marker Felt", 26);
|
||||||
CCLabelTTF *label2 = CCLabelTTF::labelWithString("Compressed Interpolation: Disabled", "Marker Felt", 26);
|
CCLabelTTF *label2 = CCLabelTTF::labelWithString("Compressed Interpolation: Disabled", "Marker Felt", 26);
|
||||||
CCMenuItemLabel *item1 = CCMenuItemLabel::itemWithLabel(label1);
|
CCMenuItemLabel *item1 = CCMenuItemLabel::itemWithLabel(label1);
|
||||||
CCMenuItemLabel *item2 = CCMenuItemLabel::itemWithLabel(label2);
|
CCMenuItemLabel *item2 = CCMenuItemLabel::itemWithLabel(label2);
|
||||||
CCMenuItemToggle *item = CCMenuItemToggle::itemWithTarget(this, menu_selector(LayerGradient::toggleItem), item1, item2, NULL);
|
CCMenuItemToggle *item = CCMenuItemToggle::itemWithTarget(this, menu_selector(LayerGradient::toggleItem), item1, item2, NULL);
|
||||||
|
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
|
||||||
addChild(menu);
|
addChild(menu);
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
menu->setPosition(ccp(s.width / 2, 100));
|
menu->setPosition(ccp(s.width / 2, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerGradient::toggleItem(CCObject *sender)
|
void LayerGradient::toggleItem(CCObject *sender)
|
||||||
{
|
{
|
||||||
CCLayerGradient *gradient = (CCLayerGradient*)getChildByTag(kTagLayer);
|
CCLayerGradient *gradient = (CCLayerGradient*)getChildByTag(kTagLayer);
|
||||||
gradient->setIsCompressedInterpolation(! gradient->getIsCompressedInterpolation());
|
gradient->setIsCompressedInterpolation(! gradient->getIsCompressedInterpolation());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerGradient::ccTouchesMoved(CCSet * touches, CCEvent *event)
|
void LayerGradient::ccTouchesMoved(CCSet * touches, CCEvent *event)
|
||||||
{
|
{
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
CCSetIterator it = touches->begin();
|
CCSetIterator it = touches->begin();
|
||||||
CCTouch* touch = (CCTouch*)(*it);
|
CCTouch* touch = (CCTouch*)(*it);
|
||||||
CCPoint start = touch->locationInView();
|
CCPoint start = touch->locationInView();
|
||||||
start = CCDirector::sharedDirector()->convertToGL(start);
|
start = CCDirector::sharedDirector()->convertToGL(start);
|
||||||
|
|
||||||
CCPoint diff = ccpSub( ccp(s.width/2,s.height/2), start);
|
CCPoint diff = ccpSub( ccp(s.width/2,s.height/2), start);
|
||||||
diff = ccpNormalize(diff);
|
diff = ccpNormalize(diff);
|
||||||
|
|
||||||
CCLayerGradient *gradient = (CCLayerGradient*) getChildByTag(1);
|
CCLayerGradient *gradient = (CCLayerGradient*) getChildByTag(1);
|
||||||
gradient->setVector(diff);
|
gradient->setVector(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LayerGradient::title()
|
std::string LayerGradient::title()
|
||||||
{
|
{
|
||||||
return "LayerGradient";
|
return "LayerGradient";
|
||||||
}
|
}
|
||||||
|
|
||||||
string LayerGradient::subtitle()
|
string LayerGradient::subtitle()
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include "MotionStreakTest.h"
|
#include "MotionStreakTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
|
||||||
CCLayer* nextMotionAction();
|
CCLayer* nextMotionAction();
|
||||||
CCLayer* backMotionAction();
|
CCLayer* backMotionAction();
|
||||||
CCLayer* restartMotionAction();
|
CCLayer* restartMotionAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// MotionStreakTest1
|
// MotionStreakTest1
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
void MotionStreakTest1::onEnter()
|
void MotionStreakTest1::onEnter()
|
||||||
{
|
{
|
||||||
MotionStreakTest::onEnter();
|
MotionStreakTest::onEnter();
|
||||||
|
@ -55,23 +55,23 @@ void MotionStreakTest1::onEnter()
|
||||||
// weak ref
|
// weak ref
|
||||||
streak = m_streak;
|
streak = m_streak;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionStreakTest1::onUpdate(ccTime delta)
|
void MotionStreakTest1::onUpdate(ccTime delta)
|
||||||
{
|
{
|
||||||
m_streak->setPosition( m_target->convertToWorldSpace(CCPointZero) );
|
m_streak->setPosition( m_target->convertToWorldSpace(CCPointZero) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MotionStreakTest1::title()
|
std::string MotionStreakTest1::title()
|
||||||
{
|
{
|
||||||
return "MotionStreak test 1";
|
return "MotionStreak test 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// MotionStreakTest2
|
// MotionStreakTest2
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
void MotionStreakTest2::onEnter()
|
void MotionStreakTest2::onEnter()
|
||||||
{
|
{
|
||||||
MotionStreakTest::onEnter();
|
MotionStreakTest::onEnter();
|
||||||
|
@ -89,7 +89,7 @@ void MotionStreakTest2::onEnter()
|
||||||
// weak ref
|
// weak ref
|
||||||
streak = m_streak;
|
streak = m_streak;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
CCSetIterator it = touches->begin();
|
CCSetIterator it = touches->begin();
|
||||||
|
@ -99,28 +99,28 @@ void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
|
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
|
||||||
|
|
||||||
m_streak->setPosition( touchLocation );
|
m_streak->setPosition( touchLocation );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MotionStreakTest2::title()
|
std::string MotionStreakTest2::title()
|
||||||
{
|
{
|
||||||
return "MotionStreak test";
|
return "MotionStreak test";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// MotionStreakTest
|
// MotionStreakTest
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
// enum
|
// enum
|
||||||
// {
|
// {
|
||||||
// IDC_NEXT = 100,
|
// IDC_NEXT = 100,
|
||||||
// IDC_BACK,
|
// IDC_BACK,
|
||||||
// IDC_RESTART
|
// IDC_RESTART
|
||||||
// };
|
// };
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 2
|
#define MAX_LAYER 2
|
||||||
|
|
||||||
CCLayer* createMotionLayer(int nIndex)
|
CCLayer* createMotionLayer(int nIndex)
|
||||||
|
@ -164,17 +164,17 @@ CCLayer* restartMotionAction()
|
||||||
pLayer->autorelease();
|
pLayer->autorelease();
|
||||||
|
|
||||||
return pLayer;
|
return pLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MotionStreakTest::MotionStreakTest(void)
|
MotionStreakTest::MotionStreakTest(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionStreakTest::~MotionStreakTest(void)
|
MotionStreakTest::~MotionStreakTest(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MotionStreakTest::title()
|
std::string MotionStreakTest::title()
|
||||||
{
|
{
|
||||||
return "No title";
|
return "No title";
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,9 @@
|
||||||
#include "CCConfiguration.h"
|
#include "CCConfiguration.h"
|
||||||
#include "RenderTextureTest.h"
|
#include "RenderTextureTest.h"
|
||||||
|
|
||||||
// Test #1 by Jason Booth (slipster216)
|
// Test #1 by Jason Booth (slipster216)
|
||||||
// Test #3 by David Deaco (ddeaco)
|
// Test #3 by David Deaco (ddeaco)
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 4
|
#define MAX_LAYER 4
|
||||||
|
@ -52,8 +52,8 @@ CCLayer* restartTestCase()
|
||||||
pLayer->autorelease();
|
pLayer->autorelease();
|
||||||
|
|
||||||
return pLayer;
|
return pLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTestDemo::onEnter()
|
void RenderTextureTestDemo::onEnter()
|
||||||
{
|
{
|
||||||
CCLayer::onEnter();
|
CCLayer::onEnter();
|
||||||
|
@ -83,8 +83,8 @@ void RenderTextureTestDemo::onEnter()
|
||||||
item3->setPosition( ccp( s.width/2 + 100,30) );
|
item3->setPosition( ccp( s.width/2 + 100,30) );
|
||||||
|
|
||||||
addChild(menu, 1);
|
addChild(menu, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTestDemo::restartCallback(CCObject* pSender)
|
void RenderTextureTestDemo::restartCallback(CCObject* pSender)
|
||||||
{
|
{
|
||||||
CCScene* s = new RenderTextureScene();
|
CCScene* s = new RenderTextureScene();
|
||||||
|
@ -108,20 +108,20 @@ void RenderTextureTestDemo::backCallback(CCObject* pSender)
|
||||||
s->addChild( backTestCase() );
|
s->addChild( backTestCase() );
|
||||||
CCDirector::sharedDirector()->replaceScene(s);
|
CCDirector::sharedDirector()->replaceScene(s);
|
||||||
s->release();
|
s->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RenderTextureTestDemo::title()
|
std::string RenderTextureTestDemo::title()
|
||||||
{
|
{
|
||||||
return "Render Texture Test";
|
return "Render Texture Test";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RenderTextureTestDemo::subtitle()
|
std::string RenderTextureTestDemo::subtitle()
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTextureTest::RenderTextureTest()
|
RenderTextureTest::RenderTextureTest()
|
||||||
: m_brush(NULL)
|
: m_brush(NULL)
|
||||||
{
|
{
|
||||||
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
if (CCConfiguration::sharedConfiguration()->getGlesVersion() < GLES_VER_2_0)
|
||||||
{
|
{
|
||||||
|
@ -134,10 +134,10 @@ RenderTextureTest::RenderTextureTest()
|
||||||
// create a render texture, this is what we're going to draw into
|
// create a render texture, this is what we're going to draw into
|
||||||
m_target = CCRenderTexture::renderTextureWithWidthAndHeight(s.width, s.height);
|
m_target = CCRenderTexture::renderTextureWithWidthAndHeight(s.width, s.height);
|
||||||
|
|
||||||
if (NULL == m_target)
|
if (NULL == m_target)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_target->setPosition(ccp(s.width/2, s.height/2));
|
m_target->setPosition(ccp(s.width/2, s.height/2));
|
||||||
|
|
||||||
|
@ -152,20 +152,20 @@ RenderTextureTest::RenderTextureTest()
|
||||||
ccBlendFunc bf = { GL_ONE, GL_ONE_MINUS_SRC_ALPHA };
|
ccBlendFunc bf = { GL_ONE, GL_ONE_MINUS_SRC_ALPHA };
|
||||||
m_brush->setBlendFunc( bf);
|
m_brush->setBlendFunc( bf);
|
||||||
m_brush->setOpacity(20);
|
m_brush->setOpacity(20);
|
||||||
setIsTouchEnabled(true);
|
setIsTouchEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTextureTest::~RenderTextureTest()
|
RenderTextureTest::~RenderTextureTest()
|
||||||
{
|
{
|
||||||
if (NULL != m_brush)
|
if (NULL != m_brush)
|
||||||
{
|
{
|
||||||
m_brush->release();
|
m_brush->release();
|
||||||
m_brush = NULL;
|
m_brush = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTest::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
void RenderTextureTest::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
CCSetIterator it = touches->begin();
|
CCSetIterator it = touches->begin();
|
||||||
CCTouch* touch = (CCTouch*)(*it);
|
CCTouch* touch = (CCTouch*)(*it);
|
||||||
CCPoint start = touch->locationInView();
|
CCPoint start = touch->locationInView();
|
||||||
|
@ -197,12 +197,12 @@ void RenderTextureTest::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
}
|
}
|
||||||
// finish drawing and return context back to the screen
|
// finish drawing and return context back to the screen
|
||||||
m_target->end(false);
|
m_target->end(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTest::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
void RenderTextureTest::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||||
|
|
||||||
CCSetIterator it;
|
CCSetIterator it;
|
||||||
CCTouch* touch;
|
CCTouch* touch;
|
||||||
|
|
||||||
|
@ -219,357 +219,357 @@ void RenderTextureTest::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
||||||
|
|
||||||
m_brush->setPosition(location);
|
m_brush->setPosition(location);
|
||||||
m_brush->setRotation( rand()%360 );
|
m_brush->setRotation( rand()%360 );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_target->begin();
|
m_target->begin();
|
||||||
m_brush->visit();
|
m_brush->visit();
|
||||||
m_target->end(true);
|
m_target->end(true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Impelmentation of RenderTextureSave
|
* Impelmentation of RenderTextureSave
|
||||||
*/
|
*/
|
||||||
RenderTextureSave::RenderTextureSave()
|
RenderTextureSave::RenderTextureSave()
|
||||||
{
|
{
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
// create a render texture, this is what we are going to draw into
|
// create a render texture, this is what we are going to draw into
|
||||||
m_pTarget = CCRenderTexture::renderTextureWithWidthAndHeight(s.width, s.height, kCCTexture2DPixelFormat_RGBA8888);
|
m_pTarget = CCRenderTexture::renderTextureWithWidthAndHeight(s.width, s.height, kCCTexture2DPixelFormat_RGBA8888);
|
||||||
m_pTarget->retain();
|
m_pTarget->retain();
|
||||||
m_pTarget->setPosition(ccp(s.width / 2, s.height / 2));
|
m_pTarget->setPosition(ccp(s.width / 2, s.height / 2));
|
||||||
|
|
||||||
// note that the render texture is a CCNode, and contains a sprite of its texture for convience,
|
// note that the render texture is a CCNode, and contains a sprite of its texture for convience,
|
||||||
// so we can just parent it to the scene like any other CCNode
|
// so we can just parent it to the scene like any other CCNode
|
||||||
this->addChild(m_pTarget, -1);
|
this->addChild(m_pTarget, -1);
|
||||||
|
|
||||||
// create a brush image to draw into the texture with
|
// create a brush image to draw into the texture with
|
||||||
m_pBrush = CCSprite::spriteWithFile("Images/fire.png");
|
m_pBrush = CCSprite::spriteWithFile("Images/fire.png");
|
||||||
m_pBrush->retain();
|
m_pBrush->retain();
|
||||||
m_pBrush->setColor(ccRED);
|
m_pBrush->setColor(ccRED);
|
||||||
m_pBrush->setOpacity(20);
|
m_pBrush->setOpacity(20);
|
||||||
this->setIsTouchEnabled(true);
|
this->setIsTouchEnabled(true);
|
||||||
|
|
||||||
// Save Image menu
|
// Save Image menu
|
||||||
CCMenuItemFont::setFontSize(16);
|
CCMenuItemFont::setFontSize(16);
|
||||||
CCMenuItem *item1 = CCMenuItemFont::itemWithString("Save Image", this, menu_selector(RenderTextureSave::saveImage));
|
CCMenuItem *item1 = CCMenuItemFont::itemWithString("Save Image", this, menu_selector(RenderTextureSave::saveImage));
|
||||||
CCMenuItem *item2 = CCMenuItemFont::itemWithString("Clear", this, menu_selector(RenderTextureSave::clearImage));
|
CCMenuItem *item2 = CCMenuItemFont::itemWithString("Clear", this, menu_selector(RenderTextureSave::clearImage));
|
||||||
CCMenu *menu = CCMenu::menuWithItems(item1, item2, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(item1, item2, NULL);
|
||||||
this->addChild(menu);
|
this->addChild(menu);
|
||||||
menu->alignItemsVertically();
|
menu->alignItemsVertically();
|
||||||
menu->setPosition(ccp(s.width - 80, s.height - 30));
|
menu->setPosition(ccp(s.width - 80, s.height - 30));
|
||||||
}
|
}
|
||||||
|
|
||||||
string RenderTextureSave::title()
|
string RenderTextureSave::title()
|
||||||
{
|
{
|
||||||
return "Touch the screen";
|
return "Touch the screen";
|
||||||
}
|
}
|
||||||
|
|
||||||
string RenderTextureSave::subtitle()
|
string RenderTextureSave::subtitle()
|
||||||
{
|
{
|
||||||
return "Press 'Save Image' to create an snapshot of the render texture";
|
return "Press 'Save Image' to create an snapshot of the render texture";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureSave::clearImage(cocos2d::CCObject *pSender)
|
void RenderTextureSave::clearImage(cocos2d::CCObject *pSender)
|
||||||
{
|
{
|
||||||
m_pTarget->clear(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1());
|
m_pTarget->clear(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureSave::saveImage(cocos2d::CCObject *pSender)
|
void RenderTextureSave::saveImage(cocos2d::CCObject *pSender)
|
||||||
{
|
{
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
|
||||||
char png[20];
|
char png[20];
|
||||||
sprintf(png, "image-%d.png", counter);
|
sprintf(png, "image-%d.png", counter);
|
||||||
char jpg[20];
|
char jpg[20];
|
||||||
sprintf(jpg, "image-%d.jpg", counter);
|
sprintf(jpg, "image-%d.jpg", counter);
|
||||||
|
|
||||||
m_pTarget->saveToFile(png, kCCImageFormatPNG);
|
m_pTarget->saveToFile(png, kCCImageFormatPNG);
|
||||||
m_pTarget->saveToFile(jpg, kCCImageFormatJPEG);
|
m_pTarget->saveToFile(jpg, kCCImageFormatJPEG);
|
||||||
|
|
||||||
|
|
||||||
CCImage *pImage = m_pTarget->newCCImage();
|
CCImage *pImage = m_pTarget->newCCImage();
|
||||||
|
|
||||||
CCTexture2D *tex = CCTextureCache::sharedTextureCache()->addUIImage(pImage, png);
|
CCTexture2D *tex = CCTextureCache::sharedTextureCache()->addUIImage(pImage, png);
|
||||||
|
|
||||||
CC_SAFE_DELETE(pImage);
|
CC_SAFE_DELETE(pImage);
|
||||||
|
|
||||||
CCSprite *sprite = CCSprite::spriteWithTexture(tex);
|
CCSprite *sprite = CCSprite::spriteWithTexture(tex);
|
||||||
|
|
||||||
sprite->setScale(0.3f);
|
sprite->setScale(0.3f);
|
||||||
addChild(sprite);
|
addChild(sprite);
|
||||||
sprite->setPosition(ccp(40, 40));
|
sprite->setPosition(ccp(40, 40));
|
||||||
sprite->setRotation(counter * 3);
|
sprite->setRotation(counter * 3);
|
||||||
|
|
||||||
CCLOG("Image saved %s and %s", png, jpg);
|
CCLOG("Image saved %s and %s", png, jpg);
|
||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTextureSave::~RenderTextureSave()
|
RenderTextureSave::~RenderTextureSave()
|
||||||
{
|
{
|
||||||
m_pBrush->release();
|
m_pBrush->release();
|
||||||
m_pTarget->release();
|
m_pTarget->release();
|
||||||
CCTextureCache::sharedTextureCache()->removeUnusedTextures();
|
CCTextureCache::sharedTextureCache()->removeUnusedTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureSave::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
void RenderTextureSave::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
CCTouch *touch = (CCTouch *)touches->anyObject();
|
CCTouch *touch = (CCTouch *)touches->anyObject();
|
||||||
CCPoint start = touch->locationInView();
|
CCPoint start = touch->locationInView();
|
||||||
start = CCDirector::sharedDirector()->convertToGL(start);
|
start = CCDirector::sharedDirector()->convertToGL(start);
|
||||||
CCPoint end = touch->previousLocationInView();
|
CCPoint end = touch->previousLocationInView();
|
||||||
|
|
||||||
// begin drawing to the render texture
|
// begin drawing to the render texture
|
||||||
m_pTarget->begin();
|
m_pTarget->begin();
|
||||||
|
|
||||||
// for extra points, we'll draw this smoothly from the last position and vary the sprite's
|
// for extra points, we'll draw this smoothly from the last position and vary the sprite's
|
||||||
// scale/rotation/offset
|
// scale/rotation/offset
|
||||||
float distance = ccpDistance(start, end);
|
float distance = ccpDistance(start, end);
|
||||||
if (distance > 1)
|
if (distance > 1)
|
||||||
{
|
{
|
||||||
int d = (int)distance;
|
int d = (int)distance;
|
||||||
for (int i = 0; i < d; i++)
|
for (int i = 0; i < d; i++)
|
||||||
{
|
{
|
||||||
float difx = end.x - start.x;
|
float difx = end.x - start.x;
|
||||||
float dify = end.y - start.y;
|
float dify = end.y - start.y;
|
||||||
float delta = (float)i / distance;
|
float delta = (float)i / distance;
|
||||||
m_pBrush->setPosition(ccp(start.x + (difx * delta), start.y + (dify * delta)));
|
m_pBrush->setPosition(ccp(start.x + (difx * delta), start.y + (dify * delta)));
|
||||||
m_pBrush->setRotation(rand() % 360);
|
m_pBrush->setRotation(rand() % 360);
|
||||||
float r = (float)(rand() % 50 / 50.f) + 0.25f;
|
float r = (float)(rand() % 50 / 50.f) + 0.25f;
|
||||||
m_pBrush->setScale(r);
|
m_pBrush->setScale(r);
|
||||||
/*m_pBrush->setColor(ccc3(CCRANDOM_0_1() * 127 + 128, 255, 255));*/
|
/*m_pBrush->setColor(ccc3(CCRANDOM_0_1() * 127 + 128, 255, 255));*/
|
||||||
// Use CCRANDOM_0_1() will cause error when loading libtests.so on android, I don't know why.
|
// Use CCRANDOM_0_1() will cause error when loading libtests.so on android, I don't know why.
|
||||||
m_pBrush->setColor(ccc3(rand() % 127 + 128, 255, 255));
|
m_pBrush->setColor(ccc3(rand() % 127 + 128, 255, 255));
|
||||||
// Call visit to draw the brush, don't call draw..
|
// Call visit to draw the brush, don't call draw..
|
||||||
m_pBrush->visit();
|
m_pBrush->visit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// finish drawing and return context back to the screen
|
// finish drawing and return context back to the screen
|
||||||
m_pTarget->end();
|
m_pTarget->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Impelmentation of RenderTextureIssue937
|
* Impelmentation of RenderTextureIssue937
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RenderTextureIssue937::RenderTextureIssue937()
|
RenderTextureIssue937::RenderTextureIssue937()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 1 2
|
* 1 2
|
||||||
* A: A1 A2
|
* A: A1 A2
|
||||||
*
|
*
|
||||||
* B: B1 B2
|
* B: B1 B2
|
||||||
*
|
*
|
||||||
* A1: premulti sprite
|
* A1: premulti sprite
|
||||||
* A2: premulti render
|
* A2: premulti render
|
||||||
*
|
*
|
||||||
* B1: non-premulti sprite
|
* B1: non-premulti sprite
|
||||||
* B2: non-premulti render
|
* B2: non-premulti render
|
||||||
*/
|
*/
|
||||||
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(200,200,200,255));
|
CCLayerColor *background = CCLayerColor::layerWithColor(ccc4(200,200,200,255));
|
||||||
addChild(background);
|
addChild(background);
|
||||||
|
|
||||||
CCSprite *spr_premulti = CCSprite::spriteWithFile("Images/fire.png");
|
CCSprite *spr_premulti = CCSprite::spriteWithFile("Images/fire.png");
|
||||||
spr_premulti->setPosition(ccp(16,48));
|
spr_premulti->setPosition(ccp(16,48));
|
||||||
|
|
||||||
CCSprite *spr_nonpremulti = CCSprite::spriteWithFile("Images/fire.png");
|
CCSprite *spr_nonpremulti = CCSprite::spriteWithFile("Images/fire.png");
|
||||||
spr_nonpremulti->setPosition(ccp(16,16));
|
spr_nonpremulti->setPosition(ccp(16,16));
|
||||||
|
|
||||||
|
|
||||||
/* A2 & B2 setup */
|
/* A2 & B2 setup */
|
||||||
CCRenderTexture *rend = CCRenderTexture::renderTextureWithWidthAndHeight(32, 64, kCCTexture2DPixelFormat_RGBA4444);
|
CCRenderTexture *rend = CCRenderTexture::renderTextureWithWidthAndHeight(32, 64, kCCTexture2DPixelFormat_RGBA4444);
|
||||||
|
|
||||||
if (NULL == rend)
|
if (NULL == rend)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's possible to modify the RenderTexture blending function by
|
// It's possible to modify the RenderTexture blending function by
|
||||||
// [[rend sprite] setBlendFunc:(ccBlendFunc) {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
// [[rend sprite] setBlendFunc:(ccBlendFunc) {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||||
|
|
||||||
rend->begin();
|
rend->begin();
|
||||||
spr_premulti->visit();
|
spr_premulti->visit();
|
||||||
spr_nonpremulti->visit();
|
spr_nonpremulti->visit();
|
||||||
rend->end();
|
rend->end();
|
||||||
|
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
|
||||||
/* A1: setup */
|
/* A1: setup */
|
||||||
spr_premulti->setPosition(ccp(s.width/2-16, s.height/2+16));
|
spr_premulti->setPosition(ccp(s.width/2-16, s.height/2+16));
|
||||||
/* B1: setup */
|
/* B1: setup */
|
||||||
spr_nonpremulti->setPosition(ccp(s.width/2-16, s.height/2-16));
|
spr_nonpremulti->setPosition(ccp(s.width/2-16, s.height/2-16));
|
||||||
|
|
||||||
rend->setPosition(ccp(s.width/2+16, s.height/2));
|
rend->setPosition(ccp(s.width/2+16, s.height/2));
|
||||||
|
|
||||||
addChild(spr_nonpremulti);
|
addChild(spr_nonpremulti);
|
||||||
addChild(spr_premulti);
|
addChild(spr_premulti);
|
||||||
addChild(rend);
|
addChild(rend);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RenderTextureIssue937::title()
|
std::string RenderTextureIssue937::title()
|
||||||
{
|
{
|
||||||
return "Testing issue #937";
|
return "Testing issue #937";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RenderTextureIssue937::subtitle()
|
std::string RenderTextureIssue937::subtitle()
|
||||||
{
|
{
|
||||||
return "All images should be equal...";
|
return "All images should be equal...";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureScene::runThisTest()
|
void RenderTextureScene::runThisTest()
|
||||||
{
|
{
|
||||||
CCLayer* pLayer = nextTestCase();
|
CCLayer* pLayer = nextTestCase();
|
||||||
addChild(pLayer);
|
addChild(pLayer);
|
||||||
|
|
||||||
CCDirector::sharedDirector()->replaceScene(this);
|
CCDirector::sharedDirector()->replaceScene(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Impelmentation of RenderTextureZbuffer
|
* Impelmentation of RenderTextureZbuffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RenderTextureZbuffer::RenderTextureZbuffer()
|
RenderTextureZbuffer::RenderTextureZbuffer()
|
||||||
{
|
{
|
||||||
this->setIsTouchEnabled(true);
|
this->setIsTouchEnabled(true);
|
||||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||||
CCLabelTTF *label = CCLabelTTF::labelWithString("vertexZ = 50", "Marker Felt", 64);
|
CCLabelTTF *label = CCLabelTTF::labelWithString("vertexZ = 50", "Marker Felt", 64);
|
||||||
label->setPosition(ccp(size.width / 2, size.height * 0.25f));
|
label->setPosition(ccp(size.width / 2, size.height * 0.25f));
|
||||||
this->addChild(label);
|
this->addChild(label);
|
||||||
|
|
||||||
CCLabelTTF *label2 = CCLabelTTF::labelWithString("vertexZ = 0", "Marker Felt", 64);
|
CCLabelTTF *label2 = CCLabelTTF::labelWithString("vertexZ = 0", "Marker Felt", 64);
|
||||||
label2->setPosition(ccp(size.width / 2, size.height * 0.5f));
|
label2->setPosition(ccp(size.width / 2, size.height * 0.5f));
|
||||||
this->addChild(label2);
|
this->addChild(label2);
|
||||||
|
|
||||||
CCLabelTTF *label3 = CCLabelTTF::labelWithString("vertexZ = -50", "Marker Felt", 64);
|
CCLabelTTF *label3 = CCLabelTTF::labelWithString("vertexZ = -50", "Marker Felt", 64);
|
||||||
label3->setPosition(ccp(size.width / 2, size.height * 0.75f));
|
label3->setPosition(ccp(size.width / 2, size.height * 0.75f));
|
||||||
this->addChild(label3);
|
this->addChild(label3);
|
||||||
|
|
||||||
label->setVertexZ(50);
|
label->setVertexZ(50);
|
||||||
label2->setVertexZ(0);
|
label2->setVertexZ(0);
|
||||||
label3->setVertexZ(-50);
|
label3->setVertexZ(-50);
|
||||||
|
|
||||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Images/bugs/circle.plist");
|
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Images/bugs/circle.plist");
|
||||||
mgr = CCSpriteBatchNode::batchNodeWithFile("Images/bugs/circle.png", 9);
|
mgr = CCSpriteBatchNode::batchNodeWithFile("Images/bugs/circle.png", 9);
|
||||||
this->addChild(mgr);
|
this->addChild(mgr);
|
||||||
sp1 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp1 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp2 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp2 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp3 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp3 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp4 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp4 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp5 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp5 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp6 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp6 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp7 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp7 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp8 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp8 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
sp9 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
sp9 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
|
||||||
mgr->addChild(sp1, 9);
|
mgr->addChild(sp1, 9);
|
||||||
mgr->addChild(sp2, 8);
|
mgr->addChild(sp2, 8);
|
||||||
mgr->addChild(sp3, 7);
|
mgr->addChild(sp3, 7);
|
||||||
mgr->addChild(sp4, 6);
|
mgr->addChild(sp4, 6);
|
||||||
mgr->addChild(sp5, 5);
|
mgr->addChild(sp5, 5);
|
||||||
mgr->addChild(sp6, 4);
|
mgr->addChild(sp6, 4);
|
||||||
mgr->addChild(sp7, 3);
|
mgr->addChild(sp7, 3);
|
||||||
mgr->addChild(sp8, 2);
|
mgr->addChild(sp8, 2);
|
||||||
mgr->addChild(sp9, 1);
|
mgr->addChild(sp9, 1);
|
||||||
|
|
||||||
sp1->setVertexZ(400);
|
sp1->setVertexZ(400);
|
||||||
sp2->setVertexZ(300);
|
sp2->setVertexZ(300);
|
||||||
sp3->setVertexZ(200);
|
sp3->setVertexZ(200);
|
||||||
sp4->setVertexZ(100);
|
sp4->setVertexZ(100);
|
||||||
sp5->setVertexZ(0);
|
sp5->setVertexZ(0);
|
||||||
sp6->setVertexZ(-100);
|
sp6->setVertexZ(-100);
|
||||||
sp7->setVertexZ(-200);
|
sp7->setVertexZ(-200);
|
||||||
sp8->setVertexZ(-300);
|
sp8->setVertexZ(-300);
|
||||||
sp9->setVertexZ(-400);
|
sp9->setVertexZ(-400);
|
||||||
|
|
||||||
sp9->setScale(2);
|
sp9->setScale(2);
|
||||||
sp9->setColor(ccYELLOW);
|
sp9->setColor(ccYELLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
string RenderTextureZbuffer::title()
|
string RenderTextureZbuffer::title()
|
||||||
{
|
{
|
||||||
return "Testing Z Buffer in Render Texture";
|
return "Testing Z Buffer in Render Texture";
|
||||||
}
|
}
|
||||||
|
|
||||||
string RenderTextureZbuffer::subtitle()
|
string RenderTextureZbuffer::subtitle()
|
||||||
{
|
{
|
||||||
return "Touch screen. It should be green";
|
return "Touch screen. It should be green";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureZbuffer::ccTouchesBegan(cocos2d::CCSet *touches, cocos2d::CCEvent *event)
|
void RenderTextureZbuffer::ccTouchesBegan(cocos2d::CCSet *touches, cocos2d::CCEvent *event)
|
||||||
{
|
{
|
||||||
CCSetIterator iter;
|
CCSetIterator iter;
|
||||||
CCTouch *touch;
|
CCTouch *touch;
|
||||||
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
||||||
{
|
{
|
||||||
touch = (CCTouch *)(*iter);
|
touch = (CCTouch *)(*iter);
|
||||||
CCPoint location = touch->locationInView();
|
CCPoint location = touch->locationInView();
|
||||||
|
|
||||||
location = CCDirector::sharedDirector()->convertToGL(location);
|
location = CCDirector::sharedDirector()->convertToGL(location);
|
||||||
sp1->setPosition(location);
|
sp1->setPosition(location);
|
||||||
sp2->setPosition(location);
|
sp2->setPosition(location);
|
||||||
sp3->setPosition(location);
|
sp3->setPosition(location);
|
||||||
sp4->setPosition(location);
|
sp4->setPosition(location);
|
||||||
sp5->setPosition(location);
|
sp5->setPosition(location);
|
||||||
sp6->setPosition(location);
|
sp6->setPosition(location);
|
||||||
sp7->setPosition(location);
|
sp7->setPosition(location);
|
||||||
sp8->setPosition(location);
|
sp8->setPosition(location);
|
||||||
sp9->setPosition(location);
|
sp9->setPosition(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureZbuffer::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
void RenderTextureZbuffer::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
CCSetIterator iter;
|
CCSetIterator iter;
|
||||||
CCTouch *touch;
|
CCTouch *touch;
|
||||||
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
||||||
{
|
{
|
||||||
touch = (CCTouch *)(*iter);
|
touch = (CCTouch *)(*iter);
|
||||||
CCPoint location = touch->locationInView();
|
CCPoint location = touch->locationInView();
|
||||||
|
|
||||||
location = CCDirector::sharedDirector()->convertToGL(location);
|
location = CCDirector::sharedDirector()->convertToGL(location);
|
||||||
sp1->setPosition(location);
|
sp1->setPosition(location);
|
||||||
sp2->setPosition(location);
|
sp2->setPosition(location);
|
||||||
sp3->setPosition(location);
|
sp3->setPosition(location);
|
||||||
sp4->setPosition(location);
|
sp4->setPosition(location);
|
||||||
sp5->setPosition(location);
|
sp5->setPosition(location);
|
||||||
sp6->setPosition(location);
|
sp6->setPosition(location);
|
||||||
sp7->setPosition(location);
|
sp7->setPosition(location);
|
||||||
sp8->setPosition(location);
|
sp8->setPosition(location);
|
||||||
sp9->setPosition(location);
|
sp9->setPosition(location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureZbuffer::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
void RenderTextureZbuffer::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
||||||
{
|
{
|
||||||
this->renderScreenShot();
|
this->renderScreenShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureZbuffer::renderScreenShot()
|
void RenderTextureZbuffer::renderScreenShot()
|
||||||
{
|
{
|
||||||
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(512, 512);
|
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(512, 512);
|
||||||
if (NULL == texture)
|
if (NULL == texture)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
texture->setAnchorPoint(ccp(0, 0));
|
texture->setAnchorPoint(ccp(0, 0));
|
||||||
texture->begin();
|
texture->begin();
|
||||||
|
|
||||||
this->visit();
|
this->visit();
|
||||||
|
|
||||||
texture->end();
|
texture->end();
|
||||||
|
|
||||||
CCSprite *sprite = CCSprite::spriteWithTexture(texture->getSprite()->getTexture());
|
CCSprite *sprite = CCSprite::spriteWithTexture(texture->getSprite()->getTexture());
|
||||||
|
|
||||||
sprite->setPosition(ccp(256, 256));
|
sprite->setPosition(ccp(256, 256));
|
||||||
sprite->setOpacity(182);
|
sprite->setOpacity(182);
|
||||||
sprite->setFlipY(1);
|
sprite->setFlipY(1);
|
||||||
this->addChild(sprite, 999999);
|
this->addChild(sprite, 999999);
|
||||||
sprite->setColor(ccGREEN);
|
sprite->setColor(ccGREEN);
|
||||||
|
|
||||||
sprite->runAction(CCSequence::actions(CCFadeTo::actionWithDuration(2, 0),
|
sprite->runAction(CCSequence::actions(CCFadeTo::actionWithDuration(2, 0),
|
||||||
CCHide::action(),
|
CCHide::action(),
|
||||||
NULL));
|
NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "RotateWorldTest.h"
|
#include "RotateWorldTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TestLayer
|
// TestLayer
|
||||||
|
@ -73,13 +73,13 @@ void SpriteLayer::onEnter()
|
||||||
spriteSister1->runAction(CCRepeat::actionWithAction( CCSequence::actions(rot1, rot2, NULL), 5 ));
|
spriteSister1->runAction(CCRepeat::actionWithAction( CCSequence::actions(rot1, rot2, NULL), 5 ));
|
||||||
spriteSister2->runAction(CCRepeat::actionWithAction( CCSequence::actions((CCFiniteTimeAction *)(rot2->copy()->autorelease()), (CCFiniteTimeAction *)(rot1->copy()->autorelease()), NULL), 5 ));
|
spriteSister2->runAction(CCRepeat::actionWithAction( CCSequence::actions((CCFiniteTimeAction *)(rot2->copy()->autorelease()), (CCFiniteTimeAction *)(rot1->copy()->autorelease()), NULL), 5 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// RotateWorldMainLayer
|
// RotateWorldMainLayer
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
void RotateWorldMainLayer::onEnter()
|
void RotateWorldMainLayer::onEnter()
|
||||||
{
|
{
|
||||||
CCLayer::onEnter();
|
CCLayer::onEnter();
|
||||||
|
|
|
@ -963,7 +963,7 @@ void TMXIsoVertexZ::repositionSprite(ccTime dt)
|
||||||
// tile height is 64x32
|
// tile height is 64x32
|
||||||
// map size: 30x30
|
// map size: 30x30
|
||||||
CCPoint p = m_tamara->getPosition();
|
CCPoint p = m_tamara->getPosition();
|
||||||
p = CC_POINT_POINTS_TO_PIXELS(p);
|
p = CC_POINT_POINTS_TO_PIXELS(p);
|
||||||
float newZ = -(p.y+32) /16;
|
float newZ = -(p.y+32) /16;
|
||||||
m_tamara->setVertexZ( newZ );
|
m_tamara->setVertexZ( newZ );
|
||||||
}
|
}
|
||||||
|
@ -1119,158 +1119,158 @@ std::string TMXOrthoMoveLayer::subtitle()
|
||||||
// TMXTilePropertyTest
|
// TMXTilePropertyTest
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
TMXTilePropertyTest::TMXTilePropertyTest()
|
TMXTilePropertyTest::TMXTilePropertyTest()
|
||||||
{
|
{
|
||||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-tile-property.tmx");
|
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-tile-property.tmx");
|
||||||
addChild(map ,0 ,kTagTileMap);
|
addChild(map ,0 ,kTagTileMap);
|
||||||
|
|
||||||
for(int i=1;i<=20;i++){
|
for(int i=1;i<=20;i++){
|
||||||
CCLog("GID:%i, Properties:%p", i, map->propertiesForGID(i));
|
CCLog("GID:%i, Properties:%p", i, map->propertiesForGID(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXTilePropertyTest::title()
|
std::string TMXTilePropertyTest::title()
|
||||||
{
|
{
|
||||||
return "TMX Tile Property Test";
|
return "TMX Tile Property Test";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXTilePropertyTest::subtitle()
|
std::string TMXTilePropertyTest::subtitle()
|
||||||
{
|
{
|
||||||
return "In the console you should see tile properties";
|
return "In the console you should see tile properties";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TMXOrthoFlipTest
|
// TMXOrthoFlipTest
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
TMXOrthoFlipTest::TMXOrthoFlipTest()
|
TMXOrthoFlipTest::TMXOrthoFlipTest()
|
||||||
{
|
{
|
||||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-rotation-test.tmx");
|
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-rotation-test.tmx");
|
||||||
addChild(map, 0, kTagTileMap);
|
addChild(map, 0, kTagTileMap);
|
||||||
|
|
||||||
CCSize s = map->getContentSize();
|
CCSize s = map->getContentSize();
|
||||||
CCLog("ContentSize: %f, %f", s.width,s.height);
|
CCLog("ContentSize: %f, %f", s.width,s.height);
|
||||||
|
|
||||||
CCObject* pObj = NULL;
|
CCObject* pObj = NULL;
|
||||||
CCARRAY_FOREACH(map->getChildren(), pObj)
|
CCARRAY_FOREACH(map->getChildren(), pObj)
|
||||||
{
|
{
|
||||||
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
||||||
child->getTexture()->setAntiAliasTexParameters();
|
child->getTexture()->setAntiAliasTexParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
||||||
map->runAction(action);
|
map->runAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXOrthoFlipTest::title()
|
std::string TMXOrthoFlipTest::title()
|
||||||
{
|
{
|
||||||
return "TMX tile flip test";
|
return "TMX tile flip test";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TMXOrthoFlipRunTimeTest
|
// TMXOrthoFlipRunTimeTest
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
TMXOrthoFlipRunTimeTest::TMXOrthoFlipRunTimeTest()
|
TMXOrthoFlipRunTimeTest::TMXOrthoFlipRunTimeTest()
|
||||||
{
|
{
|
||||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-rotation-test.tmx");
|
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithTMXFile("TileMaps/ortho-rotation-test.tmx");
|
||||||
addChild(map, 0, kTagTileMap);
|
addChild(map, 0, kTagTileMap);
|
||||||
|
|
||||||
CCSize s = map->getContentSize();
|
CCSize s = map->getContentSize();
|
||||||
CCLog("ContentSize: %f, %f", s.width,s.height);
|
CCLog("ContentSize: %f, %f", s.width,s.height);
|
||||||
|
|
||||||
CCObject* pObj = NULL;
|
CCObject* pObj = NULL;
|
||||||
CCARRAY_FOREACH(map->getChildren(), pObj)
|
CCARRAY_FOREACH(map->getChildren(), pObj)
|
||||||
{
|
{
|
||||||
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
||||||
child->getTexture()->setAntiAliasTexParameters();
|
child->getTexture()->setAntiAliasTexParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
||||||
map->runAction(action);
|
map->runAction(action);
|
||||||
|
|
||||||
schedule(schedule_selector(TMXOrthoFlipRunTimeTest::flipIt), 1.0f);
|
schedule(schedule_selector(TMXOrthoFlipRunTimeTest::flipIt), 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXOrthoFlipRunTimeTest::title()
|
std::string TMXOrthoFlipRunTimeTest::title()
|
||||||
{
|
{
|
||||||
return "TMX tile flip run time test";
|
return "TMX tile flip run time test";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXOrthoFlipRunTimeTest::subtitle()
|
std::string TMXOrthoFlipRunTimeTest::subtitle()
|
||||||
{
|
{
|
||||||
return "in 2 sec bottom left tiles will flip";
|
return "in 2 sec bottom left tiles will flip";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMXOrthoFlipRunTimeTest::flipIt(ccTime dt)
|
void TMXOrthoFlipRunTimeTest::flipIt(ccTime dt)
|
||||||
{
|
{
|
||||||
CCTMXTiledMap *map = (CCTMXTiledMap*) getChildByTag(kTagTileMap);
|
CCTMXTiledMap *map = (CCTMXTiledMap*) getChildByTag(kTagTileMap);
|
||||||
CCTMXLayer *layer = map->layerNamed("Layer 0");
|
CCTMXLayer *layer = map->layerNamed("Layer 0");
|
||||||
|
|
||||||
//blue diamond
|
//blue diamond
|
||||||
CCPoint tileCoord = ccp(1,10);
|
CCPoint tileCoord = ccp(1,10);
|
||||||
int flags;
|
int flags;
|
||||||
unsigned int GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
unsigned int GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
||||||
// Vertical
|
// Vertical
|
||||||
if( flags & kCCTMXTileVerticalFlag )
|
if( flags & kCCTMXTileVerticalFlag )
|
||||||
flags &= ~kCCTMXTileVerticalFlag;
|
flags &= ~kCCTMXTileVerticalFlag;
|
||||||
else
|
else
|
||||||
flags |= kCCTMXTileVerticalFlag;
|
flags |= kCCTMXTileVerticalFlag;
|
||||||
layer->setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags);
|
layer->setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags);
|
||||||
|
|
||||||
|
|
||||||
tileCoord = ccp(1,8);
|
tileCoord = ccp(1,8);
|
||||||
GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
||||||
// Vertical
|
// Vertical
|
||||||
if( flags & kCCTMXTileVerticalFlag )
|
if( flags & kCCTMXTileVerticalFlag )
|
||||||
flags &= ~kCCTMXTileVerticalFlag;
|
flags &= ~kCCTMXTileVerticalFlag;
|
||||||
else
|
else
|
||||||
flags |= kCCTMXTileVerticalFlag;
|
flags |= kCCTMXTileVerticalFlag;
|
||||||
layer->setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags);
|
layer->setTileGID(GID ,tileCoord, (ccTMXTileFlags)flags);
|
||||||
|
|
||||||
|
|
||||||
tileCoord = ccp(2,8);
|
tileCoord = ccp(2,8);
|
||||||
GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
GID = layer->tileGIDAt(tileCoord, (ccTMXTileFlags*)&flags);
|
||||||
// Horizontal
|
// Horizontal
|
||||||
if( flags & kCCTMXTileHorizontalFlag )
|
if( flags & kCCTMXTileHorizontalFlag )
|
||||||
flags &= ~kCCTMXTileHorizontalFlag;
|
flags &= ~kCCTMXTileHorizontalFlag;
|
||||||
else
|
else
|
||||||
flags |= kCCTMXTileHorizontalFlag;
|
flags |= kCCTMXTileHorizontalFlag;
|
||||||
layer->setTileGID(GID, tileCoord, (ccTMXTileFlags)flags);
|
layer->setTileGID(GID, tileCoord, (ccTMXTileFlags)flags);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TMXOrthoFromXMLTest
|
// TMXOrthoFromXMLTest
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
|
TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
|
||||||
{
|
{
|
||||||
string resources = "TileMaps"; // partial paths are OK as resource paths.
|
string resources = "TileMaps"; // partial paths are OK as resource paths.
|
||||||
string file = resources + "/orthogonal-test1.tmx";
|
string file = resources + "/orthogonal-test1.tmx";
|
||||||
|
|
||||||
char* str = CCString::stringWithContentsOfFile(CCFileUtils::fullPathFromRelativePath(file.c_str()));
|
char* str = CCString::stringWithContentsOfFile(CCFileUtils::fullPathFromRelativePath(file.c_str()));
|
||||||
CCAssert(str != NULL, "Unable to open file");
|
CCAssert(str != NULL, "Unable to open file");
|
||||||
|
|
||||||
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithXML(str ,resources.c_str());
|
CCTMXTiledMap *map = CCTMXTiledMap::tiledMapWithXML(str ,resources.c_str());
|
||||||
addChild(map, 0, kTagTileMap);
|
addChild(map, 0, kTagTileMap);
|
||||||
|
|
||||||
CCSize s = map->getContentSize();
|
CCSize s = map->getContentSize();
|
||||||
CCLog("ContentSize: %f, %f", s.width,s.height);
|
CCLog("ContentSize: %f, %f", s.width,s.height);
|
||||||
|
|
||||||
CCObject* pObj = NULL;
|
CCObject* pObj = NULL;
|
||||||
CCARRAY_FOREACH(map->getChildren(), pObj)
|
CCARRAY_FOREACH(map->getChildren(), pObj)
|
||||||
{
|
{
|
||||||
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
CCSpriteBatchNode* child = (CCSpriteBatchNode*)pObj;
|
||||||
child->getTexture()->setAntiAliasTexParameters();
|
child->getTexture()->setAntiAliasTexParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
CCScaleBy* action = CCScaleBy::actionWithDuration(2, 0.5f);
|
||||||
map->runAction(action);
|
map->runAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,8 +1381,8 @@ CCLayer* createTileMapLayer(int nIndex)
|
||||||
case 17: return new TMXResizeTest();
|
case 17: return new TMXResizeTest();
|
||||||
case 18: return new TMXIsoMoveLayer();
|
case 18: return new TMXIsoMoveLayer();
|
||||||
case 19: return new TMXOrthoMoveLayer();
|
case 19: return new TMXOrthoMoveLayer();
|
||||||
case 20: return new TMXOrthoFlipTest();
|
case 20: return new TMXOrthoFlipTest();
|
||||||
case 21: return new TMXOrthoFlipRunTimeTest();
|
case 21: return new TMXOrthoFlipRunTimeTest();
|
||||||
case 22: return new TMXOrthoFromXMLTest();
|
case 22: return new TMXOrthoFromXMLTest();
|
||||||
case 23: return new TileMapTest();
|
case 23: return new TileMapTest();
|
||||||
case 24: return new TileMapEditTest();
|
case 24: return new TileMapEditTest();
|
||||||
|
|
Loading…
Reference in New Issue