mirror of https://github.com/axmolengine/axmol.git
Merge remote branch 'origin/master'
This commit is contained in:
commit
e39fca389f
|
@ -201,17 +201,14 @@ const char * _FullPath(const char * szPath)
|
||||||
{
|
{
|
||||||
if (! s_szRootPath[0])
|
if (! s_szRootPath[0])
|
||||||
{
|
{
|
||||||
s_dwRootLen = GetModuleFileName(NULL, s_szRootPath, sizeof(s_szRootPath));
|
WCHAR wszPath[MAX_PATH];
|
||||||
while (--s_dwRootLen)
|
s_dwRootLen = WideCharToMultiByte(CP_ACP, 0, wszPath,
|
||||||
{
|
GetCurrentDirectoryW(sizeof(wszPath), wszPath),
|
||||||
if ('\\' == s_szRootPath[s_dwRootLen])
|
s_szRootPath, MAX_PATH, NULL, NULL);
|
||||||
{
|
s_szRootPath[s_dwRootLen] = '\\';
|
||||||
s_szRootPath[s_dwRootLen + 1] = 0;
|
s_szRootPath[s_dwRootLen + 1] = 0;
|
||||||
strcpy_s(s_szFullPath, sizeof(s_szFullPath), s_szRootPath);
|
strcpy_s(s_szFullPath, sizeof(s_szFullPath), s_szRootPath);
|
||||||
++s_dwRootLen;
|
++s_dwRootLen;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != szPath[0] && ':' != szPath[1])
|
if (0 != szPath[0] && ':' != szPath[1])
|
||||||
|
|
|
@ -653,6 +653,20 @@ void CCScheduler::pauseTarget(SelectorProtocol *pTarget)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCScheduler::isTargetPaused(SelectorProtocol *pTarget)
|
||||||
|
{
|
||||||
|
CCAssert( pTarget != NULL, "target must be non nil" );
|
||||||
|
|
||||||
|
// Custom selectors
|
||||||
|
tHashSelectorEntry *pElement = NULL;
|
||||||
|
HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement);
|
||||||
|
if( pElement )
|
||||||
|
{
|
||||||
|
return pElement->paused;
|
||||||
|
}
|
||||||
|
return false; // should never get here
|
||||||
|
}
|
||||||
|
|
||||||
// main loop
|
// main loop
|
||||||
void CCScheduler::tick(ccTime dt)
|
void CCScheduler::tick(ccTime dt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace cocos2d
|
||||||
void CCGrid3DAction::setVertex(cocos2d::ccGridSize pos, cocos2d::ccVertex3F vertex)
|
void CCGrid3DAction::setVertex(cocos2d::ccGridSize pos, cocos2d::ccVertex3F vertex)
|
||||||
{
|
{
|
||||||
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
|
CCGrid3D *g = (CCGrid3D*)m_pTarget->getGrid();
|
||||||
return g->setVertex(pos, vertex);
|
g->setVertex(pos, vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation of TiledGrid3DAction
|
// implementation of TiledGrid3DAction
|
||||||
|
|
|
@ -542,13 +542,13 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
|
||||||
assert(pAction1 != NULL);
|
assert(pAction1 != NULL);
|
||||||
assert(pAction2 != NULL);
|
assert(pAction2 != NULL);
|
||||||
|
|
||||||
|
bool bRet = false;
|
||||||
|
|
||||||
ccTime d1 = pAction1->getDuration();
|
ccTime d1 = pAction1->getDuration();
|
||||||
ccTime d2 = pAction2->getDuration();
|
ccTime d2 = pAction2->getDuration();
|
||||||
|
|
||||||
// __super::initWithDuration(fmaxf(d1, d2));
|
if (CCActionInterval::initWithDuration(MAX(d1, d2)))
|
||||||
float maxd = (d1 >= d2 || isnan(d2)) ? d1 : d2;
|
{
|
||||||
CCActionInterval::initWithDuration(maxd);
|
|
||||||
|
|
||||||
m_pOne = pAction1;
|
m_pOne = pAction1;
|
||||||
m_pTwo = pAction2;
|
m_pTwo = pAction2;
|
||||||
|
|
||||||
|
@ -563,7 +563,12 @@ bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAct
|
||||||
|
|
||||||
m_pOne->retain();
|
m_pOne->retain();
|
||||||
m_pTwo->retain();
|
m_pTwo->retain();
|
||||||
return true;
|
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCObject* CCSpawn::copyWithZone(cocos2d::CCZone *pZone)
|
CCObject* CCSpawn::copyWithZone(cocos2d::CCZone *pZone)
|
||||||
|
|
|
@ -303,14 +303,10 @@ void CCActionManager::removeActionByTag(unsigned int tag, CCObject *pTarget)
|
||||||
|
|
||||||
if (pAction->getTag() == tag && pAction->getOriginalTarget() == pTarget)
|
if (pAction->getTag() == tag && pAction->getOriginalTarget() == pTarget)
|
||||||
{
|
{
|
||||||
return removeActionAtIndex(i, pElement);
|
removeActionAtIndex(i, pElement);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CCLOG("cocos2d: removeActionByTag: Action not found!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CCLOG("cocos2d: removeActionByTag: Target not found!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,17 @@ A convience macro to iterate over a CCArray using. It is faster than the "fast e
|
||||||
@since v0.99.4
|
@since v0.99.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
In cocos2d-iphone 1.0.0, This macro have been update to like this:
|
||||||
|
|
||||||
|
#define CCARRAY_FOREACH(__array__, __object__) \
|
||||||
|
if (__array__ && __array__->data->num > 0) \
|
||||||
|
for(id *__arr__ = __array__->data->arr, *end = __array__->data->arr + __array__->data->num-1; \
|
||||||
|
__arr__ <= end && ((__object__ = *__arr__) != nil || true); \
|
||||||
|
__arr__++)
|
||||||
|
|
||||||
|
I found that it's not work in C++. So it keep what it's look like in version 1.0.0-rc3. ---By Bin
|
||||||
|
*/
|
||||||
#define CCARRAY_FOREACH(__array__, __object__) \
|
#define CCARRAY_FOREACH(__array__, __object__) \
|
||||||
if (__array__ && __array__->data->num > 0) \
|
if (__array__ && __array__->data->num > 0) \
|
||||||
for(CCObject** arr = __array__->data->arr, **end = __array__->data->arr + __array__->data->num-1; \
|
for(CCObject** arr = __array__->data->arr, **end = __array__->data->arr + __array__->data->num-1; \
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace cocos2d{
|
||||||
- CCLabelAtlas "characters" have a fixed height and width
|
- CCLabelAtlas "characters" have a fixed height and width
|
||||||
- CCLabelAtlas "characters" can be anything you want since they are taken from an image file
|
- CCLabelAtlas "characters" can be anything you want since they are taken from an image file
|
||||||
|
|
||||||
A more flexible class is CCBitmapFontAtlas. It supports variable width characters and it also has a nice editor.
|
A more flexible class is CCLabelBMFont. It supports variable width characters and it also has a nice editor.
|
||||||
*/
|
*/
|
||||||
class CC_DLL CCLabelAtlas : public CCAtlasNode, public CCLabelProtocol
|
class CC_DLL CCLabelAtlas : public CCAtlasNode, public CCLabelProtocol
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,13 @@ 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.
|
||||||
|
|
||||||
|
Use any of these editors to generate BMFonts:
|
||||||
|
http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef __CCBITMAP_FONT_ATLAS_H__
|
#ifndef __CCBITMAP_FONT_ATLAS_H__
|
||||||
#define __CCBITMAP_FONT_ATLAS_H__
|
#define __CCBITMAP_FONT_ATLAS_H__
|
||||||
|
@ -128,9 +135,10 @@ namespace cocos2d{
|
||||||
If in doubt, use CCLabelBMFont instead of CCLabelAtlas / CCLabel.
|
If in doubt, use CCLabelBMFont instead of CCLabelAtlas / CCLabel.
|
||||||
|
|
||||||
Supported editors:
|
Supported editors:
|
||||||
- http://www.n4te.com/hiero/hiero.jnlp
|
http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
- http://slick.cokeandcode.com/demos/hiero.jnlp
|
http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
- http://www.angelcode.com/products/bmfont/
|
http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace cocos2d{
|
||||||
*
|
*
|
||||||
* All features from CCTextureNode are valid in CCLabelTTF
|
* All features from CCTextureNode are valid in CCLabelTTF
|
||||||
*
|
*
|
||||||
* CCLabelTTF objects are slow. Consider using CCLabelAtlas or CCBitmapFontAtlas instead.
|
* CCLabelTTF objects are slow. Consider using CCLabelAtlas or CCLabelBMFont instead.
|
||||||
*/
|
*/
|
||||||
class CC_DLL CCLabelTTF : public CCSprite, public CCLabelProtocol
|
class CC_DLL CCLabelTTF : public CCSprite, public CCLabelProtocol
|
||||||
{
|
{
|
||||||
|
|
|
@ -301,10 +301,22 @@ CCPoint CC_DLL ccpRotateByAngle(const CCPoint& v, const CCPoint& pivot, float an
|
||||||
the hit point also is p1 + s * (p2 - p1);
|
the hit point also is p1 + s * (p2 - p1);
|
||||||
@since v0.99.1
|
@since v0.99.1
|
||||||
*/
|
*/
|
||||||
bool CC_DLL ccpLineIntersect(CCPoint p1, CCPoint p2,
|
bool CC_DLL ccpLineIntersect(const CCPoint& p1, const CCPoint& p2,
|
||||||
CCPoint p3, CCPoint p4,
|
const CCPoint& p3, const CCPoint& p4,
|
||||||
float *s, float *t);
|
float *s, float *t);
|
||||||
|
|
||||||
|
/*
|
||||||
|
ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D
|
||||||
|
@since v1.0.0
|
||||||
|
*/
|
||||||
|
bool ccpSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
||||||
|
|
||||||
|
/*
|
||||||
|
ccpIntersectPoint returns the intersection point of line A-B, C-D
|
||||||
|
@since v1.0.0
|
||||||
|
*/
|
||||||
|
CCPoint ccpIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D);
|
||||||
|
|
||||||
}//namespace cocos2d
|
}//namespace cocos2d
|
||||||
|
|
||||||
#endif // __SUPPORT_CGPOINTEXTENSION_H__
|
#endif // __SUPPORT_CGPOINTEXTENSION_H__
|
||||||
|
|
|
@ -177,6 +177,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void resumeTarget(SelectorProtocol *pTarget);
|
void resumeTarget(SelectorProtocol *pTarget);
|
||||||
|
|
||||||
|
/** Returns whether or not the target is paused
|
||||||
|
@since v1.0.0
|
||||||
|
*/
|
||||||
|
bool isTargetPaused(SelectorProtocol *pTarget);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** returns a shared instance of the Scheduler */
|
/** returns a shared instance of the Scheduler */
|
||||||
static CCScheduler* sharedScheduler(void);
|
static CCScheduler* sharedScheduler(void);
|
||||||
|
|
|
@ -45,10 +45,7 @@ class CCSize;
|
||||||
class CCTexture2D;
|
class CCTexture2D;
|
||||||
struct transformValues_;
|
struct transformValues_;
|
||||||
|
|
||||||
enum {
|
#define CCSpriteIndexNotInitialized 0xffffffff /// CCSprite invalid index on the CCSpriteBatchode
|
||||||
/// CCSprite invalid index on the CCSpriteBatchNode
|
|
||||||
CCSpriteIndexNotInitialized = 0xffffffff,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Whether or not an CCSprite will rotate, scale or translate with it's parent.
|
Whether or not an CCSprite will rotate, scale or translate with it's parent.
|
||||||
|
|
|
@ -147,6 +147,8 @@ protected:
|
||||||
void forceRemoveDelegate(CCTouchDelegate *pDelegate);
|
void forceRemoveDelegate(CCTouchDelegate *pDelegate);
|
||||||
void forceAddHandler(CCTouchHandler *pHandler, CCMutableArray<CCTouchHandler*> *pArray);
|
void forceAddHandler(CCTouchHandler *pHandler, CCMutableArray<CCTouchHandler*> *pArray);
|
||||||
void forceRemoveAllDelegates(void);
|
void forceRemoveAllDelegates(void);
|
||||||
|
void rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray);
|
||||||
|
CCTouchHandler* findHandler(CCTouchDelegate *pDelegate);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CCMutableArray<CCTouchHandler*> *m_pTargetedHandlers;
|
CCMutableArray<CCTouchHandler*> *m_pTargetedHandlers;
|
||||||
|
|
|
@ -40,7 +40,7 @@ This formula prevents artifacts by using 99% of the texture.
|
||||||
The "correct" way to prevent artifacts is by using the spritesheet-artifact-fixer.py or a similar tool.
|
The "correct" way to prevent artifacts is by using the spritesheet-artifact-fixer.py or a similar tool.
|
||||||
|
|
||||||
Affected nodes:
|
Affected nodes:
|
||||||
- CCSprite / CCSpriteBatchNode and subclasses: CCBitmapFontAtlas, CCTMXTiledMap
|
- CCSprite / CCSpriteBatchNode and subclasses: CCLabelBMFont, CCTMXTiledMap
|
||||||
- CCLabelAtlas
|
- CCLabelAtlas
|
||||||
- CCQuadParticleSystem
|
- CCQuadParticleSystem
|
||||||
- CCTileMap
|
- CCTileMap
|
||||||
|
@ -143,7 +143,7 @@ Disabled by default on iPhone with ARMv6 processors.
|
||||||
Using the translate/rotate/scale requires 5 GL calls.
|
Using the translate/rotate/scale requires 5 GL calls.
|
||||||
But computing the Affine matrix is relative expensive.
|
But computing the Affine matrix is relative expensive.
|
||||||
But according to performance tests, Affine matrix performs better.
|
But according to performance tests, Affine matrix performs better.
|
||||||
This parameter doesn't affect SpriteSheet nodes.
|
This parameter doesn't affect CCSpriteBatchNode nodes.
|
||||||
|
|
||||||
To enable set it to a value different than 0. Enabled by default.
|
To enable set it to a value different than 0. Enabled by default.
|
||||||
|
|
||||||
|
@ -177,6 +177,11 @@ To enable set it to a value different than 0. Enabled by default.
|
||||||
|
|
||||||
To enable set it to a value different than 0. Disabled by default.
|
To enable set it to a value different than 0. Disabled 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.2
|
@since v0.99.2
|
||||||
*/
|
*/
|
||||||
#define CC_TEXTURE_NPOT_SUPPORT 0
|
#define CC_TEXTURE_NPOT_SUPPORT 0
|
||||||
|
@ -187,6 +192,11 @@ For performance reasons, it's recommended disable it in games without retina dis
|
||||||
|
|
||||||
To enable set it to 1. Use 0 to disable it. Enabled by default.
|
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
|
@since v0.99.5
|
||||||
*/
|
*/
|
||||||
#define CC_RETINA_DISPLAY_SUPPORT 1
|
#define CC_RETINA_DISPLAY_SUPPORT 1
|
||||||
|
@ -220,7 +230,13 @@ Platforms: Only used on ARM Neon architectures like iPhone 3GS or newer and iPad
|
||||||
If enabled, all subclasses of CCSprite will draw a bounding box
|
If enabled, all subclasses of CCSprite will draw a bounding box
|
||||||
Useful for debugging purposes only. It is recommened to leave it disabled.
|
Useful for debugging purposes only. It is recommened to leave it disabled.
|
||||||
|
|
||||||
To enable set it to a value different than 0. Disabled by default.
|
To enable set it to a value different than 0. Disabled by default:
|
||||||
|
0 -- disabled
|
||||||
|
1 -- draw bounding box
|
||||||
|
2 -- draw texture box
|
||||||
|
0 -- disabled
|
||||||
|
1 -- draw bounding box
|
||||||
|
2 -- draw texture box
|
||||||
*/
|
*/
|
||||||
#define CC_SPRITE_DEBUG_DRAW 0
|
#define CC_SPRITE_DEBUG_DRAW 0
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,13 @@ 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.
|
||||||
|
|
||||||
|
Use any of these editors to generate BMFonts:
|
||||||
|
http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "CCLabelBMFont.h"
|
#include "CCLabelBMFont.h"
|
||||||
|
|
||||||
|
@ -206,7 +213,7 @@ namespace cocos2d{
|
||||||
int index = line.find('=')+1;
|
int index = line.find('=')+1;
|
||||||
int index2 = line.find(' ', index);
|
int index2 = line.find(' ', index);
|
||||||
std::string value = line.substr(index, index2-index);
|
std::string value = line.substr(index, index2-index);
|
||||||
CCAssert(atoi(value.c_str()) == 0, "BitmapFontAtlas file could not be found");
|
CCAssert(atoi(value.c_str()) == 0, "LabelBMFont file could not be found");
|
||||||
// file
|
// file
|
||||||
index = line.find('"')+1;
|
index = line.find('"')+1;
|
||||||
index2 = line.find('"', index);
|
index2 = line.find('"', index);
|
||||||
|
@ -366,13 +373,13 @@ namespace cocos2d{
|
||||||
//CCLabelBMFont
|
//CCLabelBMFont
|
||||||
//
|
//
|
||||||
|
|
||||||
//BitmapFontAtlas - Purge Cache
|
//LabelBMFont - Purge Cache
|
||||||
void CCLabelBMFont::purgeCachedData()
|
void CCLabelBMFont::purgeCachedData()
|
||||||
{
|
{
|
||||||
FNTConfigRemoveCache();
|
FNTConfigRemoveCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
//BitmapFontAtlas - Creation & Init
|
//LabelBMFont - Creation & Init
|
||||||
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile)
|
CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile)
|
||||||
{
|
{
|
||||||
CCLabelBMFont *pRet = new CCLabelBMFont();
|
CCLabelBMFont *pRet = new CCLabelBMFont();
|
||||||
|
@ -396,7 +403,7 @@ namespace cocos2d{
|
||||||
CC_SAFE_RELEASE(m_pConfiguration);// allow re-init
|
CC_SAFE_RELEASE(m_pConfiguration);// allow re-init
|
||||||
m_pConfiguration = FNTConfigLoadFile(fntFile);
|
m_pConfiguration = FNTConfigLoadFile(fntFile);
|
||||||
m_pConfiguration->retain();
|
m_pConfiguration->retain();
|
||||||
CCAssert( m_pConfiguration, "Error creating config for BitmapFontAtlas");
|
CCAssert( m_pConfiguration, "Error creating config for LabelBMFont");
|
||||||
|
|
||||||
if (CCSpriteBatchNode::initWithFile(m_pConfiguration->m_sAtlasName.c_str(), strlen(theString)))
|
if (CCSpriteBatchNode::initWithFile(m_pConfiguration->m_sAtlasName.c_str(), strlen(theString)))
|
||||||
{
|
{
|
||||||
|
@ -416,7 +423,7 @@ namespace cocos2d{
|
||||||
CC_SAFE_RELEASE(m_pConfiguration);
|
CC_SAFE_RELEASE(m_pConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// BitmapFontAtlas - Atlas generation
|
// LabelBMFont - Atlas generation
|
||||||
int CCLabelBMFont::kerningAmountForFirst(unsigned short first, unsigned short second)
|
int CCLabelBMFont::kerningAmountForFirst(unsigned short first, unsigned short second)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -466,7 +473,7 @@ namespace cocos2d{
|
||||||
for(int i=0; i<len; i++)
|
for(int i=0; i<len; i++)
|
||||||
{
|
{
|
||||||
unsigned short c = m_sString[i];
|
unsigned short c = m_sString[i];
|
||||||
CCAssert( c < kCCBMFontMaxChars, "BitmapFontAtlas: character outside bounds");
|
CCAssert( c < kCCBMFontMaxChars, "LabelBMFont: character outside bounds");
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
{
|
{
|
||||||
|
@ -535,7 +542,7 @@ namespace cocos2d{
|
||||||
this->setContentSizeInPixels(tmpSize);
|
this->setContentSizeInPixels(tmpSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BitmapFontAtlas - CCLabelProtocol protocol
|
//LabelBMFont - CCLabelProtocol protocol
|
||||||
void CCLabelBMFont::setString(const char *newString)
|
void CCLabelBMFont::setString(const char *newString)
|
||||||
{
|
{
|
||||||
m_sString.clear();
|
m_sString.clear();
|
||||||
|
@ -565,7 +572,7 @@ namespace cocos2d{
|
||||||
setString(label);
|
setString(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BitmapFontAtlas - CCRGBAProtocol protocol
|
//LabelBMFont - CCRGBAProtocol protocol
|
||||||
void CCLabelBMFont::setColor(ccColor3B var)
|
void CCLabelBMFont::setColor(ccColor3B var)
|
||||||
{
|
{
|
||||||
m_tColor = var;
|
m_tColor = var;
|
||||||
|
@ -633,7 +640,7 @@ namespace cocos2d{
|
||||||
return m_bIsOpacityModifyRGB;
|
return m_bIsOpacityModifyRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BitmapFontAtlas - AnchorPoint
|
// LabelBMFont - AnchorPoint
|
||||||
void CCLabelBMFont::setAnchorPoint(CCPoint point)
|
void CCLabelBMFont::setAnchorPoint(CCPoint point)
|
||||||
{
|
{
|
||||||
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
|
if( ! CCPoint::CCPointEqualToPoint(point, m_tAnchorPoint) )
|
||||||
|
@ -643,7 +650,7 @@ namespace cocos2d{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//BitmapFontAtlas - Debug draw
|
//LabelBMFont - Debug draw
|
||||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||||
void CCLabelBMFont::draw()
|
void CCLabelBMFont::draw()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,7 @@ THE SOFTWARE.
|
||||||
#include "CCActionTiledGrid.h"
|
#include "CCActionTiledGrid.h"
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
||||||
enum {
|
const unsigned int kSceneFade = 0xFADEFADE;
|
||||||
kSceneFade = 0xFADEFADE,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
|
#define IMPLEMENT_TRANSITIONWITHDURATION(_Type)\
|
||||||
_Type* _Type::transitionWithDuration(ccTime t, CCScene* scene)\
|
_Type* _Type::transitionWithDuration(ccTime t, CCScene* scene)\
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace cocos2d{
|
||||||
//Menu - Alignment
|
//Menu - Alignment
|
||||||
void CCMenu::alignItemsVertically()
|
void CCMenu::alignItemsVertically()
|
||||||
{
|
{
|
||||||
return this->alignItemsVerticallyWithPadding(kDefaultPadding);
|
this->alignItemsVerticallyWithPadding(kDefaultPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCMenu::alignItemsVerticallyWithPadding(float padding)
|
void CCMenu::alignItemsVerticallyWithPadding(float padding)
|
||||||
|
@ -260,7 +260,7 @@ namespace cocos2d{
|
||||||
|
|
||||||
void CCMenu::alignItemsHorizontally(void)
|
void CCMenu::alignItemsHorizontally(void)
|
||||||
{
|
{
|
||||||
return this->alignItemsHorizontallyWithPadding(kDefaultPadding);
|
this->alignItemsHorizontallyWithPadding(kDefaultPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCMenu::alignItemsHorizontallyWithPadding(float padding)
|
void CCMenu::alignItemsHorizontallyWithPadding(float padding)
|
||||||
|
|
|
@ -40,13 +40,9 @@ namespace cocos2d{
|
||||||
static std::string _fontName = "Marker Felt";
|
static std::string _fontName = "Marker Felt";
|
||||||
static bool _fontNameRelease = false;
|
static bool _fontNameRelease = false;
|
||||||
|
|
||||||
enum {
|
const unsigned int kCurrentItem = 0xc0c05001;
|
||||||
kCurrentItem = 0xc0c05001,
|
const unsigned int kZoomActionTag = 0xc0c05002;
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
kZoomActionTag = 0xc0c05002,
|
|
||||||
};
|
|
||||||
//
|
//
|
||||||
// CCMenuItem
|
// CCMenuItem
|
||||||
//
|
//
|
||||||
|
|
|
@ -165,6 +165,10 @@ CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
|
||||||
CCSprite* CCSprite::spriteWithSpriteFrameName(const char *pszSpriteFrameName)
|
CCSprite* CCSprite::spriteWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||||
{
|
{
|
||||||
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pszSpriteFrameName);
|
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pszSpriteFrameName);
|
||||||
|
|
||||||
|
char msg[256] = {0};
|
||||||
|
sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName);
|
||||||
|
CCAssert(pFrame != NULL, msg);
|
||||||
return spriteWithSpriteFrame(pFrame);
|
return spriteWithSpriteFrame(pFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,11 +699,21 @@ void CCSprite::draw(void)
|
||||||
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
|
glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
#if CC_SPRITE_DEBUG_DRAW == 1
|
||||||
|
// draw bounding box
|
||||||
CCSize s = m_tContentSize;
|
CCSize s = m_tContentSize;
|
||||||
CCPoint vertices[4] = {
|
CCPoint vertices[4] = {
|
||||||
ccp(0,0), ccp(s.width,0),
|
ccp(0,0), ccp(s.width,0),
|
||||||
ccp(s.width,s.height),ccp(0,s.height),
|
ccp(s.width,s.height), ccp(0,s.height)
|
||||||
|
};
|
||||||
|
ccDrawPoly(vertices, 4, true);
|
||||||
|
#elif CC_SPRITE_DEBUG_DRAW == 2
|
||||||
|
// draw texture box
|
||||||
|
CCSize s = m_obRect.size;
|
||||||
|
CCPoint offsetPix = getOffsetPositionInPixels();
|
||||||
|
CCPoint vertices[4] = {
|
||||||
|
ccp(offsetPix.x,offsetPix.y), ccp(offsetPix.x+s.width,offsetPix.y),
|
||||||
|
ccp(offsetPix.x+s.width,offsetPix.y+s.height), ccp(offsetPix.x,offsetPix.y+s.height)
|
||||||
};
|
};
|
||||||
ccDrawPoly(vertices, 4, true);
|
ccDrawPoly(vertices, 4, true);
|
||||||
#endif // CC_SPRITE_DEBUG_DRAW
|
#endif // CC_SPRITE_DEBUG_DRAW
|
||||||
|
|
|
@ -199,7 +199,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist, CCTexture
|
||||||
const char *pszPath = CCFileUtils::fullPathFromRelativePath(pszPlist);
|
const char *pszPath = CCFileUtils::fullPathFromRelativePath(pszPlist);
|
||||||
CCDictionary<std::string, CCObject*> *dict = CCFileUtils::dictionaryWithContentsOfFile(pszPath);
|
CCDictionary<std::string, CCObject*> *dict = CCFileUtils::dictionaryWithContentsOfFile(pszPath);
|
||||||
|
|
||||||
return addSpriteFramesWithDictionary(dict, pobTexture);
|
addSpriteFramesWithDictionary(dict, pobTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCSpriteFrameCache::addSpriteFramesWithFile(const char* plist, const char* textureFileName)
|
void CCSpriteFrameCache::addSpriteFramesWithFile(const char* plist, const char* textureFileName)
|
||||||
|
|
|
@ -124,8 +124,36 @@ CCPoint ccpRotateByAngle(const CCPoint& v, const CCPoint& pivot, float angle)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ccpLineIntersect(CCPoint A, CCPoint B,
|
|
||||||
CCPoint C, CCPoint D,
|
bool ccpSegmentIntersect(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D)
|
||||||
|
{
|
||||||
|
float S, T;
|
||||||
|
|
||||||
|
if( ccpLineIntersect(A, B, C, D, &S, &T )
|
||||||
|
&& (S >= 0.0f && S <= 1.0f && T >= 0.0f && T <= 1.0f) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCPoint ccpIntersectPoint(const CCPoint& A, const CCPoint& B, const CCPoint& C, const CCPoint& D)
|
||||||
|
{
|
||||||
|
float S, T;
|
||||||
|
|
||||||
|
if( ccpLineIntersect(A, B, C, D, &S, &T) )
|
||||||
|
{
|
||||||
|
// Point of intersection
|
||||||
|
CCPoint P;
|
||||||
|
P.x = A.x + S * (B.x - A.x);
|
||||||
|
P.y = A.y + S * (B.y - A.y);
|
||||||
|
return P;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CCPointZero;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ccpLineIntersect(const CCPoint& A, const CCPoint& B,
|
||||||
|
const CCPoint& C, const CCPoint& D,
|
||||||
float *S, float *T)
|
float *S, float *T)
|
||||||
{
|
{
|
||||||
// FAIL: Line undefined
|
// FAIL: Line undefined
|
||||||
|
@ -133,51 +161,37 @@ bool ccpLineIntersect(CCPoint A, CCPoint B,
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const float BAx = B.x - A.x;
|
||||||
|
const float BAy = B.y - A.y;
|
||||||
|
const float DCx = D.x - C.x;
|
||||||
|
const float DCy = D.y - C.y;
|
||||||
|
const float ACx = A.x - C.x;
|
||||||
|
const float ACy = A.y - C.y;
|
||||||
|
|
||||||
// Translate system to make A the origin
|
const float denom = DCy*BAx - DCx*BAy;
|
||||||
B.x-=A.x; B.y-=A.y;
|
|
||||||
C.x-=A.x; C.y-=A.y;
|
|
||||||
D.x-=A.x; D.y-=A.y;
|
|
||||||
|
|
||||||
// Cache
|
*S = DCx*ACy - DCy*ACx;
|
||||||
CCPoint C2 = C, D2 = D;
|
*T = BAx*ACy - BAy*ACx;
|
||||||
|
|
||||||
// Length of segment AB
|
if (denom == 0)
|
||||||
float distAB = sqrtf(B.x*B.x+B.y*B.y);
|
|
||||||
|
|
||||||
// Rotate the system so that point B is on the positive X axis.
|
|
||||||
float theCos = B.x/distAB;
|
|
||||||
float theSin = B.y/distAB;
|
|
||||||
float newX = C.x*theCos+C.y*theSin;
|
|
||||||
C.y = C.y*theCos-C.x*theSin; C.x = newX;
|
|
||||||
newX = D.x*theCos+D.y*theSin;
|
|
||||||
D.y = D.y*theCos-D.x*theSin; D.x = newX;
|
|
||||||
|
|
||||||
// FAIL: Lines are parallel.
|
|
||||||
if (C.y == D.y)
|
|
||||||
{
|
{
|
||||||
|
if (*S == 0 || *T == 0)
|
||||||
|
{
|
||||||
|
// Lines incident
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Lines parallel and not incident
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discover position of the intersection in the line AB
|
*S = *S / denom;
|
||||||
float ABpos = D.x+(C.x-D.x)*D.y/(D.y-C.y);
|
*T = *T / denom;
|
||||||
|
|
||||||
// Vector CD
|
// Point of intersection
|
||||||
C.x = D2.x-C2.x;
|
// CGPoint P;
|
||||||
C.y = D2.y-C2.y;
|
// P.x = A.x + *S * (B.x - A.x);
|
||||||
|
// P.y = A.y + *S * (B.y - A.y);
|
||||||
|
|
||||||
// Vector between intersection and point C
|
|
||||||
A.x = ABpos*theCos-C2.x;
|
|
||||||
A.y = ABpos*theSin-C2.y;
|
|
||||||
|
|
||||||
newX = sqrtf((A.x*A.x+A.y*A.y)/(C.x*C.x+C.y*C.y));
|
|
||||||
if(((A.y<0) != (C.y<0)) || ((A.x<0) != (C.x<0)))
|
|
||||||
newX *= -1.0f;
|
|
||||||
|
|
||||||
*S = ABpos/distAB;
|
|
||||||
*T = newX;
|
|
||||||
|
|
||||||
// Success.
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace cocos2d {
|
||||||
|
|
||||||
unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
|
int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len );
|
||||||
|
|
||||||
int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
|
int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
|
||||||
{
|
{
|
||||||
static char inalphabet[256], decoder[256];
|
static char inalphabet[256], decoder[256];
|
||||||
|
|
|
@ -339,17 +339,13 @@ static inline void ccCArrayFree(ccCArray *arr)
|
||||||
/** Doubles C array capacity */
|
/** Doubles C array capacity */
|
||||||
static inline void ccCArrayDoubleCapacity(ccCArray *arr)
|
static inline void ccCArrayDoubleCapacity(ccCArray *arr)
|
||||||
{
|
{
|
||||||
arr->max *= 2;
|
ccArrayDoubleCapacity((ccArray*)arr);
|
||||||
arr->arr = (void**) realloc(arr->arr, arr->max * sizeof(void*));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Increases array capacity such that max >= num + extra. */
|
/** Increases array capacity such that max >= num + extra. */
|
||||||
static inline void ccCArrayEnsureExtraCapacity(ccCArray *arr, unsigned int extra)
|
static inline void ccCArrayEnsureExtraCapacity(ccCArray *arr, unsigned int extra)
|
||||||
{
|
{
|
||||||
while (arr->max < arr->num + extra)
|
ccArrayEnsureExtraCapacity((ccArray*)arr,extra);
|
||||||
{
|
|
||||||
ccCArrayDoubleCapacity(arr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns index of first occurence of value, NSNotFound if value not found. */
|
/** Returns index of first occurence of value, NSNotFound if value not found. */
|
||||||
|
|
|
@ -30,6 +30,9 @@ THE SOFTWARE.
|
||||||
|
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
||||||
|
void tgaLoadRLEImageData(FILE *file, tImageTGA *info);
|
||||||
|
void tgaFlipImage( tImageTGA *info );
|
||||||
|
|
||||||
// load the image header field from stream
|
// load the image header field from stream
|
||||||
bool tgaLoadHeader(unsigned char* Buffer, unsigned long bufSize, tImageTGA *psInfo)
|
bool tgaLoadHeader(unsigned char* Buffer, unsigned long bufSize, tImageTGA *psInfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,6 +157,7 @@ bool CCTexture2D::getHasPremultipliedAlpha()
|
||||||
|
|
||||||
bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize)
|
bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize)
|
||||||
{
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||||
glGenTextures(1, &m_uName);
|
glGenTextures(1, &m_uName);
|
||||||
glBindTexture(GL_TEXTURE_2D, m_uName);
|
glBindTexture(GL_TEXTURE_2D, m_uName);
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,16 @@ THE SOFTWARE.
|
||||||
#include "support/data_support/ccCArray.h"
|
#include "support/data_support/ccCArray.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for sort
|
||||||
|
*/
|
||||||
|
static bool less(const cocos2d::CCTouchHandler *p1, const cocos2d::CCTouchHandler *p2)
|
||||||
|
{
|
||||||
|
return ((cocos2d::CCTouchHandler*)p1)->getPriority() < ((cocos2d::CCTouchHandler*)p2)->getPriority();
|
||||||
|
}
|
||||||
|
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
||||||
bool CCTouchDispatcher::isDispatchEvents(void)
|
bool CCTouchDispatcher::isDispatchEvents(void)
|
||||||
|
@ -229,11 +239,48 @@ void CCTouchDispatcher::removeAllDelegates(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCTouchHandler* CCTouchDispatcher::findHandler(CCTouchDelegate *pDelegate)
|
||||||
|
{
|
||||||
|
CCMutableArray<CCTouchHandler*>::CCMutableArrayIterator iter;
|
||||||
|
|
||||||
|
for (iter = m_pTargetedHandlers->begin(); iter != m_pTargetedHandlers->end(); ++iter)
|
||||||
|
{
|
||||||
|
if ((*iter)->getDelegate() == pDelegate)
|
||||||
|
{
|
||||||
|
return *iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iter = m_pStandardHandlers->begin(); iter != m_pStandardHandlers->end(); ++iter)
|
||||||
|
{
|
||||||
|
if ((*iter)->getDelegate() == pDelegate)
|
||||||
|
{
|
||||||
|
return *iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCTouchDispatcher::rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArray)
|
||||||
|
{
|
||||||
|
sort(pArray->begin(), pArray->end(), less);
|
||||||
|
}
|
||||||
|
|
||||||
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
|
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
|
||||||
{
|
{
|
||||||
CC_UNUSED_PARAM(nPriority);
|
assert(pDelegate != NULL);
|
||||||
CC_UNUSED_PARAM(pDelegate);
|
|
||||||
assert(0);
|
CCTouchHandler *handler = NULL;
|
||||||
|
|
||||||
|
handler = this->findHandler(pDelegate);
|
||||||
|
|
||||||
|
assert(handler != NULL);
|
||||||
|
|
||||||
|
handler->setPriority(nPriority);
|
||||||
|
|
||||||
|
this->rearrangeHandlers(m_pTargetedHandlers);
|
||||||
|
this->rearrangeHandlers(m_pStandardHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -9,6 +9,10 @@ enum
|
||||||
kTagSequence,
|
kTagSequence,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextActionManagerAction();
|
||||||
|
CCLayer* backActionManagerAction();
|
||||||
|
CCLayer* restartActionManagerAction();
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 5
|
#define MAX_LAYER 5
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include "ActionsTest.h"
|
#include "ActionsTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
|
||||||
|
CCLayer* NextAction();
|
||||||
|
CCLayer* BackAction();
|
||||||
|
CCLayer* RestartAction();
|
||||||
|
|
||||||
static int s_nActionIdx = -1;
|
static int s_nActionIdx = -1;
|
||||||
|
|
||||||
CCLayer* CreateLayer(int nIndex)
|
CCLayer* CreateLayer(int nIndex)
|
||||||
|
@ -376,19 +380,19 @@ void ActionSkewRotateScale::onEnter()
|
||||||
|
|
||||||
CCSize boxSize = CCSizeMake(100.0f, 100.0f);
|
CCSize boxSize = CCSizeMake(100.0f, 100.0f);
|
||||||
|
|
||||||
CCColorLayer *box = CCColorLayer::layerWithColor(ccc4(255, 255, 0, 255));
|
CCLayerColor *box = CCLayerColor::layerWithColor(ccc4(255, 255, 0, 255));
|
||||||
box->setAnchorPoint(ccp(0, 0));
|
box->setAnchorPoint(ccp(0, 0));
|
||||||
box->setPosition(ccp(190, 110));
|
box->setPosition(ccp(190, 110));
|
||||||
box->setContentSize(boxSize);
|
box->setContentSize(boxSize);
|
||||||
|
|
||||||
static float markrside = 10.0f;
|
static float markrside = 10.0f;
|
||||||
CCColorLayer *uL = CCColorLayer::layerWithColor(ccc4(255, 0, 0, 255));
|
CCLayerColor *uL = CCLayerColor::layerWithColor(ccc4(255, 0, 0, 255));
|
||||||
box->addChild(uL);
|
box->addChild(uL);
|
||||||
uL->setContentSize(CCSizeMake(markrside, markrside));
|
uL->setContentSize(CCSizeMake(markrside, markrside));
|
||||||
uL->setPosition(ccp(0.f, boxSize.height - markrside));
|
uL->setPosition(ccp(0.f, boxSize.height - markrside));
|
||||||
uL->setAnchorPoint(ccp(0, 0));
|
uL->setAnchorPoint(ccp(0, 0));
|
||||||
|
|
||||||
CCColorLayer *uR = CCColorLayer::layerWithColor(ccc4(0, 0, 255, 255));
|
CCLayerColor *uR = CCLayerColor::layerWithColor(ccc4(0, 0, 255, 255));
|
||||||
box->addChild(uR);
|
box->addChild(uR);
|
||||||
uR->setContentSize(CCSizeMake(markrside, markrside));
|
uR->setContentSize(CCSizeMake(markrside, markrside));
|
||||||
uR->setPosition(ccp(boxSize.width - markrside, boxSize.height - markrside));
|
uR->setPosition(ccp(boxSize.width - markrside, boxSize.height - markrside));
|
||||||
|
|
|
@ -30,12 +30,12 @@ bool Bug1159Layer::init()
|
||||||
CCLayerColor *sprite_a = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 700, 700);
|
CCLayerColor *sprite_a = CCLayerColor::layerWithColorWidthHeight(ccc4(255, 0, 0, 255), 700, 700);
|
||||||
sprite_a->setAnchorPoint(ccp(0.5f, 0.5f));
|
sprite_a->setAnchorPoint(ccp(0.5f, 0.5f));
|
||||||
sprite_a->setIsRelativeAnchorPoint(true);
|
sprite_a->setIsRelativeAnchorPoint(true);
|
||||||
sprite_a->setPosition(ccp(0.0, s.height/2));
|
sprite_a->setPosition(ccp(0.0f, s.height/2));
|
||||||
addChild(sprite_a);
|
addChild(sprite_a);
|
||||||
|
|
||||||
sprite_a->runAction(CCRepeatForever::actionWithAction((CCActionInterval*) CCSequence::actions(
|
sprite_a->runAction(CCRepeatForever::actionWithAction((CCActionInterval*) CCSequence::actions(
|
||||||
CCMoveTo::actionWithDuration(1.0f, ccp(1024.0, 384.0)),
|
CCMoveTo::actionWithDuration(1.0f, ccp(1024.0f, 384.0f)),
|
||||||
CCMoveTo::actionWithDuration(1.0f, ccp(0.0, 384.0)),
|
CCMoveTo::actionWithDuration(1.0f, ccp(0.0f, 384.0f)),
|
||||||
NULL)));
|
NULL)));
|
||||||
|
|
||||||
CCLayerColor *sprite_b = CCLayerColor::layerWithColorWidthHeight(ccc4(0, 0, 255, 255), 400, 400);
|
CCLayerColor *sprite_b = CCLayerColor::layerWithColorWidthHeight(ccc4(0, 0, 255, 255), 400, 400);
|
||||||
|
@ -46,7 +46,7 @@ bool Bug1159Layer::init()
|
||||||
|
|
||||||
CCMenuItemLabel *label = CCMenuItemLabel::itemWithLabel(CCLabelTTF::labelWithString("Flip Me", "Helvetica", 24), this, menu_selector(Bug1159Layer::callBack));
|
CCMenuItemLabel *label = CCMenuItemLabel::itemWithLabel(CCLabelTTF::labelWithString("Flip Me", "Helvetica", 24), this, menu_selector(Bug1159Layer::callBack));
|
||||||
CCMenu *menu = CCMenu::menuWithItems(label, NULL);
|
CCMenu *menu = CCMenu::menuWithItems(label, NULL);
|
||||||
menu->setPosition(ccp(s.width - 200, 50.0));
|
menu->setPosition(ccp(s.width - 200.0f, 50.0f));
|
||||||
addChild(menu);
|
addChild(menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "Bug-1174.h"
|
#include "Bug-1174.h"
|
||||||
|
|
||||||
|
int check_for_error( CCPoint p1, CCPoint p2, CCPoint p3, CCPoint p4, float s, float t );
|
||||||
|
|
||||||
int check_for_error( CCPoint p1, CCPoint p2, CCPoint p3, CCPoint p4, float s, float t )
|
int check_for_error( CCPoint p1, CCPoint p2, CCPoint p3, CCPoint p4, float s, float t )
|
||||||
{
|
{
|
||||||
// the hit point is p3 + t * (p4 - p3);
|
// the hit point is p3 + t * (p4 - p3);
|
||||||
|
|
|
@ -9,6 +9,11 @@ enum
|
||||||
kTagSlider,
|
kTagSlider,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CCLayer* nextCocosNodeAction();
|
||||||
|
CCLayer* backCocosNodeAction();
|
||||||
|
CCLayer* restartCocosNodeAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TestCocosNodeDemo
|
// TestCocosNodeDemo
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#define MAX_LAYER 1
|
#define MAX_LAYER 1
|
||||||
|
|
||||||
|
CCLayer* nextDirectorTestCase();
|
||||||
|
CCLayer* backDirectorTestCase();
|
||||||
|
CCLayer* restartDirectorTestCase();
|
||||||
|
|
||||||
static int sceneIdx=-1;
|
static int sceneIdx=-1;
|
||||||
static ccDeviceOrientation s_currentOrientation = CCDeviceOrientationPortrait;
|
static ccDeviceOrientation s_currentOrientation = CCDeviceOrientationPortrait;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ enum {
|
||||||
kTagSlider = 1,
|
kTagSlider = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextEaseAction();
|
||||||
|
CCLayer* backEaseAction();
|
||||||
|
CCLayer* restartEaseAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// SpriteEase
|
// SpriteEase
|
||||||
|
|
|
@ -244,6 +244,10 @@ static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 6
|
#define MAX_LAYER 6
|
||||||
|
|
||||||
|
CCLayer* nextEffectAdvanceAction();
|
||||||
|
CCLayer* backEffectAdvanceAction();
|
||||||
|
CCLayer* restartEffectAdvanceAction();
|
||||||
|
|
||||||
CCLayer* createEffectAdvanceLayer(int nIndex)
|
CCLayer* createEffectAdvanceLayer(int nIndex)
|
||||||
{
|
{
|
||||||
switch(nIndex)
|
switch(nIndex)
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#define MAX_LAYERS 2;
|
#define MAX_LAYERS 2;
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
|
CCLayer* nextHiResAction();
|
||||||
|
CCLayer* restartHiResAction();
|
||||||
|
CCLayer* backHiResAction();
|
||||||
|
|
||||||
CCLayer* createHiResLayer(int idx)
|
CCLayer* createHiResLayer(int idx)
|
||||||
{
|
{
|
||||||
CCLayer* pLayer = NULL;
|
CCLayer* pLayer = NULL;
|
||||||
|
|
|
@ -34,6 +34,10 @@ enum
|
||||||
IDC_RESTART
|
IDC_RESTART
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextAtlasAction();
|
||||||
|
CCLayer* backAtlasAction();
|
||||||
|
CCLayer* restartAtlasAction();
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 16
|
#define MAX_LAYER 16
|
||||||
|
@ -352,6 +356,12 @@ std::string LabelAtlasColorTest::subtitle()
|
||||||
//
|
//
|
||||||
// Atlas3
|
// Atlas3
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
Atlas3::Atlas3()
|
Atlas3::Atlas3()
|
||||||
{
|
{
|
||||||
|
@ -430,6 +440,12 @@ std::string Atlas3::subtitle()
|
||||||
//
|
//
|
||||||
// Atlas4
|
// Atlas4
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
Atlas4::Atlas4()
|
Atlas4::Atlas4()
|
||||||
{
|
{
|
||||||
|
@ -516,6 +532,12 @@ std::string Atlas4::subtitle()
|
||||||
//
|
//
|
||||||
// Atlas5
|
// Atlas5
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
Atlas5::Atlas5()
|
Atlas5::Atlas5()
|
||||||
|
@ -542,6 +564,12 @@ std::string Atlas5::subtitle()
|
||||||
//
|
//
|
||||||
// Atlas6
|
// Atlas6
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
Atlas6::Atlas6()
|
Atlas6::Atlas6()
|
||||||
|
@ -579,15 +607,13 @@ std::string Atlas6::subtitle()
|
||||||
//
|
//
|
||||||
// AtlasBitmapColor
|
// AtlasBitmapColor
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
|
||||||
* Use any of these editors to generate bitmap font atlas:
|
|
||||||
* http://www.n4te.com/hiero/hiero.jnlp
|
|
||||||
* http://slick.cokeandcode.com/demos/hiero.jnlp
|
|
||||||
* http://www.angelcode.com/products/bmfont/
|
|
||||||
*/
|
|
||||||
|
|
||||||
AtlasBitmapColor::AtlasBitmapColor()
|
AtlasBitmapColor::AtlasBitmapColor()
|
||||||
{
|
{
|
||||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
@ -627,6 +653,12 @@ std::string AtlasBitmapColor::subtitle()
|
||||||
//
|
//
|
||||||
// AtlasFastBitmap
|
// AtlasFastBitmap
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
AtlasFastBitmap::AtlasFastBitmap()
|
AtlasFastBitmap::AtlasFastBitmap()
|
||||||
|
@ -661,6 +693,12 @@ std::string AtlasFastBitmap::subtitle()
|
||||||
//
|
//
|
||||||
// BitmapFontMultiLine
|
// BitmapFontMultiLine
|
||||||
//
|
//
|
||||||
|
// Use any of these editors to generate BMFonts:
|
||||||
|
// http://glyphdesigner.71squared.com/ (Commercial, Mac OS X)
|
||||||
|
// http://www.n4te.com/hiero/hiero.jnlp (Free, Java)
|
||||||
|
// http://slick.cokeandcode.com/demos/hiero.jnlp (Free, Java)
|
||||||
|
// http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
BitmapFontMultiLine::BitmapFontMultiLine()
|
BitmapFontMultiLine::BitmapFontMultiLine()
|
||||||
{
|
{
|
||||||
|
@ -767,7 +805,7 @@ std::string LabelsEmpty::title()
|
||||||
|
|
||||||
std::string LabelsEmpty::subtitle()
|
std::string LabelsEmpty::subtitle()
|
||||||
{
|
{
|
||||||
return "3 empty labels: LabelAtlas, Label and BitmapFontAtlas";
|
return "3 empty labels: LabelAtlas, LabelTTF and LabelBMFont";
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
|
@ -6,6 +6,10 @@ enum
|
||||||
kTagLayer = 1,
|
kTagLayer = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextTestAction();
|
||||||
|
CCLayer* backTestAction();
|
||||||
|
CCLayer* restartTestAction();
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 4
|
#define MAX_LAYER 4
|
||||||
|
|
|
@ -28,6 +28,7 @@ MenuLayer1::MenuLayer1()
|
||||||
CCMenuItemFont::setFontSize( 30 );
|
CCMenuItemFont::setFontSize( 30 );
|
||||||
CCMenuItemFont::setFontName("Courier New");
|
CCMenuItemFont::setFontName("Courier New");
|
||||||
|
|
||||||
|
setIsTouchEnabled(true);
|
||||||
// Font Item
|
// Font Item
|
||||||
|
|
||||||
CCSprite* spriteNormal = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*2,115,23));
|
CCSprite* spriteNormal = CCSprite::spriteWithFile(s_MenuItem, CCRectMake(0,23*2,115,23));
|
||||||
|
@ -51,7 +52,7 @@ MenuLayer1::MenuLayer1()
|
||||||
// Font Item
|
// Font Item
|
||||||
CCMenuItem *item4 = CCMenuItemFont::itemFromString("I toggle enable items", this, menu_selector(MenuLayer1::menuCallbackEnable) );
|
CCMenuItem *item4 = CCMenuItemFont::itemFromString("I toggle enable items", this, menu_selector(MenuLayer1::menuCallbackEnable) );
|
||||||
|
|
||||||
// Label Item (BitmapFontAtlas)
|
// Label Item (CCLabelBMFont)
|
||||||
CCLabelBMFont* label = CCLabelBMFont::labelWithString("configuration", "fonts/bitmapFontTest3.fnt");
|
CCLabelBMFont* label = CCLabelBMFont::labelWithString("configuration", "fonts/bitmapFontTest3.fnt");
|
||||||
CCMenuItemLabel* item5 = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(MenuLayer1::menuCallbackConfig));
|
CCMenuItemLabel* item5 = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(MenuLayer1::menuCallbackConfig));
|
||||||
|
|
||||||
|
@ -105,6 +106,28 @@ MenuLayer1::MenuLayer1()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuLayer1::registerWithTouchDispatcher()
|
||||||
|
{
|
||||||
|
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, kCCMenuTouchPriority+1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MenuLayer1::ccTouchBegan(CCTouch *touch, CCEvent * pEvent)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuLayer1::ccTouchEnded(CCTouch *touch, CCEvent * pEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuLayer1::ccTouchCancelled(CCTouch *touch, CCEvent * pEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MenuLayer1::ccTouchMoved(CCTouch *touch, CCEvent * pEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
MenuLayer1::~MenuLayer1()
|
MenuLayer1::~MenuLayer1()
|
||||||
{
|
{
|
||||||
m_disabledItem->release();
|
m_disabledItem->release();
|
||||||
|
@ -120,8 +143,19 @@ void MenuLayer1::menuCallbackConfig(CCObject* sender)
|
||||||
((CCLayerMultiplex*)m_pParent)->switchTo(3);
|
((CCLayerMultiplex*)m_pParent)->switchTo(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuLayer1::allowTouches(ccTime dt)
|
||||||
|
{
|
||||||
|
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority+1, this);
|
||||||
|
unscheduleAllSelectors();
|
||||||
|
CCLog("TOUCHES ALLOWED AGAIN");
|
||||||
|
}
|
||||||
|
|
||||||
void MenuLayer1::menuCallbackDisabled(CCObject* sender)
|
void MenuLayer1::menuCallbackDisabled(CCObject* sender)
|
||||||
{
|
{
|
||||||
|
// hijack all touch events for 5 seconds
|
||||||
|
CCTouchDispatcher::sharedDispatcher()->setPriority(kCCMenuTouchPriority-1, this);
|
||||||
|
schedule(schedule_selector(MenuLayer1::allowTouches), 5.0f);
|
||||||
|
CCLog("TOUCHES DISABLED FOR 5 SECONDS");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuLayer1::menuCallbackEnable(CCObject* sender)
|
void MenuLayer1::menuCallbackEnable(CCObject* sender)
|
||||||
|
|
|
@ -14,6 +14,13 @@ public:
|
||||||
~MenuLayer1();
|
~MenuLayer1();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void registerWithTouchDispatcher();
|
||||||
|
virtual bool ccTouchBegan(CCTouch *touch, CCEvent * pEvent);
|
||||||
|
virtual void ccTouchEnded(CCTouch *touch, CCEvent * pEvent);
|
||||||
|
virtual void ccTouchCancelled(CCTouch *touch, CCEvent * pEvent);
|
||||||
|
virtual void ccTouchMoved(CCTouch *touch, CCEvent * pEvent);
|
||||||
|
|
||||||
|
void allowTouches(ccTime dt);
|
||||||
void menuCallback(CCObject* pSender);
|
void menuCallback(CCObject* pSender);
|
||||||
void menuCallbackConfig(CCObject* pSender);
|
void menuCallbackConfig(CCObject* pSender);
|
||||||
void menuCallbackDisabled(CCObject* pSender);
|
void menuCallbackDisabled(CCObject* pSender);
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include "MotionStreakTest.h"
|
#include "MotionStreakTest.h"
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
|
||||||
|
CCLayer* nextMotionAction();
|
||||||
|
CCLayer* backMotionAction();
|
||||||
|
CCLayer* restartMotionAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// MotionStreakTest1
|
// MotionStreakTest1
|
||||||
|
|
|
@ -7,6 +7,10 @@ enum
|
||||||
kTagGrossini,
|
kTagGrossini,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextParallaxAction();
|
||||||
|
CCLayer* backParallaxAction();
|
||||||
|
CCLayer* restartParallaxAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Parallax1
|
// Parallax1
|
||||||
|
|
|
@ -12,6 +12,10 @@ enum
|
||||||
kTagLabelAtlas = 1,
|
kTagLabelAtlas = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextParticleAction();
|
||||||
|
CCLayer* backParticleAction();
|
||||||
|
CCLayer* restartParticleAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// DemoFirework
|
// DemoFirework
|
||||||
|
|
|
@ -5,6 +5,10 @@ static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 3
|
#define MAX_LAYER 3
|
||||||
|
|
||||||
|
CCLayer* nextAction();
|
||||||
|
CCLayer* backAction();
|
||||||
|
CCLayer* restartAction();
|
||||||
|
|
||||||
CCLayer* createLayer(int nIndex)
|
CCLayer* createLayer(int nIndex)
|
||||||
{
|
{
|
||||||
switch(nIndex)
|
switch(nIndex)
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#include "CCConfiguration.h"
|
#include "CCConfiguration.h"
|
||||||
#include "RenderTextureTest.h"
|
#include "RenderTextureTest.h"
|
||||||
|
|
||||||
|
// Test #1 by Jason Booth (slipster216)
|
||||||
|
// Test #3 by David Deaco (ddeaco)
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 2
|
#define MAX_LAYER 3
|
||||||
|
|
||||||
CCLayer* createTestCase(int nIndex)
|
CCLayer* createTestCase(int nIndex)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +15,7 @@ CCLayer* createTestCase(int nIndex)
|
||||||
{
|
{
|
||||||
case 0: return new RenderTextureTest();
|
case 0: return new RenderTextureTest();
|
||||||
case 1: return new RenderTextureIssue937();
|
case 1: return new RenderTextureIssue937();
|
||||||
|
case 2: return new RenderTextureZbuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -265,3 +269,143 @@ void RenderTextureScene::runThisTest()
|
||||||
|
|
||||||
CCDirector::sharedDirector()->replaceScene(this);
|
CCDirector::sharedDirector()->replaceScene(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderTextureZbuffer::RenderTextureZbuffer()
|
||||||
|
{
|
||||||
|
this->setIsTouchEnabled(true);
|
||||||
|
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||||
|
CCLabelTTF *label = CCLabelTTF::labelWithString("vertexZ = 50", "Marker Felt", 64);
|
||||||
|
label->setPosition(ccp(size.width / 2, size.height * 0.25f));
|
||||||
|
this->addChild(label);
|
||||||
|
|
||||||
|
CCLabelTTF *label2 = CCLabelTTF::labelWithString("vertexZ = 0", "Marker Felt", 64);
|
||||||
|
label2->setPosition(ccp(size.width / 2, size.height * 0.5f));
|
||||||
|
this->addChild(label2);
|
||||||
|
|
||||||
|
CCLabelTTF *label3 = CCLabelTTF::labelWithString("vertexZ = -50", "Marker Felt", 64);
|
||||||
|
label3->setPosition(ccp(size.width / 2, size.height * 0.75f));
|
||||||
|
this->addChild(label3);
|
||||||
|
|
||||||
|
label->setVertexZ(50);
|
||||||
|
label2->setVertexZ(0);
|
||||||
|
label3->setVertexZ(-50);
|
||||||
|
|
||||||
|
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Images/bugs/circle.plist");
|
||||||
|
mgr = CCSpriteBatchNode::batchNodeWithFile("Images/bugs/circle.png", 9);
|
||||||
|
this->addChild(mgr);
|
||||||
|
sp1 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp2 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp3 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp4 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp5 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp6 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp7 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp8 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
sp9 = CCSprite::spriteWithSpriteFrameName("circle.png");
|
||||||
|
|
||||||
|
mgr->addChild(sp1, 9);
|
||||||
|
mgr->addChild(sp2, 8);
|
||||||
|
mgr->addChild(sp3, 7);
|
||||||
|
mgr->addChild(sp4, 6);
|
||||||
|
mgr->addChild(sp5, 5);
|
||||||
|
mgr->addChild(sp6, 4);
|
||||||
|
mgr->addChild(sp7, 3);
|
||||||
|
mgr->addChild(sp8, 2);
|
||||||
|
mgr->addChild(sp9, 1);
|
||||||
|
|
||||||
|
sp1->setVertexZ(400);
|
||||||
|
sp2->setVertexZ(300);
|
||||||
|
sp3->setVertexZ(200);
|
||||||
|
sp4->setVertexZ(100);
|
||||||
|
sp5->setVertexZ(0);
|
||||||
|
sp6->setVertexZ(-100);
|
||||||
|
sp7->setVertexZ(-200);
|
||||||
|
sp8->setVertexZ(-300);
|
||||||
|
sp9->setVertexZ(-400);
|
||||||
|
|
||||||
|
sp9->setScale(2);
|
||||||
|
sp9->setColor(ccYELLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
string RenderTextureZbuffer::title()
|
||||||
|
{
|
||||||
|
return "Testing Z Buffer in Render Texture";
|
||||||
|
}
|
||||||
|
|
||||||
|
string RenderTextureZbuffer::subtitle()
|
||||||
|
{
|
||||||
|
return "Touch screen. It should be green";
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTextureZbuffer::ccTouchesBegan(cocos2d::CCSet *touches, cocos2d::CCEvent *event)
|
||||||
|
{
|
||||||
|
CCSetIterator iter;
|
||||||
|
CCTouch *touch;
|
||||||
|
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
||||||
|
{
|
||||||
|
touch = (CCTouch *)(*iter);
|
||||||
|
CCPoint location = touch->locationInView(touch->view());
|
||||||
|
|
||||||
|
location = CCDirector::sharedDirector()->convertToGL(location);
|
||||||
|
sp1->setPosition(location);
|
||||||
|
sp2->setPosition(location);
|
||||||
|
sp3->setPosition(location);
|
||||||
|
sp4->setPosition(location);
|
||||||
|
sp5->setPosition(location);
|
||||||
|
sp6->setPosition(location);
|
||||||
|
sp7->setPosition(location);
|
||||||
|
sp8->setPosition(location);
|
||||||
|
sp9->setPosition(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTextureZbuffer::ccTouchesMoved(CCSet* touches, CCEvent* event)
|
||||||
|
{
|
||||||
|
CCSetIterator iter;
|
||||||
|
CCTouch *touch;
|
||||||
|
for (iter = touches->begin(); iter != touches->end(); ++iter)
|
||||||
|
{
|
||||||
|
touch = (CCTouch *)(*iter);
|
||||||
|
CCPoint location = touch->locationInView(touch->view());
|
||||||
|
|
||||||
|
location = CCDirector::sharedDirector()->convertToGL(location);
|
||||||
|
sp1->setPosition(location);
|
||||||
|
sp2->setPosition(location);
|
||||||
|
sp3->setPosition(location);
|
||||||
|
sp4->setPosition(location);
|
||||||
|
sp5->setPosition(location);
|
||||||
|
sp6->setPosition(location);
|
||||||
|
sp7->setPosition(location);
|
||||||
|
sp8->setPosition(location);
|
||||||
|
sp9->setPosition(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTextureZbuffer::ccTouchesEnded(CCSet* touches, CCEvent* event)
|
||||||
|
{
|
||||||
|
this->renderScreenShot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderTextureZbuffer::renderScreenShot()
|
||||||
|
{
|
||||||
|
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(512, 512);
|
||||||
|
texture->setAnchorPoint(ccp(0, 0));
|
||||||
|
texture->begin();
|
||||||
|
|
||||||
|
this->visit();
|
||||||
|
|
||||||
|
texture->end();
|
||||||
|
|
||||||
|
CCSprite *sprite = CCSprite::spriteWithTexture(texture->getSprite()->getTexture());
|
||||||
|
|
||||||
|
sprite->setPosition(ccp(256, 256));
|
||||||
|
sprite->setOpacity(182);
|
||||||
|
sprite->setFlipY(1);
|
||||||
|
this->addChild(sprite, 999999);
|
||||||
|
sprite->setColor(ccGREEN);
|
||||||
|
|
||||||
|
sprite->runAction(CCSequence::actions(CCFadeTo::actionWithDuration(2, 0),
|
||||||
|
CCHide::action(),
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,31 @@ public:
|
||||||
virtual void runThisTest();
|
virtual void runThisTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RenderTextureZbuffer : public RenderTextureTestDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RenderTextureZbuffer();
|
||||||
|
|
||||||
|
virtual void ccTouchesMoved(CCSet* touches, CCEvent* event);
|
||||||
|
virtual void ccTouchesBegan(CCSet* touches, CCEvent* event);
|
||||||
|
virtual void ccTouchesEnded(CCSet* touches, CCEvent* event);
|
||||||
|
virtual std::string title();
|
||||||
|
virtual std::string subtitle();
|
||||||
|
|
||||||
|
void renderScreenShot();
|
||||||
|
|
||||||
|
private:
|
||||||
|
cocos2d::CCSpriteBatchNode *mgr;;
|
||||||
|
|
||||||
|
cocos2d::CCSprite *sp1;
|
||||||
|
cocos2d::CCSprite *sp2;
|
||||||
|
cocos2d::CCSprite *sp3;
|
||||||
|
cocos2d::CCSprite *sp4;
|
||||||
|
cocos2d::CCSprite *sp5;
|
||||||
|
cocos2d::CCSprite *sp6;
|
||||||
|
cocos2d::CCSprite *sp7;
|
||||||
|
cocos2d::CCSprite *sp8;
|
||||||
|
cocos2d::CCSprite *sp9;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,10 @@ enum {
|
||||||
#define MAX_TESTS 8
|
#define MAX_TESTS 8
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
|
CCLayer* nextSchedulerTest();
|
||||||
|
CCLayer* backSchedulerTest();
|
||||||
|
CCLayer* restartSchedulerTest();
|
||||||
|
|
||||||
CCLayer* createSchedulerTest(int nIndex)
|
CCLayer* createSchedulerTest(int nIndex)
|
||||||
{
|
{
|
||||||
CCLayer* pLayer = NULL;
|
CCLayer* pLayer = NULL;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
a269232296e7dc61dea36f970051f49e0e3de527
|
3dfc0a1466d723c0efd4186440040fa78c875e13
|
|
@ -6,6 +6,10 @@ enum
|
||||||
kTagTileMap = 1,
|
kTagTileMap = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CCLayer* nextTileMapAction();
|
||||||
|
CCLayer* backTileMapAction();
|
||||||
|
CCLayer* restartTileMapAction();
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// TileMapTest
|
// TileMapTest
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
|
CCLayer* nextZwoptexTest();
|
||||||
|
CCLayer* backZwoptexTest();
|
||||||
|
CCLayer* restartZwoptexTest();
|
||||||
|
|
||||||
CCLayer* createZwoptexLayer(int nIndex)
|
CCLayer* createZwoptexLayer(int nIndex)
|
||||||
{
|
{
|
||||||
switch(nIndex)
|
switch(nIndex)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
eea7ee6d1eab766660efb216ab5fb16640957e75
|
Loading…
Reference in New Issue