Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into gles20

This commit is contained in:
walzer 2012-12-04 12:00:28 +08:00
commit a1b398fea1
255 changed files with 2943 additions and 7717 deletions

3
.gitignore vendored
View File

@ -47,8 +47,9 @@ local.properties
# Ignore python compiled files
*.pyc
# Ignore files build by airplay
# Ignore files build by airplay and marmalade
build_*_xcode/
build_*_vc10/
# Ignore files build by xcode
*.mode*v*

2
.gitmodules vendored
View File

@ -6,4 +6,4 @@
url = git://github.com/folecr/cocos2dx-autogen-bindings.git
[submodule "samples/TestJavascript/cocos2d-js-tests"]
path = samples/TestJavascript/cocos2d-js-tests
url = https://github.com/cocos2d/cocos2d-js-tests.git
url = https://github.com/minggo/cocos2d-js-tests.git

View File

@ -111,7 +111,7 @@ Developers:
Mat Hopwood( Marmalade official engineer )
Marmalade support for gles20 branch
Carlos Sessa
implement the accelerometer module for Android port
@ -149,6 +149,9 @@ Developers:
johnangel
OpenGL framebuffer access violation fix.
Peter Farkas (fape)
contributes Marmalade port for gles20 branch.
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,

View File

@ -86,10 +86,10 @@ namespace CocosDenshion
s_pEngine=0;
}
for( SoundFxMap::iterator it = g_pSoundFxMap->begin(); it!=g_pSoundFxMap->end(); it++ ) {
if( it->second.data != 0 ) free( it->second.data ) ;
}
if( g_pSoundFxMap ) {
for( SoundFxMap::iterator it = g_pSoundFxMap->begin(); it!=g_pSoundFxMap->end(); it++ )
if( it->second.data != 0 ) free( it->second.data ) ;
delete g_pSoundFxMap ;
g_pSoundFxMap = 0 ;
}

View File

@ -36,10 +36,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\TestLua\
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoonWarriors", "samples\MoonWarriors\proj.win32\MoonWarriors.vcxproj", "{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WatermelonWithMe", "samples\WatermelonWithMe\proj.win32\WatermelonWithMe.vcxproj", "{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CocosDragonJS", "samples\CocosDragonJS\proj.win32\CocosDragonJS.vcxproj", "{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}"
ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection
EndProject
Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution

View File

@ -406,6 +406,15 @@ bool CCCallFunc::initWithTarget(CCObject* pSelectorTarget) {
return true;
}
CCCallFunc::~CCCallFunc(void)
{
if (m_nScriptHandler)
{
cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(m_nScriptHandler);
}
CC_SAFE_RELEASE(m_pSelectorTarget);
}
CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL;

View File

@ -215,15 +215,12 @@ class CC_DLL CCCallFunc : public CCActionInstant //<NSCopying>
public:
CCCallFunc()
: m_pSelectorTarget(NULL)
, m_nScriptHandler(0)
, m_pCallFunc(NULL)
, m_nScriptHandler(0)
{
}
virtual ~CCCallFunc()
{
CC_SAFE_RELEASE(m_pSelectorTarget);
}
/** creates the action with the callback
virtual ~CCCallFunc();
/** creates the action with the callback
@deprecated: This interface will be deprecated sooner or later.
typedef void (CCObject::*SEL_CallFunc)();
*/

View File

@ -489,6 +489,8 @@ void CCNode::setGLServerState(ccGLServerState glServerState)
void CCNode::setUserObject(CCObject *pUserObject)
{
CC_SAFE_RELEASE(m_pUserObject);
CC_SAFE_RETAIN(pUserObject);
m_pUserObject = pUserObject;
}

View File

@ -276,7 +276,7 @@ public:
/** Similar to userData, but instead of holding a void* it holds an id */
virtual CCObject* getUserObject();
virtual void setUserObject(CCObject *pUserObject);
virtual void setUserObject(CCObject *pUserObject); //retain
/** Shader Program
@since v2.0

View File

@ -48,25 +48,25 @@ __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__) \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** arr = (__array__)->data->arr, **end = (__array__)->data->arr + (__array__)->data->num-1; \
arr <= end && (((__object__) = *arr) != NULL/* || true*/); \
arr++)
#define CCARRAY_FOREACH(__array__, __object__) \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** __arr__ = (__array__)->data->arr, **__end__ = (__array__)->data->arr + (__array__)->data->num-1; \
__arr__ <= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
__arr__++)
#define CCARRAY_FOREACH_REVERSE(__array__, __object__) \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** arr = (__array__)->data->arr + (__array__)->data->num-1, **end = (__array__)->data->arr; \
arr >= end && (((__object__) = *arr) != NULL/* || true*/); \
arr--)
#define CCARRAY_FOREACH_REVERSE(__array__, __object__) \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** __arr__ = (__array__)->data->arr + (__array__)->data->num-1, **__end__ = (__array__)->data->arr; \
__arr__ >= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
__arr__--)
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#define CCARRAY_VERIFY_TYPE(__array__, __type__) \
do { \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** arr = (__array__)->data->arr, \
**end = (__array__)->data->arr + (__array__)->data->num-1; arr <= end; arr++) \
CCAssert(dynamic_cast<__type__>(*arr), "element type is wrong!"); \
#define CCARRAY_VERIFY_TYPE(__array__, __type__) \
do { \
if ((__array__) && (__array__)->data->num > 0) \
for(CCObject** __arr__ = (__array__)->data->arr, \
**__end__ = (__array__)->data->arr + (__array__)->data->num-1; __arr__ <= __end__; __arr__++) \
CCAssert(dynamic_cast<__type__>(*__arr__), "element type is wrong!"); \
} while(false)
#else
#define CCARRAY_VERIFY_TYPE(__array__, __type__) void(0)

View File

@ -324,7 +324,7 @@ void CCDrawNode::drawPolygon(CCPoint *verts, unsigned int count, const ccColor4F
struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count);
memset(extrude, 0, sizeof(struct ExtrudeVerts)*count);
for(int i = 0; i < count; i++)
for(unsigned int i = 0; i < count; i++)
{
ccVertex2F v0 = __v2f(verts[(i-1+count)%count]);
ccVertex2F v1 = __v2f(verts[i]);
@ -348,7 +348,7 @@ void CCDrawNode::drawPolygon(CCPoint *verts, unsigned int count, const ccColor4F
ccV2F_C4B_T2F_Triangle *cursor = triangles;
float inset = (outline == 0.0 ? 0.5 : 0.0);
for(int i = 0; i < count-2; i++)
for(unsigned int i = 0; i < count-2; i++)
{
ccVertex2F v0 = v2fsub(__v2f(verts[0 ]), v2fmult(extrude[0 ].offset, inset));
ccVertex2F v1 = v2fsub(__v2f(verts[i+1]), v2fmult(extrude[i+1].offset, inset));
@ -363,7 +363,7 @@ void CCDrawNode::drawPolygon(CCPoint *verts, unsigned int count, const ccColor4F
*cursor++ = tmp;
}
for(int i = 0; i < count; i++)
for(unsigned int i = 0; i < count; i++)
{
int j = (i+1)%count;
ccVertex2F v0 = __v2f(verts[i]);

View File

@ -46,7 +46,9 @@ CCLayer::CCLayer()
: m_bTouchEnabled(false)
, m_bAccelerometerEnabled(false)
, m_bKeypadEnabled(false)
, m_pScriptHandlerEntry(NULL)
,m_pScriptTouchHandlerEntry(NULL)
,m_pScriptKeypadHandlerEntry(NULL)
,m_pScriptAccelerateHandlerEntry(NULL)
, m_eTouchMode(kCCTouchesAllAtOnce)
, m_nTouchPriority(0)
{
@ -57,6 +59,8 @@ CCLayer::CCLayer()
CCLayer::~CCLayer()
{
unregisterScriptTouchHandler();
unregisterScriptKeypadHandler();
unregisterScriptAccelerateHandler();
}
bool CCLayer::init()
@ -102,19 +106,19 @@ void CCLayer::registerWithTouchDispatcher()
CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();
// Using LuaBindings
if (m_pScriptHandlerEntry)
if (m_pScriptTouchHandlerEntry)
{
if (m_pScriptHandlerEntry->isMultiTouches())
if (m_pScriptTouchHandlerEntry->isMultiTouches())
{
pDispatcher->addStandardDelegate(this, 0);
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler());
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptTouchHandlerEntry->getHandler());
}
else
{
pDispatcher->addTargetedDelegate(this,
m_pScriptHandlerEntry->getPriority(),
m_pScriptHandlerEntry->getSwallowsTouches());
LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler());
m_pScriptTouchHandlerEntry->getPriority(),
m_pScriptTouchHandlerEntry->getSwallowsTouches());
LUALOG("[LUA] Add touch event handler: %d", m_pScriptTouchHandlerEntry->getHandler());
}
}
else
@ -130,13 +134,13 @@ void CCLayer::registerWithTouchDispatcher()
void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)
{
unregisterScriptTouchHandler();
m_pScriptHandlerEntry = CCTouchScriptHandlerEntry::create(nHandler, bIsMultiTouches, nPriority, bSwallowsTouches);
m_pScriptHandlerEntry->retain();
m_pScriptTouchHandlerEntry = CCTouchScriptHandlerEntry::create(nHandler, bIsMultiTouches, nPriority, bSwallowsTouches);
m_pScriptTouchHandlerEntry->retain();
}
void CCLayer::unregisterScriptTouchHandler(void)
{
CC_SAFE_RELEASE_NULL(m_pScriptHandlerEntry);
CC_SAFE_RELEASE_NULL(m_pScriptTouchHandlerEntry);
}
int CCLayer::excuteScriptTouchHandler(int nEventType, CCTouch *pTouch)
@ -262,6 +266,17 @@ void CCLayer::didAccelerate(CCAcceleration* pAccelerationValue)
}
}
void CCLayer::registerScriptAccelerateHandler(int nHandler)
{
unregisterScriptAccelerateHandler();
m_pScriptAccelerateHandlerEntry = CCScriptHandlerEntry::create(nHandler);
m_pScriptAccelerateHandlerEntry->retain();
}
void CCLayer::unregisterScriptAccelerateHandler(void)
{
CC_SAFE_RELEASE_NULL(m_pScriptAccelerateHandlerEntry);
}
/// isKeypadEnabled getter
bool CCLayer::isKeypadEnabled()
@ -290,6 +305,34 @@ void CCLayer::setKeypadEnabled(bool enabled)
}
}
void CCLayer::registerScriptKeypadHandler(int nHandler)
{
unregisterScriptKeypadHandler();
m_pScriptKeypadHandlerEntry = CCScriptHandlerEntry::create(nHandler);
m_pScriptKeypadHandlerEntry->retain();
}
void CCLayer::unregisterScriptKeypadHandler(void)
{
CC_SAFE_RELEASE_NULL(m_pScriptKeypadHandlerEntry);
}
void CCLayer::keyBackClicked(void)
{
if (m_pScriptKeypadHandlerEntry)
{
CCScriptEngineManager::sharedManager()->getScriptEngine()->executeLayerKeypadEvent(this, kTypeBackClicked);
}
}
void CCLayer::keyMenuClicked(void)
{
if (m_pScriptKeypadHandlerEntry)
{
CCScriptEngineManager::sharedManager()->getScriptEngine()->executeLayerKeypadEvent(this, kTypeMenuClicked);
}
}
/// Callbacks
void CCLayer::onEnter()
{
@ -929,6 +972,19 @@ CCLayerMultiplex* CCLayerMultiplex::create()
return pRet;
}
CCLayerMultiplex* CCLayerMultiplex::createWithArray(CCArray* arrayOfLayers)
{
CCLayerMultiplex* pRet = new CCLayerMultiplex();
if (pRet && pRet->initWithArray(arrayOfLayers))
{
pRet->autorelease();
}
else
{
CC_SAFE_DELETE(pRet);
}
return pRet;
}
void CCLayerMultiplex::addLayer(CCLayer* layer)
{
@ -938,23 +994,40 @@ void CCLayerMultiplex::addLayer(CCLayer* layer)
bool CCLayerMultiplex::initWithLayers(CCLayer *layer, va_list params)
{
m_pLayers = CCArray::createWithCapacity(5);
m_pLayers->retain();
if (CCLayer::init())
{
m_pLayers = CCArray::createWithCapacity(5);
m_pLayers->retain();
m_pLayers->addObject(layer);
m_pLayers->addObject(layer);
CCLayer *l = va_arg(params,CCLayer*);
while( l ) {
m_pLayers->addObject(l);
l = va_arg(params,CCLayer*);
}
CCLayer *l = va_arg(params,CCLayer*);
while( l ) {
m_pLayers->addObject(l);
l = va_arg(params,CCLayer*);
m_nEnabledLayer = 0;
this->addChild((CCNode*)m_pLayers->objectAtIndex(m_nEnabledLayer));
return true;
}
m_nEnabledLayer = 0;
this->addChild((CCNode*)m_pLayers->objectAtIndex(m_nEnabledLayer));
return true;
return false;
}
bool CCLayerMultiplex::initWithArray(CCArray* arrayOfLayers)
{
if (CCLayer::init())
{
m_pLayers = CCArray::createWithCapacity(arrayOfLayers->count());
m_pLayers->addObjectsFromArray(arrayOfLayers);
m_pLayers->retain();
m_nEnabledLayer = 0;
this->addChild((CCNode*)m_pLayers->objectAtIndex(m_nEnabledLayer));
return true;
}
return false;
}
void CCLayerMultiplex::switchTo(unsigned int n)
{

View File

@ -86,6 +86,8 @@ public:
virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
virtual void didAccelerate(CCAcceleration* pAccelerationValue);
void registerScriptAccelerateHandler(int nHandler);
void unregisterScriptAccelerateHandler(void);
/** If isTouchEnabled, this method is called onEnter. Override it to change the
way CCLayer receives touch events.
@ -133,8 +135,18 @@ public:
*/
virtual bool isKeypadEnabled();
virtual void setKeypadEnabled(bool value);
/** Register keypad events handler */
void registerScriptKeypadHandler(int nHandler);
/** Unregister keypad events handler */
void unregisterScriptKeypadHandler(void);
virtual void keyBackClicked(void);
virtual void keyMenuClicked(void);
inline CCTouchScriptHandlerEntry* getScriptHandlerEntry() { return m_pScriptHandlerEntry; };
inline CCTouchScriptHandlerEntry* getScriptTouchHandlerEntry() { return m_pScriptTouchHandlerEntry; };
inline CCScriptHandlerEntry* getScriptKeypadHandlerEntry() { return m_pScriptKeypadHandlerEntry; };
inline CCScriptHandlerEntry* getScriptAccelerateHandlerEntry() { return m_pScriptAccelerateHandlerEntry; };
protected:
bool m_bTouchEnabled;
bool m_bAccelerometerEnabled;
@ -142,7 +154,9 @@ protected:
private:
// Script touch events handler
CCTouchScriptHandlerEntry* m_pScriptHandlerEntry;
CCTouchScriptHandlerEntry* m_pScriptTouchHandlerEntry;
CCScriptHandlerEntry* m_pScriptKeypadHandlerEntry;
CCScriptHandlerEntry* m_pScriptAccelerateHandlerEntry;
int m_nTouchPriority;
ccTouchesMode m_eTouchMode;
@ -224,8 +238,7 @@ protected:
//
// CCLayerGradient
//
/** CCLayerGradient is a subclass of CCLayerColor that draws gradients across
the background.
/** @brief CCLayerGradient is a subclass of CCLayerColor that draws gradients across the background.
All features from CCLayerColor are valid, plus the following new features:
- direction
@ -338,6 +351,12 @@ public:
/** switches to a certain layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
*/
/** initializes a CCMultiplexLayer with an array of layers
@since v2.1
*/
bool initWithArray(CCArray* arrayOfLayers);
void switchTo(unsigned int n);
/** release the current layer and switches to another layer indexed by n.
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
@ -348,6 +367,10 @@ public:
static CCLayerMultiplex* node();
static CCLayerMultiplex* create();
/** creates a CCMultiplexLayer with an array of layers.
@since v2.1
*/
static CCLayerMultiplex* createWithArray(CCArray* arrayOfLayers);
};

View File

@ -29,6 +29,7 @@ THE SOFTWARE.
#include "touch_dispatcher/CCTouchDispatcher.h"
#include "touch_dispatcher/CCTouch.h"
#include "CCStdC.h"
#include "cocoa/CCInteger.h"
#include <vector>
#include <stdarg.h>
@ -37,6 +38,18 @@ using namespace std;
NS_CC_BEGIN
static std::vector<unsigned int> ccarray_to_std_vector(CCArray* pArray)
{
std::vector<unsigned int> ret;
CCObject* pObj;
CCARRAY_FOREACH(pArray, pObj)
{
CCInteger* pInteger = (CCInteger*)pObj;
ret.push_back((unsigned int)pInteger->getValue());
}
return ret;
}
enum
{
kDefaultPadding = 5,
@ -373,12 +386,18 @@ void CCMenu::alignItemsInColumns(unsigned int columns, ...)
void CCMenu::alignItemsInColumns(unsigned int columns, va_list args)
{
vector<unsigned int> rows;
CCArray* rows = CCArray::create();
while (columns)
{
rows.push_back(columns);
rows->addObject(CCInteger::create(columns));
columns = va_arg(args, unsigned int);
}
alignItemsInColumnsWithArray(rows);
}
void CCMenu::alignItemsInColumnsWithArray(CCArray* rowsArray)
{
vector<unsigned int> rows = ccarray_to_std_vector(rowsArray);
int height = -5;
unsigned int row = 0;
@ -478,12 +497,18 @@ void CCMenu::alignItemsInRows(unsigned int rows, ...)
void CCMenu::alignItemsInRows(unsigned int rows, va_list args)
{
vector<unsigned int> columns;
CCArray* pArray = CCArray::create();
while (rows)
{
columns.push_back(rows);
pArray->addObject(CCInteger::create(rows));
rows = va_arg(args, unsigned int);
}
alignItemsInRowsWithArray(pArray);
}
void CCMenu::alignItemsInRowsWithArray(CCArray* columnArray)
{
vector<unsigned int> columns = ccarray_to_std_vector(columnArray);
vector<unsigned int> columnWidths;
vector<unsigned int> columnHeights;

View File

@ -132,11 +132,12 @@ public:
/** align items in rows of columns */
void alignItemsInColumns(unsigned int columns, ...);
void alignItemsInColumns(unsigned int columns, va_list args);
void alignItemsInColumnsWithArray(CCArray *arrayOfNumbers);
void alignItemsInColumnsWithArray(CCArray* rows);
/** align items in columns of rows */
void alignItemsInRows(unsigned int rows, ...);
void alignItemsInRows(unsigned int rows, va_list args);
void alignItemsInRowsWithArray(CCArray* columns);
/** set event handler priority. By default it is: kCCMenuTouchPriority */
void setHandlerPriority(int newPriority);

View File

@ -904,8 +904,8 @@ CCMenuItemToggle* CCMenuItemToggle::create(CCMenuItem *item)
bool CCMenuItemToggle::initWithItem(CCMenuItem *item)
{
CCMenuItem::initWithTarget(NULL, NULL);
this->m_pSubItems = CCArray::create();
this->m_pSubItems->retain();
setSubItems(CCArray::create());
if (item) {
m_pSubItems->addObject(item);
}

View File

@ -327,16 +327,16 @@ void CCParticleSystemQuad::postStep()
glBindBuffer(GL_ARRAY_BUFFER, m_pBuffersVBO[0]);
// Option 1: Sub Data
// glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(quads_[0])*particleCount, quads_);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(m_pQuads[0])*m_uTotalParticles, m_pQuads);
// Option 2: Data
// glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * particleCount, quads_, GL_DYNAMIC_DRAW);
// Option 3: Orphaning + glMapBuffer
glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0])*m_uTotalParticles, NULL, GL_STREAM_DRAW);
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
memcpy(buf, m_pQuads, sizeof(m_pQuads[0])*m_uTotalParticles);
glUnmapBuffer(GL_ARRAY_BUFFER);
// glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0])*m_uTotalParticles, NULL, GL_STREAM_DRAW);
// void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
// memcpy(buf, m_pQuads, sizeof(m_pQuads[0])*m_uTotalParticles);
// glUnmapBuffer(GL_ARRAY_BUFFER);
glBindBuffer(GL_ARRAY_BUFFER, 0);

View File

@ -48,14 +48,13 @@ Config of cocos2d-x project, per target platform.
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
// mac
#if defined(TARGET_OS_MAC)
#if defined(CC_TARGET_OS_MAC)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC
//#define CC_SUPPORT_PVRTC
#endif
// iphone
#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
#if defined(CC_TARGET_OS_IPHONE)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#define CC_SUPPORT_PVRTC

View File

@ -116,9 +116,10 @@ public class Cocos2dxAccelerometer implements SensorEventListener {
final float tmp = x;
x = y;
y = -tmp;
}
Cocos2dxAccelerometer.onSensorChanged(x, y, z, pSensorEvent.timestamp);
}
Cocos2dxGLSurfaceView.queueAccelerometer(x,y,z,pSensorEvent.timestamp);
/*
if(BuildConfig.DEBUG) {
Log.d(TAG, "x = " + pSensorEvent.values[0] + " y = " + pSensorEvent.values[1] + " z = " + pSensorEvent.values[2]);
@ -132,9 +133,10 @@ public class Cocos2dxAccelerometer implements SensorEventListener {
// ===========================================================
// Methods
// Native method called from Cocos2dxGLSurfaceView (To be in the same thread)
// ===========================================================
private static native void onSensorChanged(final float pX, final float pY, final float pZ, final long pTimestamp);
public static native void onSensorChanged(final float pX, final float pY, final float pZ, final long pTimestamp);
// ===========================================================
// Inner and Anonymous Classes

View File

@ -117,6 +117,16 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
// Getter & Setter
// ===========================================================
public static void queueAccelerometer(final float x, final float y, final float z, final long timestamp) {
mCocos2dxGLSurfaceView.queueEvent(new Runnable() {
@Override
public void run() {
Cocos2dxAccelerometer.onSensorChanged(x, y, z, timestamp);
}
});
}
public void setCocos2dxRenderer(final Cocos2dxRenderer renderer) {
this.mCocos2dxRenderer = renderer;
this.setRenderer(this.mCocos2dxRenderer);

View File

@ -79,23 +79,32 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer {
@Override
public void onDrawFrame(final GL10 gl) {
/*
* FPS controlling algorithm is not accurate, and it will slow down FPS
* on some devices. So comment FPS controlling code.
*/
/*
final long nowInNanoSeconds = System.nanoTime();
final long interval = nowInNanoSeconds - this.mLastTickInNanoSeconds;
*/
// should render a frame when onDrawFrame() is called or there is a
// "ghost"
Cocos2dxRenderer.nativeRender();
/*
// fps controlling
if (interval < Cocos2dxRenderer.sAnimationInterval) {
try {
// because we render it before, so we should sleep twice time interval
Thread.sleep((Cocos2dxRenderer.sAnimationInterval - interval) * 2 / Cocos2dxRenderer.NANOSECONDSPERMICROSECOND);
Thread.sleep((Cocos2dxRenderer.sAnimationInterval - interval) / Cocos2dxRenderer.NANOSECONDSPERMICROSECOND);
} catch (final Exception e) {
}
}
this.mLastTickInNanoSeconds = nowInNanoSeconds;
*/
}
// ===========================================================

View File

@ -552,77 +552,77 @@ bool CCImage::initWithImageData(void * pData,
int nHeight,
int nBitsPerComponent)
{
bool bRet = false;
do
{
CC_BREAK_IF(! pData || nDataLen <= 0);
if (kFmtPng == eFmt)
{
bRet = _initWithPngData(pData, nDataLen);
break;
}
else if (kFmtJpg == eFmt)
{
bRet = _initWithJpgData(pData, nDataLen);
break;
}
else if (kFmtTiff == eFmt)
{
bRet = _initWithTiffData(pData, nDataLen);
break;
}
else if (kFmtRawData == eFmt)
{
bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent);
break;
}
else
{
// if it is a png file buffer.
if (nDataLen > 8)
{
unsigned char* pHead = (unsigned char*)pData;
if ( pHead[0] == 0x89
&& pHead[1] == 0x50
&& pHead[2] == 0x4E
&& pHead[3] == 0x47
&& pHead[4] == 0x0D
&& pHead[5] == 0x0A
&& pHead[6] == 0x1A
&& pHead[7] == 0x0A)
{
bRet = _initWithPngData(pData, nDataLen);
break;
}
}
// if it is a tiff file buffer.
if (nDataLen > 2)
{
unsigned char* pHead = (unsigned char*)pData;
if ( (pHead[0] == 0x49 && pHead[1] == 0x49)
|| (pHead[0] == 0x4d && pHead[1] == 0x4d)
)
{
bRet = _initWithTiffData(pData, nDataLen);
break;
}
}
// if it is a jpeg file buffer.
if (nDataLen > 2)
{
unsigned char* pHead = (unsigned char*)pData;
if ( pHead[0] == 0xff
&& pHead[1] == 0xd8)
{
bRet = _initWithJpgData(pData, nDataLen);
break;
}
}
}
} while (0);
bool bRet = false;
do
{
CC_BREAK_IF(! pData || nDataLen <= 0);
if (kFmtPng == eFmt)
{
bRet = _initWithPngData(pData, nDataLen);
break;
}
else if (kFmtJpg == eFmt)
{
bRet = _initWithJpgData(pData, nDataLen);
break;
}
else if (kFmtTiff == eFmt)
{
bRet = _initWithTiffData(pData, nDataLen);
break;
}
else if (kFmtRawData == eFmt)
{
bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent);
break;
}
else
{
// if it is a png file buffer.
if (nDataLen > 8)
{
unsigned char* pHead = (unsigned char*)pData;
if ( pHead[0] == 0x89
&& pHead[1] == 0x50
&& pHead[2] == 0x4E
&& pHead[3] == 0x47
&& pHead[4] == 0x0D
&& pHead[5] == 0x0A
&& pHead[6] == 0x1A
&& pHead[7] == 0x0A)
{
bRet = _initWithPngData(pData, nDataLen);
break;
}
}
// if it is a tiff file buffer.
if (nDataLen > 2)
{
unsigned char* pHead = (unsigned char*)pData;
if ( (pHead[0] == 0x49 && pHead[1] == 0x49)
|| (pHead[0] == 0x4d && pHead[1] == 0x4d)
)
{
bRet = _initWithTiffData(pData, nDataLen);
break;
}
}
// if it is a jpeg file buffer.
if (nDataLen > 2)
{
unsigned char* pHead = (unsigned char*)pData;
if ( pHead[0] == 0xff
&& pHead[1] == 0xd8)
{
bRet = _initWithJpgData(pData, nDataLen);
break;
}
}
}
} while (0);
return bRet;
}
@ -630,99 +630,84 @@ bool CCImage::_initWithJpgData(void * data, int nSize)
{
IW_CALLSTACK("CCImage::_initWithJpgData");
bool bRet = false;
/* these are standard libjpeg structures for reading(decompression) */
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
/* libjpeg data structure for storing one row, that is, scanline of an image */
JSAMPROW row_pointer[1] = {0};
unsigned long location = 0;
unsigned int i = 0;
s3eFile* pFile = s3eFileOpenFromMemory(data, nSize);
IwAssert(GAME, pFile);
jpeg_decompress_struct cinfo;
bzero(&cinfo, sizeof(cinfo));
JSAMPARRAY buffer; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
jpeg_source_mgr srcmgr;
srcmgr.bytes_in_buffer = nSize;
srcmgr.next_input_byte = (JOCTET*) data;
srcmgr.init_source = CCImageHelper::JPEGInitSource;
srcmgr.fill_input_buffer = CCImageHelper::JPEGFillInputBuffer;
srcmgr.skip_input_data = CCImageHelper::JPEGSkipInputData;
srcmgr.resync_to_restart = jpeg_resync_to_restart;
srcmgr.term_source = CCImageHelper::JPEGTermSource;
jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
cinfo.src = &srcmgr;
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
/* JSAMPLEs per row in output buffer */
row_stride = cinfo.output_width * cinfo.output_components;
/* Make a one-row-high sample array that will go away when done with image */
buffer = (*cinfo.mem->alloc_sarray)
((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
int copy_rows = (int)cinfo.output_height;
int copy_width = (int)cinfo.output_width;
if (copy_width < 0 || copy_rows < 0)
bool bRet = false;
do
{
printf("jpeg is fully off screen\n");
return bRet;
}
int startx=0;
int starty=0;
int bytesPerPix = 4;
m_pData = new unsigned char[copy_rows * copy_width * bytesPerPix];
memset(m_pData,0, copy_rows * copy_width * bytesPerPix);
// init image info
m_bPreMulti = false;
m_bHasAlpha = false;
m_nHeight = copy_rows;
m_nWidth = copy_width;
m_nBitsPerComponent = bytesPerPix;
unsigned char *dst = m_pData;
unsigned char *pData = m_pData;
/* here we set up the standard libjpeg error handler */
cinfo.err = jpeg_std_error( &jerr );
while (cinfo.output_scanline < cinfo.output_height)// count through the image
{
/* jpeg_read_scanlines expects an array of pointers to scanlines.
* Here the array is only one element long, but you could ask for
* more than one scanline at a time if that's more convenient.
*/
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
/* setup decompression process and source, then read JPEG header */
jpeg_create_decompress( &cinfo );
if (starty-- <= 0)// count down from start
{
if (copy_rows-- > 0)
jpeg_source_mgr srcmgr;
srcmgr.bytes_in_buffer = nSize;
srcmgr.next_input_byte = (JOCTET*) data;
srcmgr.init_source = CCImageHelper::JPEGInitSource;
srcmgr.fill_input_buffer = CCImageHelper::JPEGFillInputBuffer;
srcmgr.skip_input_data = CCImageHelper::JPEGSkipInputData;
srcmgr.resync_to_restart = jpeg_resync_to_restart;
srcmgr.term_source = CCImageHelper::JPEGTermSource;
cinfo.src = &srcmgr;
// jpeg_mem_src( &cinfo, (unsigned char *) data, nSize );
/* reading the image header which contains image information */
jpeg_read_header( &cinfo, true );
// we only support RGB or grayscale
if (cinfo.jpeg_color_space != JCS_RGB)
{
if (cinfo.jpeg_color_space == JCS_GRAYSCALE || cinfo.jpeg_color_space == JCS_YCbCr)
{
for (int xx=startx; xx < copy_width; xx++)
{
uint8 r = buffer[0][xx*3+0];
uint8 b = buffer[0][xx*3+1];
uint8 g = buffer[0][xx*3+2];
*dst++ = r;
*dst++ = b;
*dst++ = g;
*dst++ = 255;
}
}
cinfo.out_color_space = JCS_RGB;
}
}
else
{
break;
}
}
(void) jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
/* Start decompression jpeg here */
jpeg_start_decompress( &cinfo );
printf("jpeg display done\n");
/* init image info */
m_nWidth = (short)(cinfo.image_width);
m_nHeight = (short)(cinfo.image_height);
m_bHasAlpha = false;
m_bPreMulti = false;
m_nBitsPerComponent = 8;
row_pointer[0] = new unsigned char[cinfo.output_width*cinfo.output_components];
CC_BREAK_IF(! row_pointer[0]);
bRet = true;
m_pData = new unsigned char[cinfo.output_width*cinfo.output_height*cinfo.output_components];
CC_BREAK_IF(! m_pData);
/* now actually read the jpeg into the raw buffer */
/* read one scan line at a time */
while( cinfo.output_scanline < cinfo.image_height )
{
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
for( i=0; i<cinfo.image_width*cinfo.output_components;i++)
{
m_pData[location++] = row_pointer[0][i];
}
}
jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress(&cinfo);
/* wrap up decompression, destroy objects, free pointers and close open files */
bRet = true;
} while (0);
CC_SAFE_DELETE_ARRAY(row_pointer[0]);
return bRet;
}

View File

@ -202,7 +202,6 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="touch_dispatcher"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="extensions"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="draw_nodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="tilemap_parallax_nodes"/>
<entry excluding="actions|base_nodes|cocoa|effects|include|kazmath|keypad_dispatcher|label_nodes|layers_scenes_transitions_nodes|menu_nodes|misc_nodes|particle_nodes|platform|script_support|shaders|sprite_nodes|support|text_input_node|textures|touch_dispatcher|extensions|draw_nodes|physics_nodes|tilemap_parallax_nodes" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
</sourceEntries>

View File

@ -27,7 +27,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/cocos2dx/Device-Release}</value>
<value>${workspace_loc:/cocos2dx/Device-Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
@ -170,11 +170,6 @@
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/particle_nodes</locationURI>
</link>
<link>
<name>physics_nodes</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/physics_nodes</locationURI>
</link>
<link>
<name>platform</name>
<type>2</type>

View File

@ -1 +1 @@
2ca5fe7b3dd190dca76cc6d572d7c910f560e9ff
383f53716f968145973931b5833779c8a2538d31

View File

@ -1 +1 @@
f61d0702da9ebfc807e3d6c642620aed3cc774c4
ed68cc3391c67d68427d7fb8a7edbb9aa5a912cd

View File

@ -50,7 +50,6 @@ includepaths
"../textures"
"../tileMap_parallax_nodes"
"../touch_dispatcher"
"../../extensions"
}
files
@ -88,39 +87,7 @@ files
"*.h"
"*.cpp"
[extensions]
("../../extensions")
"*.h"
("../../extensions/CCBReader")
CCBReader.h
# CCBCustomClass.h
# CCBCustomClass.cpp
# CCBReader_v1.cpp
("../../extensions/GUI/CCControlExtension")
"*.h"
"*.cpp"
("../../extensions/GUI/CCEditBox")
# "CCEditBox.h"
# "CCEditBox.cpp"
("../../extensions/GUI/CCScrollView")
"*.h"
"*.cpp"
# ("../../extensions/CCListView")
# "*.h"
# "*.cpp"
("../support")
CCNotificationCenter.h
CCNotificationCenter.cpp
# "*.h"
# "*.cpp"
# ("../../extensions/CCTextureWatcher")
# "*.h"
# "*.cpp"
("../../extensions/physics_nodes")
"*.h"
"*.cpp"
("../include")
("../include")
[include]
"*.h"

View File

@ -29,6 +29,7 @@
#include "CCAccelerometer.h"
#include "touch_dispatcher/CCTouch.h"
#include "cocoa/CCSet.h"
#include "CCAccelerometer.h"
#include <map>
#include <string>
#include <list>
@ -226,6 +227,9 @@ public:
virtual int executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSet *pTouches) = 0;
virtual int executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch) = 0;
/** functions for keypad event */
virtual int executeLayerKeypadEvent(CCLayer* pLayer, int eventType) = 0;
/** execute a accelerometer event */
virtual int executeAccelerometerEvent(CCLayer* pLayer, CCAcceleration* pAccelerationValue) = 0;
};

View File

@ -33,10 +33,10 @@ bool CCBAnimationManager::init()
mNodeSequences = new CCDictionary();
mBaseValues = new CCDictionary();
mDocumentOutletNames = CCArray::create();
mDocumentOutletNodes = CCArray::create();
mDocumentCallbackNames = CCArray::create();
mDocumentCallbackNodes = CCArray::create();
mDocumentOutletNames = new CCArray();
mDocumentOutletNodes = new CCArray();
mDocumentCallbackNames = new CCArray();
mDocumentCallbackNodes = new CCArray();
mTarget = NULL;
mAnimationCompleteCallbackFunc = NULL;
@ -64,6 +64,12 @@ CCBAnimationManager::~CCBAnimationManager()
mSequences->release();
setRootNode(NULL);
setDelegate(NULL);
CC_SAFE_RELEASE(mDocumentOutletNames);
CC_SAFE_RELEASE(mDocumentOutletNodes);
CC_SAFE_RELEASE(mDocumentCallbackNames);
CC_SAFE_RELEASE(mDocumentCallbackNodes);
}
CCArray* CCBAnimationManager::getSequences()
@ -248,6 +254,9 @@ void CCBAnimationManager::moveAnimationsFromNode(CCNode* fromNode, CCNode* toNod
if(baseValue) {
mBaseValues->setObject(baseValue, (intptr_t)toNode);
mBaseValues->removeObjectForKey((intptr_t)fromNode);
fromNode->release();
toNode->retain();
}
// Move seqs
@ -255,6 +264,9 @@ void CCBAnimationManager::moveAnimationsFromNode(CCNode* fromNode, CCNode* toNod
if(seqs) {
mNodeSequences->setObject(seqs, (intptr_t)toNode);
mNodeSequences->removeObjectForKey((intptr_t)fromNode);
fromNode->release();
toNode->retain();
}
}
@ -413,12 +425,7 @@ void CCBAnimationManager::setAnimatedProperty(const char *pPropName, CCNode *pNo
}
else if (strcmp(pPropName, "visible") == 0)
{
bool x = (bool)pValue;
if(x) {
CCSequence::createWithTwoActions(CCDelayTime::create(fTweenDuration), CCShow::create());
} else {
CCSequence::createWithTwoActions(CCDelayTime::create(fTweenDuration), CCHide::create());
}
pNode->setVisible(NULL != pValue);
}
else
{
@ -547,7 +554,22 @@ void CCBAnimationManager::runAction(CCNode *pNode, CCBSequenceProperty *pSeqProp
}
}
void CCBAnimationManager::runAnimations(int nSeqId, float fTweenDuration)
void CCBAnimationManager::runAnimations(const char *pName, float fTweenDuration)
{
runAnimationsForSequenceNamedTweenDuration(pName, fTweenDuration);
}
void CCBAnimationManager::runAnimations(const char *pName)
{
runAnimationsForSequenceNamed(pName);
}
void CCBAnimationManager::runAnimations(int nSeqId, float fTweenDuraiton)
{
runAnimationsForSequenceIdTweenDuration(nSeqId, fTweenDuraiton);
}
void CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuration)
{
CCAssert(nSeqId != -1, "Sequence id couldn't be found");
@ -610,15 +632,15 @@ void CCBAnimationManager::runAnimations(int nSeqId, float fTweenDuration)
mRunningSequence = getSequence(nSeqId);
}
void CCBAnimationManager::runAnimations(const char *pName, float fTweenDuration)
void CCBAnimationManager::runAnimationsForSequenceNamedTweenDuration(const char *pName, float fTweenDuration)
{
int seqId = getSequenceId(pName);
runAnimations(seqId, fTweenDuration);
runAnimationsForSequenceIdTweenDuration(seqId, fTweenDuration);
}
void CCBAnimationManager::runAnimations(const char *pName)
void CCBAnimationManager::runAnimationsForSequenceNamed(const char *pName)
{
runAnimations(pName, 0);
runAnimationsForSequenceNamedTweenDuration(pName, 0);
}
void CCBAnimationManager::debug()
@ -662,7 +684,7 @@ void CCBAnimationManager::sequenceCompleted()
if (nextSeqId != -1)
{
runAnimations(nextSeqId, 0);
runAnimationsForSequenceIdTweenDuration(nextSeqId, 0);
}
}

View File

@ -86,9 +86,17 @@ public:
void setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName);
void moveAnimationsFromNode(CCNode* fromNode, CCNode* toNode);
void runAnimations(const char *pName, float fTweenDuration);
void runAnimations(const char *pName);
void runAnimations(int nSeqId, float fTweenDuraiton);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(const char *pName, float fTweenDuration);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(const char *pName);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(int nSeqId, float fTweenDuraiton);
void runAnimationsForSequenceNamedTweenDuration(const char *pName, float fTweenDuration);
void runAnimationsForSequenceNamed(const char *pName);
void runAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuraiton);
void setAnimationCompletedCallback(CCObject *target, SEL_CallFunc callbackFunc);
void debug();

View File

@ -6,8 +6,8 @@ NS_CC_EXT_BEGIN
#define PROPERTY_CCBFILE "ccbFile"
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CCBFILE) == 0) {
void CCBFileLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CCBFILE) == 0) {
((CCBFile*)pNode)->setCCBFileNode(pCCBFileNode);
} else {
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);

View File

@ -17,7 +17,7 @@ class CCBFileLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCBFile);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -6,7 +6,7 @@
NS_CC_EXT_BEGIN
#define CCB_MEMBERVARIABLEASSIGNER_GLUE(TARGET, MEMBERVARIABLENAME, MEMBERVARIABLETYPE, MEMBERVARIABLE) \
if (pTarget == TARGET && pMemberVariableName->compare(MEMBERVARIABLENAME) == 0) { \
if (pTarget == TARGET && 0 == strcmp(pMemberVariableName, (MEMBERVARIABLENAME))) { \
MEMBERVARIABLETYPE pOldVar = MEMBERVARIABLE; \
MEMBERVARIABLE = dynamic_cast<MEMBERVARIABLETYPE>(pNode); \
CC_ASSERT(MEMBERVARIABLE); \
@ -21,7 +21,7 @@ class CCBMemberVariableAssigner {
public:
virtual ~CCBMemberVariableAssigner() {};
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) = 0;
virtual bool onAssignCCBMemberVariable(CCObject* pTarget, const char* pMemberVariableName, CCNode* pNode) = 0;
};
NS_CC_EXT_END

View File

@ -66,12 +66,16 @@ CCBReader::CCBReader(CCNodeLoaderLibrary * pCCNodeLoaderLibrary, CCBMemberVariab
, mActionManager(NULL)
, mAnimatedProps(NULL)
, hasScriptingOwner(false)
, mActionManagers(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
{
this->mCCNodeLoaderLibrary = pCCNodeLoaderLibrary;
this->mCCNodeLoaderLibrary->retain();
this->mCCBMemberVariableAssigner = pCCBMemberVariableAssigner;
this->mCCBSelectorResolver = pCCBSelectorResolver;
this->mCCNodeLoaderListener = pCCNodeLoaderListener;
init();
}
CCBReader::CCBReader(CCBReader * pCCBReader)
@ -83,6 +87,9 @@ CCBReader::CCBReader(CCBReader * pCCBReader)
, mActionManager(NULL)
, mAnimatedProps(NULL)
, hasScriptingOwner(false)
, mActionManagers(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
{
this->mLoadedSpriteSheets = pCCBReader->mLoadedSpriteSheets;
this->mCCNodeLoaderLibrary = pCCBReader->mCCNodeLoaderLibrary;
@ -94,8 +101,11 @@ CCBReader::CCBReader(CCBReader * pCCBReader)
this->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames;
this->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes;
this->mOwnerCallbackNodes->retain();
this->mOwnerOutletNames = pCCBReader->mOwnerOutletNames;
this->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes;
this->mOwnerOutletNodes->retain();
init();
}
CCBReader::CCBReader()
@ -111,7 +121,12 @@ CCBReader::CCBReader()
, mCCBSelectorResolver(NULL)
, mAnimatedProps(NULL)
, hasScriptingOwner(false)
{}
, mActionManagers(NULL)
, mNodesWithAnimationManagers(NULL)
, mAnimationManagersForNodes(NULL)
{
init();
}
CCBReader::~CCBReader() {
CC_SAFE_RELEASE_NULL(mOwner);
@ -119,33 +134,39 @@ CCBReader::~CCBReader() {
this->mCCNodeLoaderLibrary->release();
mOwnerOutletNodes->release();
mOwnerOutletNames.clear();
mOwnerCallbackNodes->release();
mOwnerCallbackNames.clear();
// Clear string cache.
std::vector<CCString *>::iterator stringCacheIterator;
for (stringCacheIterator = this->mStringCache.begin(); stringCacheIterator != this->mStringCache.end(); stringCacheIterator++) {
(*stringCacheIterator)->release();
}
this->mStringCache.clear();
CC_SAFE_RELEASE(mNodesWithAnimationManagers);
CC_SAFE_RELEASE(mAnimationManagersForNodes);
setAnimationManager(NULL);
setAnimationManagers(NULL);
}
bool CCBReader::initWithData(CCData *pData, CCObject *pOwner)
void CCBReader::setCCBRootPath(const char* pCCBRootPath)
{
CCAssert(pCCBRootPath != NULL, "");
mCCBRootPath = pCCBRootPath;
}
const std::string& CCBReader::getCCBRootPath() const
{
return mCCBRootPath;
}
bool CCBReader::init()
{
// Setup action manager
CCBAnimationManager *pActionManager = new CCBAnimationManager();
setAnimationManager(pActionManager);
pActionManager->release();
// Setup byte array
mData = pData;
CC_SAFE_RETAIN(mData);
mBytes = mData->getBytes();
mCurrentByte = 0;
mCurrentBit = 0;
mOwner = pOwner;
CC_SAFE_RETAIN(mOwner);
// Setup resolution scale and container size
mActionManager->setRootContainerSize(CCDirector::sharedDirector()->getWinSize());
@ -164,6 +185,18 @@ void CCBReader::setAnimationManager(CCBAnimationManager *pAnimationManager)
CC_SAFE_RETAIN(mActionManager);
}
CCDictionary* CCBReader::getAnimationManagers()
{
return mActionManagers;
}
void CCBReader::setAnimationManagers(CCDictionary* x)
{
CC_SAFE_RELEASE(mActionManagers);
mActionManagers = x;
CC_SAFE_RETAIN(mActionManagers);
}
CCBMemberVariableAssigner * CCBReader::getCCBMemberVariableAssigner() {
return this->mCCBMemberVariableAssigner;
}
@ -197,25 +230,29 @@ CCNode* CCBReader::readNodeGraphFromFile(const char* pCCBFileName, CCObject* pOw
return this->readNodeGraphFromFile(pCCBFileName, pOwner, CCDirector::sharedDirector()->getWinSize());
}
CCNode * CCBReader::readNodeGraphFromFile(const char * pCCBFileName, CCObject *pOwner, const CCSize &parentSize)
CCNode* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize)
{
return this->readNodeGraphFromFile(pCCBFileName, pOwner, parentSize, NULL);
}
if (NULL == pCCBFileName || strlen(pCCBFileName) == 0)
{
return NULL;
}
CCNode* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, CCBAnimationManager **ppAnimationManager)
{
return this->readNodeGraphFromFile(pCCBFileName, pOwner, CCDirector::sharedDirector()->getWinSize(), ppAnimationManager);
}
std::string strCCBFileName(pCCBFileName);
std::string strSuffix(".ccbi");
// Add ccbi suffix
if (!CCBReader::endsWith(strCCBFileName.c_str(), strSuffix.c_str()))
{
strCCBFileName += strSuffix;
}
CCNode* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager)
{
const char *pPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pCCBFileName);
unsigned long size;
std::string strPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(strCCBFileName.c_str());
unsigned long size = 0;
unsigned char * pBytes = CCFileUtils::sharedFileUtils()->getFileData(pPath, "rb", &size);
unsigned char * pBytes = CCFileUtils::sharedFileUtils()->getFileData(strPath.c_str(), "rb", &size);
CCData *data = new CCData(pBytes, size);
CC_SAFE_DELETE_ARRAY(pBytes);
CCNode *ret = this->readNodeGraphFromData(data, pOwner, parentSize, ppAnimationManager);
CCNode *ret = this->readNodeGraphFromData(data, pOwner, parentSize);
data->release();
@ -224,46 +261,45 @@ CCNode* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOw
CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize)
{
return this->readNodeGraphFromData(pData, pOwner, parentSize, NULL);
}
mData = pData;
CC_SAFE_RETAIN(mData);
mBytes = mData->getBytes();
mCurrentByte = 0;
mCurrentBit = 0;
mOwner = pOwner;
CC_SAFE_RETAIN(mOwner);
CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager)
{
initWithData(pData, pOwner);
mActionManager->setRootContainerSize(parentSize);
mOwnerOutletNames = CCArray::create();
mOwnerOutletNodes = CCArray::create();
mOwnerCallbackNames = CCArray::create();
mOwnerCallbackNodes = CCArray::create();
mOwnerOutletNodes = new CCArray();
mOwnerCallbackNodes = new CCArray();
CCNode *pNodeGraph = readFileWithCleanUp(true);
CCDictionary* animationManagers = CCDictionary::create();
CCNode *pNodeGraph = readFileWithCleanUp(true, animationManagers);
if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1)
{
// Auto play animations
mActionManager->runAnimations(mActionManager->getAutoPlaySequenceId(), 0);
mActionManager->runAnimationsForSequenceIdTweenDuration(mActionManager->getAutoPlaySequenceId(), 0);
}
// Assign actionManagers to userObject
if(jsControlled) {
mNodesWithAnimationManagers = CCArray::create();
mAnimationManagerForNodes = CCArray::create();
mNodesWithAnimationManagers = new CCArray();
mAnimationManagersForNodes = new CCArray();
}
for(int i = 0; i < mAnimationManagers.size(); ++i) {
mAnimationManagers[i].first->setUserObject(mAnimationManagers[i].second);
if(jsControlled) {
mNodesWithAnimationManagers->addObject(mAnimationManagers[i].first);
mAnimationManagerForNodes->addObject(mAnimationManagers[i].second);
}
}
// Return action manager by reference
if (ppAnimationManager)
CCDictElement* pElement = NULL;
CCDICT_FOREACH(animationManagers, pElement)
{
*ppAnimationManager = mActionManager;
CCNode* pNode = (CCNode*)pElement->getIntKey();
CCBAnimationManager* manager = (CCBAnimationManager*)animationManagers->objectForKey((intptr_t)pNode);
pNode->setUserObject(manager);
if (jsControlled)
{
mNodesWithAnimationManagers->addObject(pNode);
mAnimationManagersForNodes->addObject(manager);
}
}
return pNodeGraph;
@ -281,21 +317,69 @@ CCScene* CCBReader::createSceneWithNodeGraphFromFile(const char *pCCBFileName, C
CCScene* CCBReader::createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize)
{
return createSceneWithNodeGraphFromFile(pCCBFileName, pOwner, parentSize, NULL);
}
CCScene* CCBReader::createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager)
{
CCNode *pNode = readNodeGraphFromFile(pCCBFileName, pOwner, parentSize, ppAnimationManager);
CCNode *pNode = readNodeGraphFromFile(pCCBFileName, pOwner, parentSize);
CCScene *pScene = CCScene::create();
pScene->addChild(pNode);
return pScene;
}
bool CCBReader::readHeader() {
/* If no bytes loaded, don't crash about it. */
if(this->mBytes == NULL) {
void CCBReader::cleanUpNodeGraph(CCNode *pNode)
{
pNode->setUserObject(NULL);
CCObject *pChild = NULL;
CCARRAY_FOREACH(pNode->getChildren(), pChild)
{
cleanUpNodeGraph((CCNode*)pChild);
}
}
CCNode* CCBReader::readFileWithCleanUp(bool bCleanUp, CCDictionary* am)
{
if (! readHeader())
{
return NULL;
}
if (! readStringCache())
{
return NULL;
}
if (! readSequences())
{
return NULL;
}
setAnimationManagers(am);
CCNode *pNode = readNodeGraph(NULL);
mActionManagers->setObject(mActionManager, intptr_t(pNode));
if (bCleanUp)
{
cleanUpNodeGraph(pNode);
}
return pNode;
}
bool CCBReader::readStringCache() {
int numStrings = this->readInt(false);
for(int i = 0; i < numStrings; i++) {
this->mStringCache.push_back(this->readUTF8());
}
return true;
}
bool CCBReader::readHeader()
{
/* If no bytes loaded, don't crash about it. */
if(this->mBytes == NULL) {
return false;
}
@ -314,76 +398,12 @@ bool CCBReader::readHeader() {
return false;
}
// Read JS check
jsControlled = this->readBool();
return true;
}
void CCBReader::cleanUpNodeGraph(CCNode *pNode)
{
pNode->setUserObject(NULL);
CCObject *pChild = NULL;
CCARRAY_FOREACH(pNode->getChildren(), pChild)
{
cleanUpNodeGraph((CCNode*)pChild);
}
}
CCNode* CCBReader::readFileWithCleanUp(bool bCleanUp)
{
if (! readHeader())
{
return NULL;
}
if (! readStringCache())
{
return NULL;
}
if (! readSequences())
{
return NULL;
}
CCNode *pNode = readNodeGraph();
mAnimationManagers.push_back(std::make_pair(pNode, mActionManager));
if (bCleanUp)
{
cleanUpNodeGraph(pNode);
}
return pNode;
}
bool CCBReader::readStringCache() {
int numStrings = this->readInt(false);
for(int i = 0; i < numStrings; i++) {
this->readStringCacheEntry();
}
return true;
}
void CCBReader::readStringCacheEntry() {
int b0 = this->readByte();
int b1 = this->readByte();
int numBytes = b0 << 8 | b1;
const unsigned char * src = (const unsigned char *) (this->mBytes + this->mCurrentByte);
CCString * string = CCString::createWithData(src, (unsigned long)numBytes);
string->retain();
this->mCurrentByte += numBytes;
this->mStringCache.push_back(string);
}
unsigned char CCBReader::readByte() {
unsigned char byte = this->mBytes[this->mCurrentByte];
this->mCurrentByte++;
@ -394,7 +414,54 @@ bool CCBReader::readBool() {
return 0 == this->readByte() ? false : true;
}
std::string CCBReader::readUTF8()
{
std::string ret;
int b0 = this->readByte();
int b1 = this->readByte();
int numBytes = b0 << 8 | b1;
char* pStr = (char*)malloc(numBytes+1);
memcpy(pStr, mBytes+mCurrentByte, numBytes);
pStr[numBytes] = '\0';
ret = pStr;
free(pStr);
mCurrentByte += numBytes;
return ret;
}
bool CCBReader::getBit() {
bool bit;
unsigned char byte = *(this->mBytes + this->mCurrentByte);
if(byte & (1 << this->mCurrentBit)) {
bit = true;
} else {
bit = false;
}
this->mCurrentBit++;
if(this->mCurrentBit >= 8) {
this->mCurrentBit = 0;
this->mCurrentByte++;
}
return bit;
}
void CCBReader::alignBits() {
if(this->mCurrentBit) {
this->mCurrentBit = 0;
this->mCurrentByte++;
}
}
int CCBReader::readInt(bool pSigned) {
// Read encoded int
int numBits = 0;
while(!this->getBit()) {
numBits++;
@ -441,54 +508,29 @@ float CCBReader::readFloat() {
case kCCBFloatInteger:
return (float)this->readInt(true);
default:
/* using a memcpy since the compiler isn't
* doing the float ptr math correctly on device.
* TODO still applies in C++ ? */
float * pF = (float*)(this->mBytes + this->mCurrentByte);
float f = 0;
memcpy(&f, pF, sizeof(float));
this->mCurrentByte += 4;
return f;
{
/* using a memcpy since the compiler isn't
* doing the float ptr math correctly on device.
* TODO still applies in C++ ? */
float * pF = (float*)(this->mBytes + this->mCurrentByte);
float f = 0;
memcpy(&f, pF, sizeof(float));
this->mCurrentByte += 4;
return f;
}
}
}
bool CCBReader::getBit() {
bool bit;
unsigned char byte = *(this->mBytes + this->mCurrentByte);
if(byte & (1 << this->mCurrentBit)) {
bit = true;
} else {
bit = false;
}
this->mCurrentBit++;
if(this->mCurrentBit >= 8) {
this->mCurrentBit = 0;
this->mCurrentByte++;
}
return bit;
}
void CCBReader::alignBits() {
if(this->mCurrentBit) {
this->mCurrentBit = 0;
this->mCurrentByte++;
}
}
CCString * CCBReader::readCachedString() {
int i = this->readInt(false);
return this->mStringCache[i];
std::string CCBReader::readCachedString() {
int n = this->readInt(false);
return this->mStringCache[n];
}
CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
/* Read class name. */
CCString * className = this->readCachedString();
std::string className = this->readCachedString();
CCString * jsControlledName;
std::string jsControlledName;
if(jsControlled) {
jsControlledName = this->readCachedString();
@ -496,15 +538,15 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
// Read assignment type and name
int memberVarAssignmentType = this->readInt(false);
CCString * memberVarAssignmentName;
std::string memberVarAssignmentName;
if(memberVarAssignmentType != kCCBTargetTypeNone) {
memberVarAssignmentName = this->readCachedString();
}
CCNodeLoader *ccNodeLoader = this->mCCNodeLoaderLibrary->getCCNodeLoader(className);
CCNodeLoader *ccNodeLoader = this->mCCNodeLoaderLibrary->getCCNodeLoader(className.c_str());
if (! ccNodeLoader)
{
CCLog("no corresponding node loader for %s", className->getCString());
CCLog("no corresponding node loader for %s", className.c_str());
return NULL;
}
@ -516,8 +558,10 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
mActionManager->setRootNode(node);
}
if(jsControlled && node == mActionManager->getRootNode()) {
mActionManager->setDocumentControllerName(jsControlledName->getCString());
// Assign controller
if(jsControlled && node == mActionManager->getRootNode())
{
mActionManager->setDocumentControllerName(jsControlledName);
}
// Read animated properties
@ -537,7 +581,7 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
CCBSequenceProperty *seqProp = new CCBSequenceProperty();
seqProp->autorelease();
seqProp->setName(readCachedString()->getCString());
seqProp->setName(readCachedString().c_str());
seqProp->setType(readInt(false));
mAnimatedProps->insert(seqProp->getName());
@ -609,19 +653,19 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) {
CCBMemberVariableAssigner * targetAsCCBMemberVariableAssigner = dynamic_cast<CCBMemberVariableAssigner *>(target);
if(targetAsCCBMemberVariableAssigner != NULL) {
assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName, node);
assigned = targetAsCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
if(!assigned && this->mCCBMemberVariableAssigner != NULL) {
this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName, node);
this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName.c_str(), node);
}
}
} else {
if(memberVarAssignmentType == kCCBTargetTypeDocumentRoot) {
mActionManager->addDocumentOutletName(memberVarAssignmentName->getCString());
mActionManager->addDocumentOutletName(memberVarAssignmentName);
mActionManager->addDocumentOutletNode(node);
} else {
mOwnerOutletNames->addObject(CCString::create(memberVarAssignmentName->getCString()));
mOwnerOutletNames.push_back(memberVarAssignmentName);
mOwnerOutletNodes->addObject(node);
}
}
@ -704,29 +748,31 @@ CCBKeyframe* CCBReader::readKeyframe(int type)
}
else if (type == kCCBPropTypeSpriteFrame)
{
CCString *spriteSheet = readCachedString();
CCString *spriteFile = readCachedString();
std::string spriteSheet = readCachedString();
std::string spriteFile = readCachedString();
CCSpriteFrame* spriteFrame;
CCString empty("");
if (spriteSheet->isEqual(&empty))
if (spriteSheet.length() == 0)
{
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile->getCString());
spriteFile = mCCBRootPath + spriteFile;
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile.c_str());
CCRect bounds = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height);
spriteFrame = CCSpriteFrame::createWithTexture(texture, bounds);
}
else
{
spriteSheet = mCCBRootPath + spriteSheet;
CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
// Load the sprite sheet only if it is not loaded
if (mLoadedSpriteSheets.find(spriteSheet->getCString()) == mLoadedSpriteSheets.end())
if (mLoadedSpriteSheets.find(spriteSheet) == mLoadedSpriteSheets.end())
{
frameCache->addSpriteFramesWithFile(spriteSheet->getCString());
mLoadedSpriteSheets.insert(spriteSheet->getCString());
frameCache->addSpriteFramesWithFile(spriteSheet.c_str());
mLoadedSpriteSheets.insert(spriteSheet);
}
spriteFrame = frameCache->spriteFrameByName(spriteFile->getCString());
spriteFrame = frameCache->spriteFrameByName(spriteFile.c_str());
}
value = spriteFrame;
}
@ -752,7 +798,7 @@ bool CCBReader::readSequences()
seq->autorelease();
seq->setDuration(readFloat());
seq->setName(readCachedString()->getCString());
seq->setName(readCachedString().c_str());
seq->setSequenceId(readInt(false));
seq->setChainedSequenceId(readInt(true));
@ -763,46 +809,33 @@ bool CCBReader::readSequences()
return true;
}
CCString * CCBReader::lastPathComponent(CCString * pPath) {
std::string path(pPath->getCString());
std::string CCBReader::lastPathComponent(const char* pPath) {
std::string path(pPath);
int slashPos = path.find_last_of("/");
if(slashPos != std::string::npos) {
return CCString::create(path.substr(slashPos + 1, path.length() - slashPos).c_str());
return path.substr(slashPos + 1, path.length() - slashPos);
}
return CCString::create(path.c_str());
return path;
}
CCString * CCBReader::deletePathExtension(CCString * pPath) {
std::string path(pPath->getCString());
std::string CCBReader::deletePathExtension(const char* pPath) {
std::string path(pPath);
int dotPos = path.find_last_of(".");
if(dotPos != std::string::npos) {
return CCString::create(path.substr(0, dotPos).c_str());
return path.substr(0, dotPos);
}
return CCString::create(path.c_str());
return path;
}
CCString * CCBReader::toLowerCase(CCString * pString) {
std::string copy(pString->getCString());
std::string CCBReader::toLowerCase(const char* pString) {
std::string copy(pString);
std::transform(copy.begin(), copy.end(), copy.begin(), ::tolower);
return CCString::create(copy.c_str());
return copy;
}
CCString * CCBReader::concat(CCString * pStringA, CCString * pStringB) {
int concatenatedLength = pStringA->length() + pStringB->length();
char* concatenated = (char*) malloc(concatenatedLength+1);
CCString* pRet = NULL;
strcpy(concatenated, pStringA->getCString());
strcat(concatenated, pStringB->getCString());
concatenated[concatenatedLength] = '\0';
pRet = CCString::create(concatenated);
CC_SAFE_FREE(concatenated);
return pRet;
}
bool CCBReader::endsWith(CCString * pString, CCString * pEnding) {
std::string string(pString->getCString());
std::string ending(pEnding->getCString());
bool CCBReader::endsWith(const char* pString, const char* pEnding) {
std::string string(pString);
std::string ending(pEnding);
if(string.length() >= ending.length()) {
return (string.compare(string.length() - ending.length(), ending.length(), ending) == 0);
} else {
@ -815,7 +848,7 @@ bool CCBReader::isJSControlled() {
}
void CCBReader::addOwnerCallbackName(std::string name) {
mOwnerCallbackNames->addObject(CCString::create(name));
mOwnerCallbackNames.push_back(name);
}
void CCBReader::addOwnerCallbackNode(CCNode *node) {
@ -833,7 +866,14 @@ void CCBReader::addDocumentCallbackNode(CCNode *node) {
CCArray* CCBReader::getOwnerCallbackNames() {
return mOwnerCallbackNames;
CCArray* pRet = CCArray::createWithCapacity(mOwnerCallbackNames.size());
std::vector<std::string>::iterator it = mOwnerCallbackNames.begin();
for (; it != mOwnerCallbackNames.end(); ++it)
{
pRet->addObject(CCString::create(*it));
}
return pRet;
}
CCArray* CCBReader::getOwnerCallbackNodes() {
@ -841,7 +881,13 @@ CCArray* CCBReader::getOwnerCallbackNodes() {
}
CCArray* CCBReader::getOwnerOutletNames() {
return mOwnerOutletNames;
CCArray* pRet = CCArray::createWithCapacity(mOwnerOutletNames.size());
std::vector<std::string>::iterator it = mOwnerOutletNames.begin();
for (; it != mOwnerOutletNames.end(); ++it)
{
pRet->addObject(CCString::create(*it));
}
return pRet;
}
CCArray* CCBReader::getOwnerOutletNodes() {
@ -853,15 +899,7 @@ CCArray* CCBReader::getNodesWithAnimationManagers() {
}
CCArray* CCBReader::getAnimationManagersForNodes() {
return mAnimationManagerForNodes;
}
std::vector<std::pair<CCNode *, CCBAnimationManager *> > CCBReader::getAnimationManagers() {
return mAnimationManagers;
}
void CCBReader::setAnimationManagers(std::vector<std::pair<CCNode *, CCBAnimationManager *> > x) {
mAnimationManagers = x;
return mAnimationManagersForNodes;
}
/************************************************************************

View File

@ -173,14 +173,14 @@ private:
int mCurrentByte;
int mCurrentBit;
std::vector<CCString *> mStringCache;
std::vector<std::string> mStringCache;
std::set<std::string> mLoadedSpriteSheets;
CCObject *mOwner;
CCBAnimationManager *mActionManager;
CCBAnimationManager *mActionManager; //retain
CCDictionary* mActionManagers;
std::vector<std::pair<CCNode*, CCBAnimationManager *> > mAnimationManagers;
std::set<std::string> *mAnimatedProps;
CCNodeLoaderLibrary *mCCNodeLoaderLibrary;
@ -188,37 +188,33 @@ private:
CCBMemberVariableAssigner *mCCBMemberVariableAssigner;
CCBSelectorResolver *mCCBSelectorResolver;
CCArray* mOwnerOutletNames;
std::vector<std::string> mOwnerOutletNames;
CCArray* mOwnerOutletNodes;
CCArray* mNodesWithAnimationManagers;
CCArray* mAnimationManagerForNodes;
CCArray* mAnimationManagersForNodes;
CCArray* mOwnerCallbackNames;
std::vector<std::string> mOwnerCallbackNames;
CCArray* mOwnerCallbackNodes;
std::string mCCBRootPath;
bool init();
public:
CCBReader(CCNodeLoaderLibrary *pCCNodeLoaderLibrary, CCBMemberVariableAssigner *pCCBMemberVariableAssigner = NULL, CCBSelectorResolver *pCCBSelectorResolver = NULL, CCNodeLoaderListener *pCCNodeLoaderListener = NULL);
CCBReader(CCBReader *pCCBReader);
virtual ~CCBReader();
CCBReader();
bool initWithData(CCData *pData, CCObject *pOwner);
void setCCBRootPath(const char* pCCBRootPath);
const std::string& getCCBRootPath() const;
CCNode* readNodeGraphFromFile(const char *pCCBFileName);
CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner);
CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize);
CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, CCBAnimationManager **ppAnimationManager);
CCNode* readNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager);
CCNode* readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager);
CCNode* readNodeGraphFromData(CCData *pData, CCObject *pOwner, const CCSize &parentSize);
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName);
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner);
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize);
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, CCBAnimationManager **ppAnimationManager);
CCScene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, CCObject *pOwner, const CCSize &parentSize, CCBAnimationManager **ppAnimationManager);
CCBMemberVariableAssigner* getCCBMemberVariableAssigner();
CCBSelectorResolver* getCCBSelectorResolver();
@ -232,30 +228,30 @@ public:
CCObject* getOwner();
/* Utility methods. */
static CCString* lastPathComponent(CCString * pString);
static CCString* deletePathExtension(CCString * pString);
static CCString* toLowerCase(CCString * pCCString);
static bool endsWith(CCString * pString, CCString * pEnding);
static CCString* concat(CCString * pStringA, CCString * pStringB);
static std::string lastPathComponent(const char* pString);
static std::string deletePathExtension(const char* pString);
static std::string toLowerCase(const char* pCCString);
static bool endsWith(const char* pString, const char* pEnding);
/* Parse methods. */
int readInt(bool pSigned);
unsigned char readByte();
bool readBool();
std::string readUTF8();
float readFloat();
CCString* readCachedString();
std::string readCachedString();
bool isJSControlled();
CCArray *getOwnerCallbackNames();
CCArray *getOwnerCallbackNodes();
CCArray* getOwnerCallbackNames();
CCArray* getOwnerCallbackNodes();
CCArray* getOwnerOutletNames();
CCArray* getOwnerOutletNodes();
CCArray* getNodesWithAnimationManagers();
CCArray* getAnimationManagersForNodes();
std::vector<std::pair<CCNode *, CCBAnimationManager *> > getAnimationManagers();
void setAnimationManagers(std::vector<std::pair<CCNode *, CCBAnimationManager *> > x);
CCDictionary* getAnimationManagers();
void setAnimationManagers(CCDictionary* x);
void addOwnerCallbackName(std::string name);
void addOwnerCallbackNode(CCNode *node);
@ -265,7 +261,7 @@ public:
static float getResolutionScale();
CCNode* readFileWithCleanUp(bool bCleanUp);
CCNode* readFileWithCleanUp(bool bCleanUp, CCDictionary* am);
bool hasScriptingOwner;
private:
@ -275,14 +271,14 @@ private:
bool readHeader();
bool readStringCache();
void readStringCacheEntry();
//void readStringCacheEntry();
CCNode* readNodeGraph();
CCNode* readNodeGraph(CCNode * pParent);
bool getBit();
void alignBits();
CCString* readUTF8();
friend class CCNodeLoader;
};
// end of effects group

View File

@ -8,20 +8,20 @@
NS_CC_EXT_BEGIN
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && strcmp(pSelectorName, SELECTORNAME) == 0) { \
return menu_selector(METHOD); \
}
#define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \
#define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && strcmp(pSelectorName, SELECTORNAME) == 0) { \
return cccontrol_selector(METHOD); \
}
class CCBSelectorResolver {
public:
virtual ~CCBSelectorResolver() {};
virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, const char* pSelectorName) = 0;
virtual SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
virtual SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, const char* pSelectorName) = 0;
};

View File

@ -22,76 +22,76 @@ NS_CC_EXT_BEGIN;
#define PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED "backgroundSpriteFrame|2"
#define PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED "backgroundSpriteFrame|3"
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ZOOMONTOUCHDOWN) == 0) {
void CCControlButtonLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ZOOMONTOUCHDOWN) == 0) {
((CCControlButton *)pNode)->setZoomOnTouchDown(pCheck);
} else {
CCControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLE_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLE_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLE_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleForState(pString, CCControlStateDisabled);
void CCControlButtonLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLE_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleForState(CCString::create(pString), CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleForState(CCString::create(pString), CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleForState(CCString::create(pString), CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLETTF_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLETTF_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF->getCString(), CCControlStateDisabled);
void CCControlButtonLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTF_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateNormal);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateHighlighted);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFForState(pFontTTF, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_LABELANCHORPOINT) == 0) {
void CCControlButtonLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_LABELANCHORPOINT) == 0) {
((CCControlButton *)pNode)->setLabelAnchorPoint(pPoint);
} else {
CCControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_PREFEREDSIZE) == 0) {
void CCControlButtonLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((CCControlButton *)pNode)->setPreferredSize(pSize);
} else {
CCControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
}
}
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateNormal);
}
} else if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateHighlighted);
}
} else if(pPropertyName->compare(PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
if(pCCSpriteFrame != NULL) {
((CCControlButton *)pNode)->setBackgroundSpriteFrameForState(pCCSpriteFrame, CCControlStateDisabled);
}
@ -100,12 +100,12 @@ void CCControlButtonLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode *
}
}
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TITLECOLOR_NORMAL) == 0) {
void CCControlButtonLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_NORMAL) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateNormal);
} else if(pPropertyName->compare(PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateHighlighted);
} else if(pPropertyName->compare(PROPERTY_TITLECOLOR_DISABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_DISABLED) == 0) {
((CCControlButton *)pNode)->setTitleColorForState(pCCColor3B, CCControlStateDisabled);
} else {
CCControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);

View File

@ -17,14 +17,14 @@ class CCControlButtonLoader : public CCControlLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCControlButton);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -7,18 +7,18 @@ NS_CC_EXT_BEGIN
#define PROPERTY_SELECTED "selected"
#define PROPERTY_CCCONTROL "ccControl"
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ENABLED) == 0) {
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
((CCControl *)pNode)->setEnabled(pCheck);
} else if(pPropertyName->compare(PROPERTY_SELECTED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
((CCControl *)pNode)->setSelected(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CCCONTROL) == 0) {
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
((CCControl *)pNode)->addTargetWithActionForControlEvents(pBlockCCControlData->mTarget, pBlockCCControlData->mSELCCControlHandler, pBlockCCControlData->mControlEvents);
} else {
CCNodeLoader::onHandlePropTypeBlockCCControl(pNode, pParent, pPropertyName, pBlockCCControlData, pCCBReader);

View File

@ -16,8 +16,8 @@ class CCControlLoader : public CCNodeLoader {
protected:
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCControl);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -3,9 +3,11 @@
NS_CC_EXT_BEGIN
CCData::CCData(unsigned char *pBytes, const unsigned long nSize)
: m_pBytes(pBytes)
, m_nSize(nSize)
{}
{
m_nSize = nSize;
m_pBytes = new unsigned char[m_nSize];
memcpy(m_pBytes, pBytes, m_nSize);
}
CCData::CCData(CCData *pData)
{

View File

@ -10,41 +10,41 @@ NS_CC_EXT_BEGIN
#define PROPERTY_FNTFILE "fntFile"
#define PROPERTY_STRING "string"
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((CCLabelBMFont *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((CCLabelBMFont *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCLabelBMFontLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCLabelBMFont *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FNTFILE) == 0) {
((CCLabelBMFont *)pNode)->setFntFile(pFntFile->getCString());
void CCLabelBMFontLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
((CCLabelBMFont *)pNode)->setFntFile(pFntFile);
} else {
CCNodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, pCCBReader);
}
}
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STRING) == 0) {
((CCLabelBMFont *)pNode)->setString(pText->getCString());
void CCLabelBMFontLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char* pText, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((CCLabelBMFont *)pNode)->setString(pText);
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}

View File

@ -16,11 +16,11 @@ class CCLabelBMFontLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLabelBMFont);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char* pText, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -14,66 +14,66 @@
NS_CC_EXT_BEGIN
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
void CCLabelTTFLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((CCLabelTTF *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
void CCLabelTTFLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((CCLabelTTF *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCLabelTTFLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCLabelTTF *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FONTNAME) == 0) {
((CCLabelTTF *)pNode)->setFontName(pFontTTF->getCString());
void CCLabelTTFLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
((CCLabelTTF *)pNode)->setFontName(pFontTTF);
} else {
CCNodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STRING) == 0) {
((CCLabelTTF *)pNode)->setString(pText->getCString());
void CCLabelTTFLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((CCLabelTTF *)pNode)->setString(pText);
} else {
CCNodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FONTSIZE) == 0) {
void CCLabelTTFLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) {
((CCLabelTTF *)pNode)->setFontSize(pFloatScale);
} else {
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_HORIZONTALALIGNMENT) == 0) {
void CCLabelTTFLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
((CCLabelTTF *)pNode)->setHorizontalAlignment(CCTextAlignment(pIntegerLabeled));
} else if(pPropertyName->compare(PROPERTY_VERTICALALIGNMENT) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
((CCLabelTTF *)pNode)->setVerticalAlignment(CCVerticalTextAlignment(pIntegerLabeled));
} else {
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
}
}
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_DIMENSIONS) == 0) {
void CCLabelTTFLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_DIMENSIONS) == 0) {
((CCLabelTTF *)pNode)->setDimensions(pSize);
} else {
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);

View File

@ -16,14 +16,14 @@ class CCLabelTTFLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLabelTTF);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char * pPropertyName, const char * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -8,24 +8,24 @@ NS_CC_EXT_BEGIN
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
void CCLayerColorLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((CCLayerColor *)pNode)->setColor(pCCColor3B);
} else {
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
void CCLayerColorLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((CCLayerColor *)pNode)->setOpacity(pByte);
} else {
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCLayerColorLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCLayerColor *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);

View File

@ -16,9 +16,9 @@ class CCLayerColorLoader : public CCLayerLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayerColor);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -11,28 +11,28 @@
NS_CC_EXT_BEGIN
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
void CCLayerGradientLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((CCLayerGradient *)pNode)->setStartColor(pCCColor3B);
} else if(pPropertyName->compare(PROPERTY_ENDCOLOR) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
((CCLayerGradient *)pNode)->setEndColor(pCCColor3B);
} else {
CCLayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTOPACITY) == 0) {
void CCLayerGradientLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTOPACITY) == 0) {
((CCLayerGradient *)pNode)->setStartOpacity(pByte);
} else if(pPropertyName->compare(PROPERTY_ENDOPACITY) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDOPACITY) == 0) {
((CCLayerGradient *)pNode)->setEndOpacity(pByte);
} else {
CCLayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCLayerGradient *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCLayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
@ -40,8 +40,8 @@ void CCLayerGradientLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * p
}
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_VECTOR) == 0) {
void CCLayerGradientLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_VECTOR) == 0) {
((CCLayerGradient *)pNode)->setVector(pPoint);
// TODO Not passed along the ccbi file.

View File

@ -16,10 +16,10 @@ class CCLayerGradientLoader : public CCLayerLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayerGradient);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -10,15 +10,15 @@
NS_CC_EXT_BEGIN
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TOUCH_ENABLED) == 0) {
void CCLayerLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
((CCLayer *)pNode)->setTouchEnabled(pCheck);
} else if(pPropertyName->compare(PROPERTY_ACCELEROMETER_ENABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
((CCLayer *)pNode)->setAccelerometerEnabled(pCheck);
} else if(pPropertyName->compare(PROPERTY_MOUSE_ENABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
// TODO XXX
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);
} else if(pPropertyName->compare(PROPERTY_KEYBOARD_ENABLED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_KEYBOARD_ENABLED) == 0) {
// TODO XXX
CCLOG("The property '%s' is not supported!", PROPERTY_KEYBOARD_ENABLED);
// This comes closest: ((CCLayer *)pNode)->setKeypadEnabled(pCheck);

View File

@ -16,7 +16,7 @@ class CCLayerLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCLayer);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -8,16 +8,16 @@
NS_CC_EXT_BEGIN
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setNormalSpriteFrame(pCCSpriteFrame);
}
} else if(pPropertyName->compare(PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setSelectedSpriteFrame(pCCSpriteFrame);
}
} else if(pPropertyName->compare(PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
if(pCCSpriteFrame != NULL) {
((CCMenuItemImage *)pNode)->setDisabledSpriteFrame(pCCSpriteFrame);
}

View File

@ -16,7 +16,7 @@ class CCMenuItemImageLoader : public CCMenuItemLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCMenuItemImage);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -7,8 +7,8 @@
NS_CC_EXT_BEGIN
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLOCK) == 0) {
void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
if (NULL != pBlockData) // Add this condition to allow CCMenuItemImage without target/selector predefined
{
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
@ -18,8 +18,8 @@ void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, C
}
}
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ISENABLED) == 0) {
void CCMenuItemLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
((CCMenuItem *)pNode)->setEnabled(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);

View File

@ -15,8 +15,8 @@ class CCMenuItemLoader : public CCNodeLoader {
protected:
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCMenuItem);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -25,7 +25,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
for(int i = 0; i < propertyCount; i++) {
bool isExtraProp = (i >= numRegularProps);
int type = pCCBReader->readInt(false);
CCString * propertyName = pCCBReader->readCachedString();
std::string propertyName = pCCBReader->readCachedString();
// Check if the property can be set for this platform
bool setProp = false;
@ -35,17 +35,20 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
{
setProp = true;
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Cocos2d-x is using touch event callback for all platforms,
// it's different from cocos2d-iphone which uses mouse event for Mac port.
// So we just need to touch event by using kCCBPlatformIOS.
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if(platform == kCCBPlatformIOS)
{
setProp = true;
}
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
if(platform == kCCBPlatformMac)
{
setProp = true;
}
#endif
// #elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
// if(platform == kCCBPlatformMac)
// {
// setProp = true;
// }
// #endif
// Forward properties for sub ccb files
if (dynamic_cast<CCBFile*>(pNode) != NULL)
@ -57,7 +60,18 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
// Skip properties that doesn't have a value to override
CCArray *extraPropsNames = (CCArray*)pNode->getUserObject();
setProp &= extraPropsNames->containsObject(propertyName);
CCObject* pObj = NULL;
bool bFound = false;
CCARRAY_FOREACH(extraPropsNames, pObj)
{
CCString* pStr = (CCString*)pObj;
if (0 == pStr->compare(propertyName.c_str()))
{
bFound = true;
break;
}
}
setProp &= bFound;
}
}
else if (isExtraProp && pNode == pCCBReader->getAnimationManager()->getRootNode())
@ -69,17 +83,17 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
pNode->setUserObject(extraPropsNames);
}
extraPropsNames->addObject(propertyName);
extraPropsNames->addObject(CCString::create(propertyName));
}
switch(type)
{
case kCCBPropTypePosition:
{
CCPoint position = this->parsePropTypePosition(pNode, pParent, pCCBReader, propertyName->getCString());
CCPoint position = this->parsePropTypePosition(pNode, pParent, pCCBReader, propertyName.c_str());
if (setProp)
{
this->onHandlePropTypePosition(pNode, pParent, propertyName, position, pCCBReader);
this->onHandlePropTypePosition(pNode, pParent, propertyName.c_str(), position, pCCBReader);
}
break;
}
@ -88,7 +102,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
CCPoint point = this->parsePropTypePoint(pNode, pParent, pCCBReader);
if (setProp)
{
this->onHandlePropTypePoint(pNode, pParent, propertyName, point, pCCBReader);
this->onHandlePropTypePoint(pNode, pParent, propertyName.c_str(), point, pCCBReader);
}
break;
}
@ -97,23 +111,23 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
CCPoint pointLock = this->parsePropTypePointLock(pNode, pParent, pCCBReader);
if (setProp)
{
this->onHandlePropTypePointLock(pNode, pParent, propertyName, pointLock, pCCBReader);
this->onHandlePropTypePointLock(pNode, pParent, propertyName.c_str(), pointLock, pCCBReader);
}
break;
}
case kCCBPropTypeSize: {
CCSize size = this->parsePropTypeSize(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeSize(pNode, pParent, propertyName, size, pCCBReader);
this->onHandlePropTypeSize(pNode, pParent, propertyName.c_str(), size, pCCBReader);
}
break;
}
case kCCBPropTypeScaleLock:
{
float * scaleLock = this->parsePropTypeScaleLock(pNode, pParent, pCCBReader, propertyName->getCString());
float * scaleLock = this->parsePropTypeScaleLock(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeScaleLock(pNode, pParent, propertyName, scaleLock, pCCBReader);
this->onHandlePropTypeScaleLock(pNode, pParent, propertyName.c_str(), scaleLock, pCCBReader);
}
CC_SAFE_DELETE_ARRAY(scaleLock);
break;
@ -123,16 +137,16 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
float f = this->parsePropTypeFloat(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeFloat(pNode, pParent, propertyName, f, pCCBReader);
this->onHandlePropTypeFloat(pNode, pParent, propertyName.c_str(), f, pCCBReader);
}
break;
}
case kCCBPropTypeDegrees:
{
float degrees = this->parsePropTypeDegrees(pNode, pParent, pCCBReader, propertyName->getCString());
float degrees = this->parsePropTypeDegrees(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeDegrees(pNode, pParent, propertyName, degrees, pCCBReader);
this->onHandlePropTypeDegrees(pNode, pParent, propertyName.c_str(), degrees, pCCBReader);
}
break;
}
@ -141,7 +155,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
float floatScale = this->parsePropTypeFloatScale(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeFloatScale(pNode, pParent, propertyName, floatScale, pCCBReader);
this->onHandlePropTypeFloatScale(pNode, pParent, propertyName.c_str(), floatScale, pCCBReader);
}
break;
}
@ -150,7 +164,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
int integer = this->parsePropTypeInteger(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeInteger(pNode, pParent, propertyName, integer, pCCBReader);
this->onHandlePropTypeInteger(pNode, pParent, propertyName.c_str(), integer, pCCBReader);
}
break;
}
@ -159,7 +173,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
int integerLabeled = this->parsePropTypeIntegerLabeled(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeIntegerLabeled(pNode, pParent, propertyName, integerLabeled, pCCBReader);
this->onHandlePropTypeIntegerLabeled(pNode, pParent, propertyName.c_str(), integerLabeled, pCCBReader);
}
break;
}
@ -168,25 +182,25 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
float * floatVar = this->parsePropTypeFloatVar(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeFloatVar(pNode, pParent, propertyName, floatVar, pCCBReader);
this->onHandlePropTypeFloatVar(pNode, pParent, propertyName.c_str(), floatVar, pCCBReader);
}
CC_SAFE_DELETE_ARRAY(floatVar);
break;
}
case kCCBPropTypeCheck:
{
bool check = this->parsePropTypeCheck(pNode, pParent, pCCBReader, propertyName->getCString());
bool check = this->parsePropTypeCheck(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeCheck(pNode, pParent, propertyName, check, pCCBReader);
this->onHandlePropTypeCheck(pNode, pParent, propertyName.c_str(), check, pCCBReader);
}
break;
}
case kCCBPropTypeSpriteFrame: {
CCSpriteFrame * ccSpriteFrame = this->parsePropTypeSpriteFrame(pNode, pParent, pCCBReader, propertyName->getCString());
CCSpriteFrame * ccSpriteFrame = this->parsePropTypeSpriteFrame(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeSpriteFrame(pNode, pParent, propertyName, ccSpriteFrame, pCCBReader);
this->onHandlePropTypeSpriteFrame(pNode, pParent, propertyName.c_str(), ccSpriteFrame, pCCBReader);
}
break;
}
@ -195,7 +209,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
CCAnimation * ccAnimation = this->parsePropTypeAnimation(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeAnimation(pNode, pParent, propertyName, ccAnimation, pCCBReader);
this->onHandlePropTypeAnimation(pNode, pParent, propertyName.c_str(), ccAnimation, pCCBReader);
}
break;
}
@ -204,25 +218,25 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
CCTexture2D * ccTexture2D = this->parsePropTypeTexture(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeTexture(pNode, pParent, propertyName, ccTexture2D, pCCBReader);
this->onHandlePropTypeTexture(pNode, pParent, propertyName.c_str(), ccTexture2D, pCCBReader);
}
break;
}
case kCCBPropTypeByte:
{
unsigned char byte = this->parsePropTypeByte(pNode, pParent, pCCBReader, propertyName->getCString());
unsigned char byte = this->parsePropTypeByte(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeByte(pNode, pParent, propertyName, byte, pCCBReader);
this->onHandlePropTypeByte(pNode, pParent, propertyName.c_str(), byte, pCCBReader);
}
break;
}
case kCCBPropTypeColor3:
{
ccColor3B color3B = this->parsePropTypeColor3(pNode, pParent, pCCBReader, propertyName->getCString());
ccColor3B color3B = this->parsePropTypeColor3(pNode, pParent, pCCBReader, propertyName.c_str());
if(setProp)
{
this->onHandlePropTypeColor3(pNode, pParent, propertyName, color3B, pCCBReader);
this->onHandlePropTypeColor3(pNode, pParent, propertyName.c_str(), color3B, pCCBReader);
}
break;
}
@ -231,7 +245,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
ccColor4F * color4FVar = this->parsePropTypeColor4FVar(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeColor4FVar(pNode, pParent, propertyName, color4FVar, pCCBReader);
this->onHandlePropTypeColor4FVar(pNode, pParent, propertyName.c_str(), color4FVar, pCCBReader);
}
CC_SAFE_DELETE_ARRAY(color4FVar);
break;
@ -239,7 +253,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
case kCCBPropTypeFlip: {
bool * flip = this->parsePropTypeFlip(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeFlip(pNode, pParent, propertyName, flip, pCCBReader);
this->onHandlePropTypeFlip(pNode, pParent, propertyName.c_str(), flip, pCCBReader);
}
CC_SAFE_DELETE_ARRAY(flip);
break;
@ -249,44 +263,44 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
ccBlendFunc blendFunc = this->parsePropTypeBlendFunc(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeBlendFunc(pNode, pParent, propertyName, blendFunc, pCCBReader);
this->onHandlePropTypeBlendFunc(pNode, pParent, propertyName.c_str(), blendFunc, pCCBReader);
}
break;
}
case kCCBPropTypeFntFile:
{
CCString * fntFile = this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
std::string fntFile = pCCBReader->getCCBRootPath() + this->parsePropTypeFntFile(pNode, pParent, pCCBReader);
if(setProp)
{
this->onHandlePropTypeFntFile(pNode, pParent, propertyName, fntFile, pCCBReader);
this->onHandlePropTypeFntFile(pNode, pParent, propertyName.c_str(), fntFile.c_str(), pCCBReader);
}
break;
}
case kCCBPropTypeFontTTF: {
CCString * fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
std::string fontTTF = this->parsePropTypeFontTTF(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeFontTTF(pNode, pParent, propertyName, fontTTF, pCCBReader);
this->onHandlePropTypeFontTTF(pNode, pParent, propertyName.c_str(), fontTTF.c_str(), pCCBReader);
}
break;
}
case kCCBPropTypeString: {
CCString * string = this->parsePropTypeString(pNode, pParent, pCCBReader);
std::string string = this->parsePropTypeString(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeString(pNode, pParent, propertyName, string, pCCBReader);
this->onHandlePropTypeString(pNode, pParent, propertyName.c_str(), string.c_str(), pCCBReader);
}
break;
}
case kCCBPropTypeText: {
CCString * text = this->parsePropTypeText(pNode, pParent, pCCBReader);
std::string text = this->parsePropTypeText(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeText(pNode, pParent, propertyName, text, pCCBReader);
this->onHandlePropTypeText(pNode, pParent, propertyName.c_str(), text.c_str(), pCCBReader);
}
break;
}
case kCCBPropTypeBlock: {
BlockData * blockData = this->parsePropTypeBlock(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeBlock(pNode, pParent, propertyName, blockData, pCCBReader);
this->onHandlePropTypeBlock(pNode, pParent, propertyName.c_str(), blockData, pCCBReader);
}
CC_SAFE_DELETE(blockData);
break;
@ -294,7 +308,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
case kCCBPropTypeBlockCCControl: {
BlockCCControlData * blockCCControlData = this->parsePropTypeBlockCCControl(pNode, pParent, pCCBReader);
if(setProp && blockCCControlData != NULL) {
this->onHandlePropTypeBlockCCControl(pNode, pParent, propertyName, blockCCControlData, pCCBReader);
this->onHandlePropTypeBlockCCControl(pNode, pParent, propertyName.c_str(), blockCCControlData, pCCBReader);
}
CC_SAFE_DELETE(blockCCControlData);
break;
@ -302,7 +316,7 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
case kCCBPropTypeCCBFile: {
CCNode * ccbFileNode = this->parsePropTypeCCBFile(pNode, pParent, pCCBReader);
if(setProp) {
this->onHandlePropTypeCCBFile(pNode, pParent, propertyName, ccbFileNode, pCCBReader);
this->onHandlePropTypeCCBFile(pNode, pParent, propertyName.c_str(), ccbFileNode, pCCBReader);
}
break;
}
@ -499,30 +513,31 @@ bool CCNodeLoader::parsePropTypeCheck(CCNode * pNode, CCNode * pParent, CCBReade
CCSpriteFrame * CCNodeLoader::parsePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader, const char *pPropertyName)
{
CCString * spriteSheet = pCCBReader->readCachedString();
CCString * spriteFile = pCCBReader->readCachedString();
std::string spriteSheet = pCCBReader->readCachedString();
std::string spriteFile = pCCBReader->readCachedString();
CCSpriteFrame *spriteFrame = NULL;
if (spriteFile->length() != 0)
if (spriteFile.length() != 0)
{
if (spriteSheet->length() == 0)
if (spriteSheet.length() == 0)
{
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile->getCString());
spriteFile = pCCBReader->getCCBRootPath() + spriteFile;
CCTexture2D * texture = CCTextureCache::sharedTextureCache()->addImage(spriteFile.c_str());
CCRect bounds = CCRectMake(0, 0, texture->getContentSize().width, texture->getContentSize().height);
spriteFrame = CCSpriteFrame::createWithTexture(texture, bounds);
}
else
{
CCSpriteFrameCache * frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
spriteSheet = pCCBReader->getCCBRootPath() + spriteSheet;
// Load the sprite sheet only if it is not loaded
if (pCCBReader->getLoadedSpriteSheet().find(spriteSheet->getCString()) == pCCBReader->getLoadedSpriteSheet().end())
if (pCCBReader->getLoadedSpriteSheet().find(spriteSheet) == pCCBReader->getLoadedSpriteSheet().end())
{
frameCache->addSpriteFramesWithFile(spriteSheet->getCString());
pCCBReader->getLoadedSpriteSheet().insert(spriteSheet->getCString());
frameCache->addSpriteFramesWithFile(spriteSheet.c_str());
pCCBReader->getLoadedSpriteSheet().insert(spriteSheet);
}
spriteFrame = frameCache->spriteFrameByName(spriteFile->getCString());
spriteFrame = frameCache->spriteFrameByName(spriteFile.c_str());
}
if (pCCBReader->getAnimatedProperties()->find(pPropertyName) != pCCBReader->getAnimatedProperties()->end())
@ -535,8 +550,8 @@ CCSpriteFrame * CCNodeLoader::parsePropTypeSpriteFrame(CCNode * pNode, CCNode *
}
CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * animationFile = pCCBReader->readCachedString();
CCString * animation = pCCBReader->readCachedString();
std::string animationFile = pCCBReader->getCCBRootPath() + pCCBReader->readCachedString();
std::string animation = pCCBReader->readCachedString();
CCAnimation * ccAnimation = NULL;
@ -545,25 +560,25 @@ CCAnimation * CCNodeLoader::parsePropTypeAnimation(CCNode * pNode, CCNode * pPar
// Eventually this should be handled by a client side asset manager
// interface which figured out what resources to load.
// TODO Does this problem exist in C++?
animation = CCBReader::lastPathComponent(animation);
animationFile = CCBReader::lastPathComponent(animationFile);
animation = CCBReader::lastPathComponent(animation.c_str());
animationFile = CCBReader::lastPathComponent(animationFile.c_str());
if (animation != NULL && animation->compare("") != 0)
if (animation.length() > 0)
{
CCAnimationCache * animationCache = CCAnimationCache::sharedAnimationCache();
animationCache->addAnimationsWithFile(animationFile->getCString());
animationCache->addAnimationsWithFile(animationFile.c_str());
ccAnimation = animationCache->animationByName(animation->getCString());
ccAnimation = animationCache->animationByName(animation.c_str());
}
return ccAnimation;
}
CCTexture2D * CCNodeLoader::parsePropTypeTexture(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * spriteFile = pCCBReader->readCachedString();
std::string spriteFile = pCCBReader->getCCBRootPath() + pCCBReader->readCachedString();
if (spriteFile->compare("") != 0)
if (spriteFile.length() > 0)
{
return CCTextureCache::sharedTextureCache()->addImage(spriteFile->getCString());
return CCTextureCache::sharedTextureCache()->addImage(spriteFile.c_str());
}
else
{
@ -644,21 +659,21 @@ ccBlendFunc CCNodeLoader::parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParen
return blendFunc;
}
CCString * CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader)
std::string CCNodeLoader::parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader)
{
return pCCBReader->readCachedString();
}
CCString * CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
std::string CCNodeLoader::parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString();
}
CCString * CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
std::string CCNodeLoader::parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
return pCCBReader->readCachedString();
}
CCString * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * fontTTF = pCCBReader->readCachedString();
std::string CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
std::string fontTTF = pCCBReader->readCachedString();
// CCString * ttfEnding = CCString::create(".ttf");
@ -675,7 +690,7 @@ CCString * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent,
}
BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * selectorName = pCCBReader->readCachedString();
std::string selectorName = pCCBReader->readCachedString();
int selectorTarget = pCCBReader->readInt(false);
if(selectorTarget != kCCBTargetTypeNone) {
@ -689,23 +704,23 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
}
if(target != NULL) {
if(selectorName->length() > 0) {
if(selectorName.length() > 0) {
SEL_MenuHandler selMenuHandler = 0;
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) {
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName);
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
}
if(selMenuHandler == 0) {
CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL) {
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName);
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
}
}
if(selMenuHandler == 0) {
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString());
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName.c_str());
} else {
BlockData * blockData = new BlockData();
blockData->mSELMenuHandler = selMenuHandler;
@ -723,11 +738,11 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
} else {
if(selectorTarget == kCCBTargetTypeDocumentRoot) {
pCCBReader->addDocumentCallbackNode(pNode);
pCCBReader->addDocumentCallbackName(selectorName->getCString());
pCCBReader->addDocumentCallbackName(selectorName);
} else {
pCCBReader->addOwnerCallbackNode(pNode);
pCCBReader->addOwnerCallbackName(selectorName->getCString());
pCCBReader->addOwnerCallbackName(selectorName);
}
}
}
@ -736,7 +751,7 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C
}
BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * selectorName = pCCBReader->readCachedString();
std::string selectorName = pCCBReader->readCachedString();
int selectorTarget = pCCBReader->readInt(false);
int controlEvents = pCCBReader->readInt(false);
@ -751,23 +766,23 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
}
if(target != NULL) {
if(selectorName->length() > 0) {
if(selectorName.length() > 0) {
SEL_CCControlHandler selCCControlHandler = 0;
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) {
selCCControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName);
selCCControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
}
if(selCCControlHandler == 0) {
CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL) {
selCCControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName);
selCCControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
}
}
if(selCCControlHandler == 0) {
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString());
CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName.c_str());
} else {
BlockCCControlData * blockCCControlData = new BlockCCControlData();
blockCCControlData->mSELCCControlHandler = selCCControlHandler;
@ -786,11 +801,11 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
} else {
if(selectorTarget == kCCBTargetTypeDocumentRoot) {
pCCBReader->addDocumentCallbackNode(pNode);
pCCBReader->addDocumentCallbackName(selectorName->getCString());
pCCBReader->addDocumentCallbackName(selectorName);
} else {
pCCBReader->addOwnerCallbackNode(pNode);
pCCBReader->addOwnerCallbackName(selectorName->getCString());
pCCBReader->addOwnerCallbackName(selectorName);
}
}
}
@ -799,35 +814,47 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C
}
CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * ccbFileName = pCCBReader->readCachedString();
std::string ccbFileName = pCCBReader->getCCBRootPath() + pCCBReader->readCachedString();
/* Change path extension to .ccbi. */
CCString * ccbFileWithoutPathExtension = CCBReader::deletePathExtension(ccbFileName);
ccbFileName = CCBReader::concat(ccbFileWithoutPathExtension, CCString::create(".ccbi"));
std::string ccbFileWithoutPathExtension = CCBReader::deletePathExtension(ccbFileName.c_str());
ccbFileName = ccbFileWithoutPathExtension + ".ccbi";
// Load sub file
const char *path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(ccbFileName->getCString());
const char *path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(ccbFileName.c_str());
unsigned long size = 0;
unsigned char * pBytes = CCFileUtils::sharedFileUtils()->getFileData(path, "rb", &size);
CCBReader * ccbReader = new CCBReader(pCCBReader);
ccbReader->autorelease();
unsigned long size;
unsigned char * pBytes = CCFileUtils::sharedFileUtils()->getFileData(path, "rb", &size);
CCData *data = new CCData(pBytes, size);
ccbReader->initWithData(data, pCCBReader->getOwner());
data->release();
ccbReader->getAnimationManager()->setRootContainerSize(pParent->getContentSize());
ccbReader->setAnimationManagers(pCCBReader->getAnimationManagers());
CCData *data = new CCData(pBytes, size);
CC_SAFE_DELETE_ARRAY(pBytes);
data->retain();
ccbReader->mData = data;
ccbReader->mBytes = data->getBytes();
ccbReader->mCurrentByte = 0;
ccbReader->mCurrentBit = 0;
CC_SAFE_RETAIN(pCCBReader->mOwner);
ccbReader->mOwner = pCCBReader->mOwner;
ccbReader->mOwnerOutletNames = pCCBReader->mOwnerOutletNames;
ccbReader->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes;
ccbReader->mOwnerOutletNodes->retain();
ccbReader->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames;
ccbReader->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes;
ccbReader->mOwnerCallbackNodes->retain();
data->release();
CCNode * ccbFileNode = ccbReader->readFileWithCleanUp(false);
pCCBReader->setAnimationManagers(ccbReader->getAnimationManagers());
CCNode * ccbFileNode = ccbReader->readFileWithCleanUp(false, pCCBReader->getAnimationManagers());
if (ccbFileNode && ccbReader->getAnimationManager()->getAutoPlaySequenceId() != -1)
{
// Auto play animations
ccbReader->getAnimationManager()->runAnimations(ccbReader->getAnimationManager()->getAutoPlaySequenceId(), 0);
ccbReader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(ccbReader->getAnimationManager()->getAutoPlaySequenceId(), 0);
}
return ccbFileNode;
@ -835,36 +862,36 @@ CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CC
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_POSITION) == 0) {
void CCNodeLoader::onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPosition, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_POSITION) == 0) {
pNode->setPosition(pPosition);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ANCHORPOINT) == 0) {
void CCNodeLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ANCHORPOINT) == 0) {
pNode->setAnchorPoint(pPoint);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTENTSIZE) == 0) {
void CCNodeLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
pNode->setContentSize(pSize);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_SCALE) == 0) {
void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
pNode->setScaleX(pScaleLock[0]);
pNode->setScaleY(pScaleLock[1]);
} else {
@ -872,105 +899,105 @@ void CCNodeLoader::onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, C
}
}
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pFloat, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pDegrees, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_ROTATION) == 0) {
void CCNodeLoader::onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pDegrees, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_ROTATION) == 0) {
pNode->setRotation(pDegrees);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pFloatScale, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TAG) == 0) {
void CCNodeLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char* pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TAG) == 0) {
pNode->setTag(pInteger);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char* pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_VISIBLE) == 0) {
void CCNodeLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char* pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_VISIBLE) == 0) {
pNode->setVisible(pCheck);
} else if(pPropertyName->compare(PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_IGNOREANCHORPOINTFORPOSITION) == 0) {
pNode->ignoreAnchorPointForPosition(pCheck);
} else {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
}
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char* pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char* pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char* pFntFile, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pString, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pText, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pFontTTF, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char* pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
void CCNodeLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
ASSERT_FAIL_UNEXPECTED_PROPERTY(pPropertyName);
}

View File

@ -16,7 +16,7 @@ NS_CC_EXT_BEGIN
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
#define PROPERTY_VISIBLE "visible"
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected property: '%s'!\n", PROPERTY->getCString()); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) CCLog("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) CCLog("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createCCNode(cocos2d::CCNode * pParent, cocos2d::extension::CCBReader * pCCBReader) { \
@ -70,42 +70,42 @@ class CCNodeLoader : public CCObject {
virtual ccColor4F * parsePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual bool * parsePropTypeFlip(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual ccBlendFunc parsePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCString * parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeString(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeText(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual std::string parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual BlockData * parsePropTypeBlock(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual BlockCCControlData * parsePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual CCNode * parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader);
virtual void onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPosition, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pScaleLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pDegrees, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCString * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypePosition(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPosition, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypePointLock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCPoint pPointLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeScaleLock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeDegrees(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pDegrees, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatScale(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float pFloatScale, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char* pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char* pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char* pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeAnimation(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCAnimation * pCCAnimation, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char* pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char* pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char* pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeFntFile(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pFntFile, CCBReader * pCCBReader);
virtual void onHandlePropTypeString(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pString, CCBReader * pCCBReader);
virtual void onHandlePropTypeText(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pText, CCBReader * pCCBReader);
virtual void onHandlePropTypeFontTTF(CCNode * pNode, CCNode * pParent, const char* pPropertyName, const char * pFontTTF, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, const char* pPropertyName, BlockData * pBlockData, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, const char* pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char* pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -45,27 +45,24 @@ void CCNodeLoaderLibrary::registerDefaultCCNodeLoaders() {
}
void CCNodeLoaderLibrary::registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader) {
this->registerCCNodeLoader(CCString::create(pClassName), pCCNodeLoader);
}
void CCNodeLoaderLibrary::registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader) {
pClassName->retain();
pCCNodeLoader->retain();
this->mCCNodeLoaders.insert(CCNodeLoaderMapEntry(pClassName, pCCNodeLoader));
}
void CCNodeLoaderLibrary::unregisterCCNodeLoader(const char * pClassName) {
this->unregisterCCNodeLoader(CCString::create(pClassName));
}
void CCNodeLoaderLibrary::unregisterCCNodeLoader(CCString * pClassName) {
CCNodeLoaderMap::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
ccNodeLoadersIterator->first->release();
ccNodeLoadersIterator->second->release();
if (ccNodeLoadersIterator != this->mCCNodeLoaders.end())
{
ccNodeLoadersIterator->second->release();
mCCNodeLoaders.erase(ccNodeLoadersIterator);
}
else
{
CCLOG("The loader (%s) doesn't exist", pClassName);
}
}
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(CCString * pClassName) {
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(const char* pClassName) {
CCNodeLoaderMap::iterator ccNodeLoadersIterator = this->mCCNodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->mCCNodeLoaders.end());
return ccNodeLoadersIterator->second;
@ -74,7 +71,6 @@ CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader(CCString * pClassName) {
void CCNodeLoaderLibrary::purge(bool pReleaseCCNodeLoaders) {
if(pReleaseCCNodeLoaders) {
for(CCNodeLoaderMap::iterator it = this->mCCNodeLoaders.begin(); it != this->mCCNodeLoaders.end(); it++) {
it->first->release();
it->second->release();
}
}

View File

@ -8,8 +8,8 @@ NS_CC_EXT_BEGIN
class CCNodeLoader;
typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderMap;
typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry;
typedef std::map<std::string, CCNodeLoader *> CCNodeLoaderMap;
typedef std::pair<std::string, CCNodeLoader *> CCNodeLoaderMapEntry;
class CCNodeLoaderLibrary : public CCObject {
private:
@ -23,11 +23,11 @@ class CCNodeLoaderLibrary : public CCObject {
void registerDefaultCCNodeLoaders();
void registerCCNodeLoader(const char * pClassName, CCNodeLoader * pCCNodeLoader);
void registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader);
//void registerCCNodeLoader(CCString * pClassName, CCNodeLoader * pCCNodeLoader);
void unregisterCCNodeLoader(const char * pClassName);
void unregisterCCNodeLoader(CCString * pClassName);
//void unregisterCCNodeLoader(CCString * pClassName);
CCNodeLoader * getCCNodeLoader(const char * pClassName);
CCNodeLoader * getCCNodeLoader(CCString * pClassName);
//CCNodeLoader * getCCNodeLoader(CCString * pClassName);
void purge(bool pDelete);
public:

View File

@ -27,77 +27,77 @@
NS_CC_EXT_BEGIN
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_EMITERMODE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_EMITERMODE) == 0) {
((CCParticleSystemQuad *)pNode)->setEmitterMode(pIntegerLabeled);
} else {
CCNodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_POSVAR) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_POSVAR) == 0) {
((CCParticleSystemQuad *)pNode)->setPosVar(pPoint);
} else if(pPropertyName->compare(PROPERTY_GRAVITY) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_GRAVITY) == 0) {
((CCParticleSystemQuad *)pNode)->setGravity(pPoint);
} else {
CCNodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_EMISSIONRATE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_EMISSIONRATE) == 0) {
((CCParticleSystemQuad *)pNode)->setEmissionRate(pFloat);
} else if(pPropertyName->compare(PROPERTY_DURATION) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_DURATION) == 0) {
((CCParticleSystemQuad *)pNode)->setDuration(pFloat);
} else {
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TOTALPARTICLES) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TOTALPARTICLES) == 0) {
((CCParticleSystemQuad *)pNode)->setTotalParticles(pInteger);
} else {
CCNodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_LIFE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_LIFE) == 0) {
((CCParticleSystemQuad *)pNode)->setLife(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setLifeVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_STARTSIZE) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_STARTSIZE) == 0) {
((CCParticleSystemQuad *)pNode)->setStartSize(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartSizeVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_ENDSIZE) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDSIZE) == 0) {
((CCParticleSystemQuad *)pNode)->setEndSize(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndSizeVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_STARTSPIN) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_STARTSPIN) == 0) {
((CCParticleSystemQuad *)pNode)->setStartSpin(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartSpinVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_ENDSPIN) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDSPIN) == 0) {
((CCParticleSystemQuad *)pNode)->setEndSpin(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndSpinVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_ANGLE) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ANGLE) == 0) {
((CCParticleSystemQuad *)pNode)->setAngle(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setAngleVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_SPEED) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_SPEED) == 0) {
((CCParticleSystemQuad *)pNode)->setSpeed(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setSpeedVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_TANGENTIALACCEL) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_TANGENTIALACCEL) == 0) {
((CCParticleSystemQuad *)pNode)->setTangentialAccel(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setTangentialAccelVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_RADIALACCEL) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_RADIALACCEL) == 0) {
((CCParticleSystemQuad *)pNode)->setRadialAccel(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setRadialAccelVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_STARTRADIUS) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_STARTRADIUS) == 0) {
((CCParticleSystemQuad *)pNode)->setStartRadius(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setStartRadiusVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_ENDRADIUS) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDRADIUS) == 0) {
((CCParticleSystemQuad *)pNode)->setEndRadius(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setEndRadiusVar(pFloatVar[1]);
} else if(pPropertyName->compare(PROPERTY_ROTATEPERSECOND) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ROTATEPERSECOND) == 0) {
((CCParticleSystemQuad *)pNode)->setRotatePerSecond(pFloatVar[0]);
((CCParticleSystemQuad *)pNode)->setRotatePerSecondVar(pFloatVar[1]);
} else {
@ -105,11 +105,11 @@ void CCParticleSystemQuadLoader::onHandlePropTypeFloatVar(CCNode * pNode, CCNode
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_STARTCOLOR) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((CCParticleSystemQuad *)pNode)->setStartColor(pCCColor4FVar[0]);
((CCParticleSystemQuad *)pNode)->setStartColorVar(pCCColor4FVar[1]);
} else if(pPropertyName->compare(PROPERTY_ENDCOLOR) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
((CCParticleSystemQuad *)pNode)->setEndColor(pCCColor4FVar[0]);
((CCParticleSystemQuad *)pNode)->setEndColorVar(pCCColor4FVar[1]);
} else {
@ -117,16 +117,16 @@ void CCParticleSystemQuadLoader::onHandlePropTypeColor4FVar(CCNode * pNode, CCNo
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCParticleSystemQuad *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);
}
}
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_TEXTURE) == 0) {
void CCParticleSystemQuadLoader::onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) {
((CCParticleSystemQuad *)pNode)->setTexture(pCCTexture2D);
} else {
CCNodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pCCTexture2D, pCCBReader);

View File

@ -16,14 +16,14 @@ class CCParticleSystemQuadLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCParticleSystemQuad);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float * pFloatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypePoint(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCPoint pPoint, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeInteger(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pInteger, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloatVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor4FVar(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor4F * pCCColor4FVar, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeTexture(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCTexture2D * pCCTexture2D, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -15,32 +15,32 @@
NS_CC_EXT_BEGIN
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_SPRITEFRAME) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
((CCScale9Sprite *)pNode)->initWithSpriteFrame(pCCSpriteFrame);
} else {
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((CCScale9Sprite *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((CCScale9Sprite *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
// TODO Not exported by CocosBuilder yet!
// ((CCScale9Sprite *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
@ -48,24 +48,24 @@ void CCScale9SpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pP
}
}
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTENTSIZE) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
//((CCScale9Sprite *)pNode)->setContentSize(pSize);
} else if(pPropertyName->compare(PROPERTY_PREFEREDSIZE) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((CCScale9Sprite *)pNode)->setPreferredSize(pSize);
} else {
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
}
}
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_INSETLEFT) == 0) {
void CCScale9SpriteLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
((CCScale9Sprite *)pNode)->setInsetLeft(pFloat);
} else if(pPropertyName->compare(PROPERTY_INSETTOP) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
((CCScale9Sprite *)pNode)->setInsetTop(pFloat);
} else if(pPropertyName->compare(PROPERTY_INSETRIGHT) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_INSETRIGHT) == 0) {
((CCScale9Sprite *)pNode)->setInsetRight(pFloat);
} else if(pPropertyName->compare(PROPERTY_INSETBOTTOM) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
((CCScale9Sprite *)pNode)->setInsetBottom(pFloat);
} else {
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);

View File

@ -18,12 +18,12 @@ class CCScale9SpriteLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScale9Sprite);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -10,26 +10,26 @@
NS_CC_EXT_BEGIN
void CCScrollViewLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTENTSIZE) == 0) {
void CCScrollViewLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
((CCScrollView *)pNode)->setViewSize(pSize);
} else {
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
}
}
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CLIPSTOBOUNDS) == 0) {
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
((CCScrollView *)pNode)->setClippingToBounds(pCheck);
} else if(pPropertyName->compare(PROPERTY_BOUNCES) == 0) {
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
((CCScrollView *)pNode)->setBounceable(pCheck);
} else {
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
}
}
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_CONTAINER) == 0) {
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
((CCScrollView *)pNode)->setContainer(pCCBFileNode);
((CCScrollView *)pNode)->updateInset();
} else {
@ -37,16 +37,16 @@ void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParen
}
}
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_SCALE) == 0) {
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
((CCScrollView *)pNode)->setScale(pFloat);
} else {
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
}
}
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_DIRECTION) == 0) {
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
((CCScrollView *)pNode)->setDirection(CCScrollViewDirection(pIntegerLabeled));
} else {
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);

View File

@ -16,11 +16,11 @@ class CCScrollViewLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCScrollView);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
virtual void onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader);
virtual void onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader);
virtual void onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader);
virtual void onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader);
virtual void onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -8,16 +8,16 @@
NS_CC_EXT_BEGIN
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_DISPLAYFRAME) == 0) {
void CCSpriteLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
((CCSprite *)pNode)->setDisplayFrame(pCCSpriteFrame);
} else {
CCNodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_FLIP) == 0) {
void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_FLIP) == 0) {
((CCSprite *)pNode)->setFlipX(pFlip[0]);
((CCSprite *)pNode)->setFlipY(pFlip[1]);
} else {
@ -25,24 +25,24 @@ void CCSpriteLoader::onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCSt
}
}
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_COLOR) == 0) {
void CCSpriteLoader::onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((CCSprite *)pNode)->setColor(pCCColor3B);
} else {
CCNodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pCCColor3B, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_OPACITY) == 0) {
void CCSpriteLoader::onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((CCSprite *)pNode)->setOpacity(pByte);
} else {
CCNodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, pCCBReader);
}
}
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(pPropertyName->compare(PROPERTY_BLENDFUNC) == 0) {
void CCSpriteLoader::onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBlendFunc, CCBReader * pCCBReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((CCSprite *)pNode)->setBlendFunc(pCCBlendFunc);
} else {
CCNodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pCCBlendFunc, pCCBReader);

View File

@ -16,11 +16,11 @@ class CCSpriteLoader : public CCNodeLoader {
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCSprite);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, ccBlendFunc pCCBBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
virtual void onHandlePropTypeColor3(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccColor3B pCCColor3B, CCBReader * pCCBReader);
virtual void onHandlePropTypeByte(CCNode * pNode, CCNode * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * pCCBReader);
virtual void onHandlePropTypeBlendFunc(CCNode * pNode, CCNode * pParent, const char * pPropertyName, ccBlendFunc pCCBBlendFunc, CCBReader * pCCBReader);
virtual void onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader);
virtual void onHandlePropTypeFlip(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool * pFlip, CCBReader * pCCBReader);
};
NS_CC_EXT_END

View File

@ -78,7 +78,7 @@ public:
/**
* Change the download timeout
* @param timeout
* @param value
* @return NULL
*/
inline void setTimeoutForRead(int value) {_timeoutForRead = value;};

View File

@ -44,12 +44,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.1291922980" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.1492222929" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.417359789" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -80,6 +82,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -116,12 +119,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.803735203" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.361044144" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<option id="com.qnx.qcc.option.compiler.pie.306742309" name="Position Independent Executable (-fPIE)" superClass="com.qnx.qcc.option.compiler.pie" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.qccoptions.413233097" name="QCC Options" superClass="com.qnx.qcc.option.compiler.qccoptions" valueType="stringList">
@ -152,6 +157,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -190,12 +196,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.310444700" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.41889260" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1119262140" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -224,6 +232,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -262,12 +271,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.1187262169" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.670664466" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1348604160" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -296,6 +307,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -307,6 +319,7 @@
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/extensions"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/extensions/Simulator-Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/extensions/Simulator"/>
<entry flags="" kind="libraryFile" name="extensions"/>
<entry flags="RESOLVED" kind="libraryFile" name="extensions"/>
</externalSetting>
@ -332,12 +345,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.1924003265" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.443838996" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.2047992695" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -365,6 +380,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -402,12 +418,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.1681239974" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.1641753022" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1136269429" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -436,6 +454,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>
@ -473,12 +492,14 @@
<listOptionValue builtIn="false" value="../../../cocos2dx/kazmath/include"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform"/>
<listOptionValue builtIn="false" value="../../../cocos2dx/platform/blackberry"/>
<listOptionValue builtIn="false" value="../../../external/chipmunk/include/chipmunk"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
</option>
<option id="com.qnx.qcc.option.compiler.security.309955164" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.compiler.defines.919408513" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
<listOptionValue builtIn="false" value="CC_ENABLE_CHIPMUNK_INTEGRATION=1"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.278693741" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
@ -507,6 +528,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="CCBReader"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="GUI"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="network"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
</sourceEntries>
</configuration>
</storageModule>

View File

@ -94,6 +94,11 @@
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/network</locationURI>
</link>
<link>
<name>physics_nodes</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/physics_nodes</locationURI>
</link>
</linkedResources>
<filteredResources>
<filter>

View File

@ -0,0 +1,58 @@
options
{
module_path="../../cocos2dx/proj.marmalade"
}
subprojects
{
cocos2dx
}
includepaths
{
.
"../"
}
files
{
("../")
"*.h"
["CCBReader"]
("../CCBReader")
CCBReader.h
# CCBCustomClass.h
# CCBCustomClass.cpp
# CCBReader_v1.cpp
["GUI/CCControlExtension"]
("../GUI/CCControlExtension")
"*.h"
"*.cpp"
["GUI/CCEditBox"]
("../GUI/CCEditBox")
# "CCEditBox.h"
# "CCEditBox.cpp"
["GUI/CCScrollView"]
("../GUI/CCScrollView")
"*.h"
"*.cpp"
# ["CCListView"]
# ("../CCListView")
# "*.h"
# "*.cpp"
# ["CCTextureWatcher"]
# ("../CCTextureWatcher")
# "*.h"
# "*.cpp"
["PhysicsNodes"]
("../physics_nodes")
"*.h"
"*.cpp"
}

View File

@ -0,0 +1,6 @@
# TO BE DOCUMENTED
# Physics integration
CC_ENABLE_CHIPMUNK_INTEGRATION 0
CC_ENABLE_BOX2D_INTEGRATION 0

View File

@ -67,8 +67,8 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\external;$(ProjectDir)..\..\cocos2dx;$(ProjectDir)..\..\cocos2dx\include;$(ProjectDir)..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\pthread;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\OGLES;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\external;$(ProjectDir)..\..\cocos2dx;$(ProjectDir)..\..\cocos2dx\include;$(ProjectDir)..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\pthread;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\OGLES;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>

View File

@ -1,4 +1,4 @@
#include <stdint.h>
//#include <stdint.h>
#ifdef __APPLE__
#include "TargetConditionals.h"

View File

@ -25,6 +25,20 @@ bool AppDelegate::applicationDidFinishLaunching()
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
CCSize designSize = CCSizeMake(320, 480);
// if (screenSize.height > 320)
// {
// CCSize resourceSize = CCSizeMake(640, 960);
// CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
// pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
// }
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
// turn on display FPS
pDirector->setDisplayStats(true);

View File

@ -1,51 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// Controller for the Bomb Object
// When the Dragon (hero) touches this object, the Dragon moves downwards.
//
var Bomb = function()
{
this.radius = 15;
};
Bomb.prototype.onUpdate = function()
{};
Bomb.prototype.handleCollisionWith = function(gameObjectController)
{
if (gameObjectController.controllerName == "Dragon")
{
// Collided with the dragon, remove object and add an exposion instead
this.isScheduledForRemove = true;
cc.AudioEngine.getInstance().playEffect("Explo.caf");
var explosion = cc.Reader.load("Explosion.ccbi");
explosion.setPosition(this.rootNode.getPosition());
this.rootNode.getParent().addChild(explosion);
}
};

View File

@ -1,46 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// Controller for the Coin Object
// When the Dragon (hero) touches this object, the Dragon moves upwards
//
var Coin = function()
{
this.radius = 15;
};
Coin.prototype.onUpdate = function()
{};
Coin.prototype.handleCollisionWith = function(gameObjectController)
{
if (gameObjectController.controllerName == "Dragon")
{
cc.AudioEngine.getInstance().playEffect("Coin.caf");
this.isScheduledForRemove = true;
}
};

View File

@ -1,85 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// controller for the Dragon Object (the Hero)
//
// Constants
var CD_START_SPEED = 8;
var CD_COIN_SPEED = 8;
var CD_START_TARGET = 160;
var CD_TARGET_FILTER_FACTOR = 0.05;
var CD_SLOW_DOWN_FACTOR = 0.995;
var CD_GRAVITY_SPEED = 0.1;
var CD_GAMEOVER_SPEED = -10;
var CD_DELTA_TO_ROTATION_FACTOR = 5;
var Dragon = function()
{
this.xTarget = CD_START_TARGET*gScaleFactor;
this.ySpeed = CD_START_SPEED;
this.radius = 25;
};
Dragon.prototype.onUpdate = function()
{
// Calculate the new position
var oldPosition = cc.pMult(this.rootNode.getPosition(), 1.0/gScaleFactor);
var xNew = (this.xTarget/gScaleFactor) * CD_TARGET_FILTER_FACTOR + oldPosition.x * (1-CD_TARGET_FILTER_FACTOR);
var yNew = oldPosition.y + this.ySpeed;
this.rootNode.setPosition(xNew*gScaleFactor, yNew*gScaleFactor);
// Update the vertical speed
this.ySpeed = (this.ySpeed - CD_GRAVITY_SPEED) * CD_SLOW_DOWN_FACTOR;
// Tilt the dragon
var xDelta = xNew - oldPosition.x;
this.rootNode.setRotation(xDelta * CD_DELTA_TO_ROTATION_FACTOR);
// Check for game over
if (this.ySpeed < CD_GAMEOVER_SPEED)
{
sharedGameScene.handleGameOver();
}
};
Dragon.prototype.handleCollisionWith = function(gameObjectController)
{
if (gameObjectController.controllerName == "Coin")
{
// Took a coin
this.ySpeed = CD_COIN_SPEED;
sharedGameScene.setScore(sharedGameScene.score+1);
}
else if (gameObjectController.controllerName == "Bomb")
{
// Hit a bomb
if (this.ySpeed > 0) this.ySpeed = 0;
this.rootNode.animationManager.runAnimationsForSequenceNamed("Hit");
}
};

View File

@ -1,45 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// Controller for the EndCoin object
// When the Dragon (hero) touches this object, the game is won.
//
var EndCoin = function()
{
this.radius = 15;
};
EndCoin.prototype.onUpdate = function()
{};
EndCoin.prototype.handleCollisionWith = function(gameObjectController)
{
if (gameObjectController.controllerName == "Dragon")
{
cc.AudioEngine.getInstance().playEffect("Coin.caf");
this.isScheduledForRemove = true;
sharedGameScene.handleLevelComplete();
}
};

View File

@ -1,49 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// Controller for the Bomb Object
// This object is run when the Dragon (hero) touches a bomb
//
var Explosion = function()
{
this.radius = 15;
};
Explosion.prototype.onDidLoadFromCCB = function()
{
this.rootNode.animationManager.setCompletedAnimationCallback(this, this.onAnimationComplete);
};
Explosion.prototype.onUpdate = function()
{};
Explosion.prototype.handleCollisionWith = function(gameObjectController)
{};
Explosion.prototype.onAnimationComplete = function(animationManager)
{
this.isScheduledForRemove = true;
};

View File

@ -1,71 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
//
// Controller for the GameScene Object
// This object loads the main Scene
//
var GameScene = function(){};
var sharedGameScene;
var gLevelOffsetX = 0;
GameScene.prototype.onDidLoadFromCCB = function()
{
sharedGameScene = this;
this.score = 0;
var level = cc.Reader.load("Level.ccbi");
// Center the level on Screen
gLevelOffsetX = (gWinSize.width-CD_LEVEL_WIDTH*gScaleFactor)/2;
level.setPosition(cc.p(gLevelOffsetX,0));
this.rootNode.addChild(level);
};
GameScene.prototype.setScore = function(score)
{
this.score = score;
this.scoreLabel.setString(""+score);
};
GameScene.prototype.getScore = function()
{
return this.score;
};
GameScene.prototype.handleGameOver = function()
{
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
cc.Director.getInstance().replaceScene(scene);
};
GameScene.prototype.handleLevelComplete = function()
{
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
cc.Director.getInstance().replaceScene(scene);
};

View File

@ -1,166 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
var CD_LEVEL_WIDTH = 320;
var CD_SCROLL_FILTER_FACTOR = 0.1;
var CD_DRAGON_TARGET_OFFET = 80;
// Accelerometer
var CD_ACCEL_FILTER_FACTOR = 0.25;
/**
* Level is the controller object of the game:
* It receives the following events:
* - onUpdate
* - Input events like touches, mouse and accelerometer
*/
var Level = function(){
this.winSize = cc.Director.getInstance().getWinSize();
// Used for the low-pass filter on the accelerometer
this.prevX = 0;
};
Level.prototype.onDidLoadFromCCB = function()
{
// Forward relevant touch events to controller (this)
this.rootNode.onTouchesBegan = function( touches, event) {
this.controller.onTouchesBegan(touches, event);
return true;
};
this.rootNode.onTouchesMoved = function( touches, event) {
this.controller.onTouchesMoved(touches, event);
return true;
};
this.rootNode.onMouseDragged = function( event) {
this.controller.onMouseDragged(event);
return true;
};
this.rootNode.onAccelerometer = function( event) {
this.controller.onAccelerometer(event);
};
// Schedule callback
this.rootNode.onUpdate = function(dt) {
this.controller.onUpdate();
};
this.rootNode.schedule(this.rootNode.onUpdate);
};
//
// Events
//
Level.prototype.onTouchesBegan = function(touches, event)
{
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
var loc = touches[0].getLocation();
this.dragon.controller.xTarget = loc.x - gLevelOffsetX;
};
Level.prototype.onTouchesMoved = function(touches, event)
{
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
var loc = touches[0].getLocation();
this.dragon.controller.xTarget = loc.x - gLevelOffsetX;
};
Level.prototype.onMouseDragged = function(event)
{
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
var loc = event.getLocation();
this.dragon.controller.xTarget = loc.x;
};
Level.prototype.onAccelerometer = function(accelEvent)
{
if (gSettingControlType != CD_CONTROLTYPE_TILT) return;
// low pass filter for accelerometer. This makes the movement softer
var accelX = accelEvent.x * CD_ACCEL_FILTER_FACTOR + (1 - CD_ACCEL_FILTER_FACTOR) * this.prevX;
this.prevX = accelX;
var newX = this.winSize.width * accelX + this.winSize.width/2;
this.dragon.controller.xTarget = newX;
// cc.log('Accel x: '+ accelEvent.x + ' y:' + accelEvent.y + ' z:' + accelEvent.z + ' time:' + accelEvent.timestamp );
};
// Game main loop
Level.prototype.onUpdate = function(dt)
{
var i=0;
var gameObject = null;
var gameObjectController = null;
// Iterate though all objects in the level layer
var children = this.rootNode.getChildren();
for (i = 0; i < children.length; i++)
{
// Check if the child has a controller (only the updatable objects will have one)
gameObject = children[i];
gameObjectController = gameObject.controller;
if (gameObjectController)
{
// Update all game objects
gameObjectController.onUpdate();
var gameObjectPos = cc.pMult(gameObject.getPosition(), 1.0/gScaleFactor);
var dragonPos = cc.pMult(this.dragon.getPosition(), 1.0/gScaleFactor);
// Check for collisions with dragon
if (gameObject !== this.dragon)
{
if (cc.pDistance(gameObjectPos, dragonPos) < gameObjectController.radius + this.dragon.controller.radius)
{
gameObjectController.handleCollisionWith(this.dragon.controller);
this.dragon.controller.handleCollisionWith(gameObjectController);
}
}
}
}
// Check for objects to remove
for (i = children.length-1; i >=0; i--)
{
gameObject = children[i];
gameObjectController = gameObject.controller;
if (gameObjectController && gameObjectController.isScheduledForRemove)
{
this.rootNode.removeChild(gameObject);
}
}
// Adjust position of the layer so dragon is visible
var yTarget = CD_DRAGON_TARGET_OFFET - this.dragon.getPosition().y;
var oldLayerPosition = this.rootNode.getPosition();
var xNew = oldLayerPosition.x;
var yNew = yTarget * CD_SCROLL_FILTER_FACTOR + oldLayerPosition.y * (1 - CD_SCROLL_FILTER_FACTOR);
this.rootNode.setPosition(xNew, yNew);
};

View File

@ -1,104 +0,0 @@
/* http://www.cocosbuilder.com
* http://www.cocos2d-iphone.org
*
* Copyright (c) 2012 Zynga, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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 THE
* SOFTWARE.
*/
var CD_CONTROLTYPE_TOUCH = 0;
var CD_CONTROLTYPE_TILT = 1;
// Setup global variables
var gSettingMusicEnabled = true;
var gSettingControlType = CD_CONTROLTYPE_TOUCH;
var gWinSize = cc.Director.getInstance().getWinSize();
var gScaleFactor;
if (gWinSize.width <= 320) gScaleFactor = 1;
else gScaleFactor = 2;
// Start playing looped background music
cc.AudioEngine.getInstance().setEffectsVolume(0.2);
cc.AudioEngine.getInstance().playMusic("Music.mp3");
//
// MainMenuScene class
//
var MainMenuScene = function(){};
MainMenuScene.prototype.updateSettingsDisplay = function()
{
// Music on/off
this.sprtMusicOff.setVisible(!gSettingMusicEnabled);
// Controls
if (gSettingControlType == CD_CONTROLTYPE_TOUCH)
{
this.sprtControlTouch.setVisible(true);
this.sprtControlTilt.setVisible(false);
}
else
{
this.sprtControlTouch.setVisible(false);
this.sprtControlTilt.setVisible(true);
}
};
MainMenuScene.prototype.onDidLoadFromCCB = function()
{
this.updateSettingsDisplay();
};
MainMenuScene.prototype.onPressedPlay = function()
{
var scene = cc.Reader.loadAsScene("GameScene.ccbi");
cc.Director.getInstance().replaceScene(scene);
};
MainMenuScene.prototype.onPressedMusic = function()
{
gSettingMusicEnabled = !gSettingMusicEnabled;
if (gSettingMusicEnabled)
{
cc.AudioEngine.getInstance().playMusic("Music.mp3");
}
else
{
cc.AudioEngine.getInstance().stopMusic();
}
this.updateSettingsDisplay();
};
MainMenuScene.prototype.onPressedControl = function()
{
if (gSettingControlType == CD_CONTROLTYPE_TOUCH)
{
gSettingControlType = CD_CONTROLTYPE_TILT;
}
else
{
gSettingControlType = CD_CONTROLTYPE_TOUCH;
}
this.updateSettingsDisplay();
};

View File

@ -1 +0,0 @@
5783809fbb118e460886314c5da4429ea1f6577d

View File

@ -1,22 +0,0 @@
// Autogenerated main.js file
require("jsb_constants.js");
require("Bomb.js");
require("Coin.js");
require("Dragon.js");
require("EndCoin.js");
require("Explosion.js");
require("GameScene.js");
require("Level.js");
require("MainMenuScene.js");
function main()
{
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
var director = cc.Director.getInstance();
var runningScene = director.getRunningScene();
if (runningScene === null) director.runWithScene(scene);
else director.replaceScene(scene);
}
main();

View File

@ -1 +0,0 @@
b0c5e740238e0eb308fa7c7d919b955788ce98db

View File

@ -1 +0,0 @@
b0c5e740238e0eb308fa7c7d919b955788ce98db

View File

@ -1 +0,0 @@
6e1a684f77d5fceff75f93f9e269576d0f88c06f

View File

@ -1 +0,0 @@
373c2b2260c711a02a90ad3b68abd7a1853a0527

View File

@ -1 +0,0 @@
af983ed63f13ab325322da1bbb6917290b6142f2

View File

@ -1 +0,0 @@
74cec9c4c8844fed81ea1f0323eb57df1737a1a3

View File

@ -1 +0,0 @@
969548df813b9d834bdce8848a34d20b69995612

View File

@ -1,275 +0,0 @@
//
// Chipmunk defines
//
cp.v = cc.p;
cp._v = cc._p;
cp.vzero = cp.v(0,0);
// Vector: Compatibility with Chipmunk-JS
cp.v.add = cp.vadd;
cp.v.clamp = cp.vclamp;
cp.v.cross = cp.vcross;
cp.v.dist = cp.vdist;
cp.v.distsq = cp.vdistsq;
cp.v.dot = cp.vdot;
cp.v.eql = cp.veql;
cp.v.forangle = cp.vforangle;
cp.v.len = cp.vlength;
cp.v.lengthsq = cp.vlengthsq;
cp.v.lerp = cp.vlerp;
cp.v.lerpconst = cp.vlerpconst;
cp.v.mult = cp.vmult;
cp.v.near = cp.vnear;
cp.v.neg = cp.vneg;
cp.v.normalize = cp.vnormalize;
cp.v.normalize_safe = cp.vnormalize_safe;
cp.v.perp = cp.vperp;
cp.v.project = cp.vproject;
cp.v.rotate = cp.vrotate;
cp.v.rperp = cp.vrperp;
cp.v.slerp = cp.vslerp;
cp.v.slerpconst = cp.vslerpconst;
cp.v.sub = cp.vsub;
cp.v.toangle = cp.vtoangle;
cp.v.unrotate = cp.vunrotate;
/// Initialize an offset box shaped polygon shape.
cp.BoxShape2 = function(body, box)
{
var verts = [
box.l, box.b,
box.l, box.t,
box.r, box.t,
box.r, box.b
];
return new cp.PolyShape(body, verts, cp.vzero);
};
/// Initialize a box shaped polygon shape.
cp.BoxShape = function(body, width, height)
{
var hw = width/2;
var hh = height/2;
return cp.BoxShape2(body, new cp.BB(-hw, -hh, hw, hh));
};
/// Initialize an static body
cp.StaticBody = function()
{
return new cp.Body(Infinity, Infinity);
};
// "Bounding Box" compatibility with Chipmunk-JS
cp.BB = function(l, b, r, t)
{
return {l:l, b:b, r:r, t:t};
};
// helper function to create a BB
cp.bb = function(l, b, r, t) {
return new cp.BB(l, b, r, t);
};
//
// Some properties
//
// "handle" needed in some cases
Object.defineProperties(cp.Base.prototype,
{
"handle" : {
get : function(){
return this.getHandle();
},
enumerable : true,
configurable : true
}
});
// Properties, for Chipmunk-JS compatibility
// Space properties
Object.defineProperties(cp.Space.prototype,
{
"gravity" : {
get : function(){
return this.getGravity();
},
set : function(newValue){
this.setGravity(newValue);
},
enumerable : true,
configurable : true
},
"iterations" : {
get : function(){
return this.getIterations();
},
set : function(newValue){
this.setIterations(newValue);
},
enumerable : true,
configurable : true
},
"damping" : {
get : function(){
return this.getDamping();
},
set : function(newValue){
this.setDamping(newValue);
},
enumerable : true,
configurable : true
},
"staticBody" : {
get : function(){
return this.getStaticBody();
},
enumerable : true,
configurable : true
},
"idleSpeedThreshold" : {
get : function(){
return this.getIdleSpeedThreshold();
},
set : function(newValue){
this.setIdleSpeedThreshold(newValue);
},
enumerable : true,
configurable : true
},
"sleepTimeThreshold": {
get : function(){
return this.getSleepTimeThreshold();
},
set : function(newValue){
this.setSleepTimeThreshold(newValue);
},
enumerable : true,
configurable : true
},
"collisionSlop": {
get : function(){
return this.getCollisionSlop();
},
set : function(newValue){
this.setCollisionSlop(newValue);
},
enumerable : true,
configurable : true
},
"collisionBias": {
get : function(){
return this.getCollisionBias();
},
set : function(newValue){
this.setCollisionBias(newValue);
},
enumerable : true,
configurable : true
},
"collisionPersistence": {
get : function(){
return this.getCollisionPersistence();
},
set : function(newValue){
this.setCollisionPersistence(newValue);
},
enumerable : true,
configurable : true
},
"enableContactGraph": {
get : function(){
return this.getEnableContactGraph();
},
set : function(newValue){
this.setEnableContactGraph(newValue);
},
enumerable : true,
configurable : true
}
});
// Body properties
Object.defineProperties(cp.Body.prototype,
{
"a" : {
get : function(){
return this.getAngle();
},
set : function(newValue){
this.setAngle(newValue);
},
enumerable : true,
configurable : true
},
"w" : {
get : function(){
return this.getAngVel();
},
set : function(newValue){
this.setAngVel(newValue);
},
enumerable : true,
configurable : true
},
"p" : {
get : function(){
return this.getPos();
},
set : function(newValue){
this.setPos(newValue);
},
enumerable : true,
configurable : true
},
"v" : {
get : function(){
return this.getVel();
},
set : function(newValue){
this.setVel(newValue);
},
enumerable : true,
configurable : true
},
"i" : {
get : function(){
return this.getMoment();
},
set : function(newValue){
this.setMoment(newValue);
},
enumerable : true,
configurable : true
}
});
// Shape properties
Object.defineProperties(cp.Shape.prototype,
{
"body" : {
get : function(){
return this.getBody();
},
set : function(newValue){
this.setBody(newValue);
},
enumerable : true,
configurable : true
},
"collision_type" : {
get : function(){
return this.getCollisionType();
},
enumerable : true,
configurable : true
}
});

View File

@ -1,493 +0,0 @@
//
// cocos2d constants
//
cc.DIRECTOR_PROJECTION_2D = 0;
cc.DIRECTOR_PROJECTION_3D = 1;
cc.TEXTURE_PIXELFORMAT_RGBA8888 = 0;
cc.TEXTURE_PIXELFORMAT_RGB888 = 1;
cc.TEXTURE_PIXELFORMAT_RGB565 = 2;
cc.TEXTURE_PIXELFORMAT_A8 = 3;
cc.TEXTURE_PIXELFORMAT_I8 = 4;
cc.TEXTURE_PIXELFORMAT_AI88 = 5;
cc.TEXTURE_PIXELFORMAT_RGBA4444 = 6;
cc.TEXTURE_PIXELFORMAT_RGB5A1 = 7;
cc.TEXTURE_PIXELFORMAT_PVRTC4 = 8;
cc.TEXTURE_PIXELFORMAT_PVRTC4 = 9;
cc.TEXTURE_PIXELFORMAT_DEFAULT = cc.TEXTURE_PIXELFORMAT_RGBA8888;
cc.TEXT_ALIGNMENT_LEFT = 0;
cc.TEXT_ALIGNMENT_CENTER = 1;
cc.TEXT_ALIGNMENT_RIGHT = 2;
cc.VERTICAL_TEXT_ALIGNMENT_TOP = 0;
cc.VERTICAL_TEXT_ALIGNMENT_CENTER = 1;
cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 2;
cc.IMAGE_FORMAT_JPEG = 0;
cc.IMAGE_FORMAT_PNG = 0;
cc.PROGRESS_TIMER_TYPE_RADIAL = 0;
cc.PROGRESS_TIMER_TYPE_BAR = 1;
cc.PARTICLE_TYPE_FREE = 0;
cc.PARTICLE_TYPE_RELATIVE = 1;
cc.PARTICLE_TYPE_GROUPED = 2;
cc.PARTICLE_DURATION_INFINITY = -1;
cc.PARTICLE_MODE_GRAVITY = 0;
cc.PARTICLE_MODE_RADIUS = 1;
cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1;
cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1;
cc.TOUCH_ALL_AT_ONCE = 0;
cc.TOUCH_ONE_BY_ONE = 1;
cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000;
cc.TMX_TILE_VERTICAL_FLAG = 0x40000000;
cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000;
cc.TRANSITION_ORIENTATION_LEFT_OVER = 0;
cc.TRANSITION_ORIENTATION_RIGHT_OVER = 1;
cc.TRANSITION_ORIENTATION_UP_OVER = 0;
cc.TRANSITION_ORIENTATION_DOWN_OVER = 1;
cc.RED = {r:255, g:0, b:0};
cc.GREEN = {r:0, g:255, b:0};
cc.BLUE = {r:0, g:0, b:255};
cc.BLACK = {r:0, g:0, b:0};
cc.WHITE = {r:255, g:255, b:255};
cc.POINT_ZERO = {x:0, y:0};
// XXX: This definition is different than cocos2d-html5
cc.REPEAT_FOREVER = - 1;
// reusable objects
cc._reuse_p = [ {x:0, y:0}, {x:0,y:0}, {x:0,y:0}, {x:0,y:0} ];
cc._reuse_p_index = 0;
cc._reuse_size = {width:0, height:0};
cc._reuse_rect = {x:0, y:0, width:0, height:0};
cc._reuse_color3b = {r:255, g:255, b:255 };
cc._reuse_color4b = {r:255, g:255, b:255, a:255 };
//
// Point
//
cc.p = function( x, y )
{
return {x:x, y:y};
};
cc.g = cc.g || cc.p;
cc._reuse_grid = cc.g(0,0);
cc.log = cc.log || log;
//
// Color 3B
//
cc.c3b = function( r, g, b )
{
return {r:r, g:g, b:b };
};
cc._c3b = function( r, g, b )
{
cc._reuse_color3b.r = r;
cc._reuse_color3b.g = g;
cc._reuse_color3b.b = b;
return cc._reuse_color3b;
};
//
// Color 4B
//
cc.c4b = function( r, g, b, a )
{
return {r:r, g:g, b:b, a:a };
};
cc._c4b = function( r, g, b, a )
{
cc._reuse_color4b.r = r;
cc._reuse_color4b.g = g;
cc._reuse_color4b.b = b;
cc._reuse_color4b.a = a;
return cc._reuse_color4b;
};
// compatibility
cc.c4 = cc.c4b;
cc._c4 = cc._c4b;
//
// Color 4F
//
cc.c4f = function( r, g, b, a )
{
return {r:r, g:g, b:b, a:a };
};
//
// Point
//
cc._p = function( x, y )
{
if( cc._reuse_p_index == cc._reuse_p.length )
cc._reuse_p_index = 0;
var p = cc._reuse_p[ cc._reuse_p_index];
cc._reuse_p_index++;
p.x = x;
p.y = y;
return p;
};
cc.pointEqualToPoint = function (point1, point2) {
return ((point1.x == point2.x) && (point1.y == point2.y));
};
//
// Grid
//
cc._g = function( x, y )
{
cc._reuse_grid.x = x;
cc._reuse_grid.y = y;
return cc._reuse_grid;
};
//
// Size
//
cc.size = function(w,h)
{
return {width:w, height:h};
};
cc._size = function(w,h)
{
cc._reuse_size.width = w;
cc._reuse_size.height = h;
return cc._reuse_size;
};
cc.sizeEqualToSize = function (size1, size2)
{
return ((size1.width == size2.width) && (size1.height == size2.height));
};
//
// Rect
//
cc.rect = function(x,y,w,h)
{
return {x:x, y:y, width:w, height:h};
};
cc._rect = function(x,y,w,h)
{
cc._reuse_rect.x = x;
cc._reuse_rect.y = y;
cc._reuse_rect.width = w;
cc._reuse_rect.height = h;
return cc._reuse_rect;
};
cc.rectEqualToRect = function (rect1, rect2) {
return ( rect1.x==rect2.x && rect1.y==rect2.y && rect1.width==rect2.width && rect1.height==rect2.height);
};
cc.rectContainsRect = function (rect1, rect2) {
if ((rect1.x >= rect2.x) || (rect1.y >= rect2.y) ||
( rect1.x + rect1.width <= rect2.x + rect2.width) ||
( rect1.y + rect1.height <= rect2.y + rect2.height))
return false;
return true;
};
cc.rectGetMaxX = function (rect) {
return (rect.x + rect.width);
};
cc.rectGetMidX = function (rect) {
return (rect.x + rect.width / 2.0);
};
cc.rectGetMinX = function (rect) {
return rect.x;
};
cc.rectGetMaxY = function (rect) {
return(rect.y + rect.height);
};
cc.rectGetMidY = function (rect) {
return rect.y + rect.height / 2.0;
};
cc.rectGetMinY = function (rect) {
return rect.y;
};
cc.rectContainsPoint = function (rect, point) {
var ret = false;
if (point.x >= rect.x && point.x <= rect.x + rect.width &&
point.y >= rect.y && point.y <= rect.y + rect.height) {
ret = true;
}
return ret;
};
cc.rectIntersectsRect = function( rectA, rectB )
{
var bool = ! ( rectA.x > rectB.x + rectB.width ||
rectA.x + rectA.width < rectB.x ||
rectA.y > rectB.y +rectB.height ||
rectA.y + rectA.height < rectB.y );
return bool;
};
cc.rectUnion = function (rectA, rectB) {
var rect = cc.rect(0, 0, 0, 0);
rect.x = Math.min(rectA.x, rectB.x);
rect.y = Math.min(rectA.y, rectB.y);
rect.width = Math.max(rectA.x + rectA.width, rectB.x + rectB.width) - rect.x;
rect.height = Math.max(rectA.y + rectA.height, rectB.y + rectB.height) - rect.y;
return rect;
};
cc.rectIntersection = function (rectA, rectB) {
var intersection = cc.rect(
Math.max(rectA.x, rectB.x),
Math.max(rectA.y, rectB.y),
0, 0);
intersection.width = Math.min(rectA.x+rectA.width, rectB.x+rectB.width) - intersection.x;
intersection.height = Math.min(rectA.y+rectA.height, rectB.y+rectB.height) - intersection.y;
return intersection;
};
//
// Array: for cocos2d-html5 compatibility
//
cc.ArrayRemoveObject = function (arr, delObj) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == delObj) {
arr.splice(i, 1);
}
}
};
//
// Helpers
//
cc.dump = function(obj)
{
for( var i in obj )
cc.log( i + " = " + obj[i] );
};
// dump config info, but only in debug mode
cc.dumpConfig = function()
{
if( cc.config.debug )
cc.dump(cc.config);
};
//
// Bindings Overrides
//
// MenuItemToggle
cc.MenuItemToggle.create = function( /* var args */) {
var n = arguments.length;
if (typeof arguments[n-2] === 'function' || typeof arguments[n-1] === 'function') {
var args = Array.prototype.slice.call(arguments);
var obj = null;
if( typeof arguments[n-2] === 'function' )
obj = args.pop();
var func = args.pop();
// create it with arguments,
var item = cc.MenuItemToggle._create.apply(this, args);
// then set the callback
if( obj !== null )
item.setCallback(func, obj);
else
item.setCallback(func);
return item;
} else {
return cc.MenuItemToggle._create.apply(this, arguments);
}
};
// LabelAtlas
cc.LabelAtlas.create = function( a,b,c,d,e ) {
var n = arguments.length;
if ( n == 5) {
return cc.LabelAtlas._create(a,b,c,d,e.charCodeAt(0));
} else {
return cc.LabelAtlas._create.apply(this, arguments);
}
};
// PhysicsDebugNode
cc.PhysicsDebugNode.create = function( space ) {
var s = space;
if( space.handle !== undefined )
s = space.handle;
return cc.PhysicsDebugNode._create( s );
};
cc.PhysicsDebugNode.prototype.setSpace = function( space ) {
var s = space;
if( space.handle !== undefined )
s = space.handle;
return this._setSpace( s );
};
// PhysicsSprite
cc.PhysicsSprite.prototype.setBody = function( body ) {
var b = body;
if( body.handle !== undefined )
b = body.handle;
return this._setBody( b );
};
/**
* Associates a base class with a native superclass
* @function
* @param {object} jsobj subclass
* @param {object} klass superclass
*/
cc.associateWithNative = function( jsobj, superclass_or_instance ) {
try {
// Used when subclassing using the "extend" method
var native = new superclass_or_instance();
__associateObjWithNative( jsobj, native );
} catch(err) {
// Used when subclassing using the goog.inherits method
__associateObjWithNative( jsobj, superclass_or_instance );
}
};
//
// JSB supports 2 official ways to create subclasses
//
// 1) Google "subclasses" borrowed from closure library
// This is the recommended way to do it
//
cc.inherits = function (childCtor, parentCtor) {
/** @constructor */
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
childCtor.prototype.constructor = childCtor;
// Copy "static" method, but doesn't generate subclasses.
// for( var i in parentCtor ) {
// childCtor[ i ] = parentCtor[ i ];
// }
};
cc.base = function(me, opt_methodName, var_args) {
var caller = arguments.callee.caller;
if (caller.superClass_) {
// This is a constructor. Call the superclass constructor.
ret = caller.superClass_.constructor.apply( me, Array.prototype.slice.call(arguments, 1));
return ret;
}
var args = Array.prototype.slice.call(arguments, 2);
var foundCaller = false;
for (var ctor = me.constructor;
ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) {
if (ctor.prototype[opt_methodName] === caller) {
foundCaller = true;
} else if (foundCaller) {
return ctor.prototype[opt_methodName].apply(me, args);
}
}
// If we did not find the caller in the prototype chain,
// then one of two things happened:
// 1) The caller is an instance method.
// 2) This method was not called by the right caller.
if (me[opt_methodName] === caller) {
return me.constructor.prototype[opt_methodName].apply(me, args);
} else {
throw Error(
'cc.base called from a method of one name ' +
'to a method of a different name');
}
};
//
// 2) Using "extend" subclassing
// Simple JavaScript Inheritance By John Resig http://ejohn.org/
//
cc.Class = function(){};
cc.Class.extend = function (prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function (name, fn) {
return function () {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if (!initializing && this.ctor)
this.ctor.apply(this, arguments);
}
// Populate our constructed prototype object
Class.prototype = prototype;
// Enforce the constructor to be what we expect
Class.prototype.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
return Class;
};
cc.Node.prototype.ctor = function() {};
cc.Node.extend = cc.Class.extend;
cc.Layer.extend = cc.Class.extend;
cc.LayerGradient.extend = cc.Class.extend;
cc.LayerColor.extend = cc.Class.extend;
cc.Sprite.extend = cc.Class.extend;
cc.MenuItemFont.extend = cc.Class.extend;
cc.Scene.extend = cc.Class.extend;

View File

@ -1,118 +0,0 @@
//
// CocosBuilder definitions
//
cc.Reader = {};
var _ccbGlobalContext = this;
cc.Reader.load = function(file, owner, parentSize)
{
// Load the node graph using the correct function
var reader = cc._Reader.create();
var node;
if (owner && parentSize)
{
node = reader.load(file, owner, parentSize);
}
else if (owner)
{
node = reader.load(file,owner);
}
else
{
node = reader.load(file);
}
// Assign owner callbacks & member variables
if (owner)
{
// Callbacks
var ownerCallbackNames = reader.getOwnerCallbackNames();
var ownerCallbackNodes = reader.getOwnerCallbackNodes();
for (var i = 0; i < ownerCallbackNames.length; i++)
{
var callbackName = ownerCallbackNames[i];
var callbackNode = ownerCallbackNodes[i];
callbackNode.setCallback(owner[callbackName], owner);
}
// Variables
var ownerOutletNames = reader.getOwnerOutletNames();
var ownerOutletNodes = reader.getOwnerOutletNodes();
for (var i = 0; i < ownerOutletNames.length; i++)
{
var outletName = ownerOutletNames[i];
var outletNode = ownerOutletNodes[i];
owner[outletName] = outletNode;
}
}
var nodesWithAnimationManagers = reader.getNodesWithAnimationManagers();
var animationManagersForNodes = reader.getAnimationManagersForNodes();
// Attach animation managers to nodes and assign root node callbacks and member variables
for (var i = 0; i < nodesWithAnimationManagers.length; i++)
{
var innerNode = nodesWithAnimationManagers[i];
var animationManager = animationManagersForNodes[i];
innerNode.animationManager = animationManager;
var documentControllerName = animationManager.getDocumentControllerName();
if (!documentControllerName) continue;
// Create a document controller
var controller = new _ccbGlobalContext[documentControllerName]();
controller.controllerName = documentControllerName;
innerNode.controller = controller;
controller.rootNode = innerNode;
// Callbacks
var documentCallbackNames = animationManager.getDocumentCallbackNames();
var documentCallbackNodes = animationManager.getDocumentCallbackNodes();
for (var j = 0; j < documentCallbackNames.length; j++)
{
var callbackName = documentCallbackNames[j];
var callbackNode = documentCallbackNodes[j];
callbackNode.setCallback(controller[callbackName], controller);
}
// Variables
var documentOutletNames = animationManager.getDocumentOutletNames();
var documentOutletNodes = animationManager.getDocumentOutletNodes();
for (var j = 0; j < documentOutletNames.length; j++)
{
var outletName = documentOutletNames[j];
var outletNode = documentOutletNodes[j];
controller[outletName] = outletNode;
}
if (typeof(controller.onDidLoadFromCCB) == "function")
{
controller.onDidLoadFromCCB();
}
}
return node;
}
cc.Reader.loadAsScene = function(file, owner, parentSize)
{
var node = cc.Reader.load(file, owner, parentSize);
var scene = cc.Scene.create();
scene.addChild( node );
return scene;
}

View File

@ -7,7 +7,6 @@
<uses-sdk android:minSdkVersion="8"/>
<application android:label="@string/app_name"
android:debuggable="true"
android:icon="@drawable/icon">
<activity android:name=".CocosDragonJS"

View File

@ -49,6 +49,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COCOS2DX_ROOT="$DIR/../../.."
APP_ROOT="$DIR/.."
APP_ANDROID_ROOT="$DIR"
RESROUCE_ROOT="$APP_ROOT/../TestJavascript/cocos2d-js-tests/games/CocosDragonJS/Published files iOS"
BINDINGS_JS_ROOT="$APP_ROOT/../../scripting/javascript/bindings/js"
echo
echo "Paths"
@ -69,10 +71,10 @@ fi
mkdir "$APP_ANDROID_ROOT"/assets
# copy "Resources" into "assets"
cp -rf "$APP_ROOT"/Resources/* "$APP_ANDROID_ROOT"/assets
cp -rf "$RESROUCE_ROOT"/* "$APP_ANDROID_ROOT"/assets
# copy bindings/*.js into assets' root
cp -f "$APP_ROOT"/bindings/*.js "$APP_ANDROID_ROOT"/assets
cp -f "$BINDINGS_JS_ROOT"/*.js "$APP_ANDROID_ROOT"/assets
echo "Using prebuilt externals"
echo

View File

@ -50,6 +50,13 @@
15426FE815B5743C00712A7F /* CocosDenshion.m in Sources */ = {isa = PBXBuildFile; fileRef = 15426FD515B5743C00712A7F /* CocosDenshion.m */; };
15426FE915B5743C00712A7F /* SimpleAudioEngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15426FD615B5743C00712A7F /* SimpleAudioEngine.mm */; };
15426FEA15B5743C00712A7F /* SimpleAudioEngine_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 15426FD815B5743C00712A7F /* SimpleAudioEngine_objc.m */; };
157EFB9A1667302B00BF1E11 /* jsb_constants.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFB951667302B00BF1E11 /* jsb_constants.js */; };
157EFB9B1667302B00BF1E11 /* jsb_constants_chipmunk.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFB961667302B00BF1E11 /* jsb_constants_chipmunk.js */; };
157EFB9C1667302B00BF1E11 /* jsb_constants_cocos2d.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFB971667302B00BF1E11 /* jsb_constants_cocos2d.js */; };
157EFB9D1667302B00BF1E11 /* jsb_constants_cocosbuilder.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFB981667302B00BF1E11 /* jsb_constants_cocosbuilder.js */; };
157EFB9E1667302B00BF1E11 /* jsb_constants_gl.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFB991667302B00BF1E11 /* jsb_constants_gl.js */; };
157EFBAE1667308300BF1E11 /* cocos2dxapi.js in Sources */ = {isa = PBXBuildFile; fileRef = 157EFBAD1667308300BF1E11 /* cocos2dxapi.js */; };
157EFBB0166730EF00BF1E11 /* Published files iOS in Resources */ = {isa = PBXBuildFile; fileRef = 157EFBAF166730EF00BF1E11 /* Published files iOS */; };
15CFE1A61612FD0E00BF2188 /* CCControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE18D1612FD0E00BF2188 /* CCControl.cpp */; };
15CFE1A71612FD0E00BF2188 /* CCControlButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE18F1612FD0E00BF2188 /* CCControlButton.cpp */; };
15CFE1A81612FD0E00BF2188 /* CCControlColourPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE1911612FD0E00BF2188 /* CCControlColourPicker.cpp */; };
@ -62,16 +69,8 @@
15CFE1AF1612FD0E00BF2188 /* CCControlUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE1A01612FD0E00BF2188 /* CCControlUtils.cpp */; };
15CFE1B01612FD0E00BF2188 /* CCInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE1A21612FD0E00BF2188 /* CCInvocation.cpp */; };
15CFE1B11612FD0E00BF2188 /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15CFE1A41612FD0E00BF2188 /* CCScale9Sprite.cpp */; };
15DA882A1627C44800155276 /* jsb_constants.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88251627C44800155276 /* jsb_constants.js */; };
15DA882B1627C44800155276 /* jsb_constants_chipmunk.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88261627C44800155276 /* jsb_constants_chipmunk.js */; };
15DA882C1627C44800155276 /* jsb_constants_cocos2d.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88271627C44800155276 /* jsb_constants_cocos2d.js */; };
15DA882D1627C44800155276 /* jsb_constants_cocosbuilder.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88281627C44800155276 /* jsb_constants_cocosbuilder.js */; };
15DA882E1627C44800155276 /* jsb_constants_gl.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88291627C44800155276 /* jsb_constants_gl.js */; };
15DA88B71627C62000155276 /* cocos2dxapi.js in Resources */ = {isa = PBXBuildFile; fileRef = 15DA88B61627C62000155276 /* cocos2dxapi.js */; };
15E2AE9E165DC52C00F7743F /* CCPhysicsDebugNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15E2AE9A165DC52C00F7743F /* CCPhysicsDebugNode.cpp */; };
15E2AE9F165DC52C00F7743F /* CCPhysicsSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15E2AE9C165DC52C00F7743F /* CCPhysicsSprite.cpp */; };
15E2AEA3165DC6DD00F7743F /* res in Resources */ = {isa = PBXBuildFile; fileRef = 15E2AEA2165DC6DD00F7743F /* res */; };
15E2AEA5165DC73200F7743F /* src in Resources */ = {isa = PBXBuildFile; fileRef = 15E2AEA4165DC73200F7743F /* src */; };
262829DB15EC7196002C4240 /* chipmunk.c in Sources */ = {isa = PBXBuildFile; fileRef = 262829AC15EC7196002C4240 /* chipmunk.c */; };
262829DD15EC7196002C4240 /* cpConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 262829AF15EC7196002C4240 /* cpConstraint.c */; };
262829DE15EC7196002C4240 /* cpDampedRotarySpring.c in Sources */ = {isa = PBXBuildFile; fileRef = 262829B015EC7196002C4240 /* cpDampedRotarySpring.c */; };
@ -240,6 +239,13 @@
15426FD615B5743C00712A7F /* SimpleAudioEngine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleAudioEngine.mm; sourceTree = "<group>"; };
15426FD715B5743C00712A7F /* SimpleAudioEngine_objc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine_objc.h; sourceTree = "<group>"; };
15426FD815B5743C00712A7F /* SimpleAudioEngine_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleAudioEngine_objc.m; sourceTree = "<group>"; };
157EFB951667302B00BF1E11 /* jsb_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants.js; sourceTree = "<group>"; };
157EFB961667302B00BF1E11 /* jsb_constants_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_chipmunk.js; sourceTree = "<group>"; };
157EFB971667302B00BF1E11 /* jsb_constants_cocos2d.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_cocos2d.js; sourceTree = "<group>"; };
157EFB981667302B00BF1E11 /* jsb_constants_cocosbuilder.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_cocosbuilder.js; sourceTree = "<group>"; };
157EFB991667302B00BF1E11 /* jsb_constants_gl.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_gl.js; sourceTree = "<group>"; };
157EFBAD1667308300BF1E11 /* cocos2dxapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = cocos2dxapi.js; path = ../../../scripting/javascript/bindings/generated/cocos2dxapi.js; sourceTree = "<group>"; };
157EFBAF166730EF00BF1E11 /* Published files iOS */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Published files iOS"; path = "../../TestJavascript/cocos2d-js-tests/games/CocosDragonJS/Published files iOS"; sourceTree = "<group>"; };
15CFE18D1612FD0E00BF2188 /* CCControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControl.cpp; sourceTree = "<group>"; };
15CFE18E1612FD0E00BF2188 /* CCControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControl.h; sourceTree = "<group>"; };
15CFE18F1612FD0E00BF2188 /* CCControlButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlButton.cpp; sourceTree = "<group>"; };
@ -265,18 +271,10 @@
15CFE1A31612FD0E00BF2188 /* CCInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCInvocation.h; sourceTree = "<group>"; };
15CFE1A41612FD0E00BF2188 /* CCScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9Sprite.cpp; sourceTree = "<group>"; };
15CFE1A51612FD0E00BF2188 /* CCScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScale9Sprite.h; sourceTree = "<group>"; };
15DA88251627C44800155276 /* jsb_constants.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants.js; sourceTree = "<group>"; };
15DA88261627C44800155276 /* jsb_constants_chipmunk.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_chipmunk.js; sourceTree = "<group>"; };
15DA88271627C44800155276 /* jsb_constants_cocos2d.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_cocos2d.js; sourceTree = "<group>"; };
15DA88281627C44800155276 /* jsb_constants_cocosbuilder.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_cocosbuilder.js; sourceTree = "<group>"; };
15DA88291627C44800155276 /* jsb_constants_gl.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = jsb_constants_gl.js; sourceTree = "<group>"; };
15DA88B61627C62000155276 /* cocos2dxapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = cocos2dxapi.js; path = ../../../scripting/javascript/bindings/generated/cocos2dxapi.js; sourceTree = "<group>"; };
15E2AE9A165DC52C00F7743F /* CCPhysicsDebugNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsDebugNode.cpp; sourceTree = "<group>"; };
15E2AE9B165DC52C00F7743F /* CCPhysicsDebugNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsDebugNode.h; sourceTree = "<group>"; };
15E2AE9C165DC52C00F7743F /* CCPhysicsSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsSprite.cpp; sourceTree = "<group>"; };
15E2AE9D165DC52C00F7743F /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = "<group>"; };
15E2AEA2165DC6DD00F7743F /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = res; path = "../cocos2d-js-tests/res"; sourceTree = "<group>"; };
15E2AEA4165DC73200F7743F /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = "../cocos2d-js-tests/src"; sourceTree = "<group>"; };
2628298215EC7196002C4240 /* chipmunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk.h; sourceTree = "<group>"; };
2628298315EC7196002C4240 /* chipmunk_ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_ffi.h; sourceTree = "<group>"; };
2628298415EC7196002C4240 /* chipmunk_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_private.h; sourceTree = "<group>"; };
@ -344,7 +342,7 @@
263B98CF16548E4D00228D8A /* js_bindings_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_core.h; sourceTree = "<group>"; };
263B98D316548EB700228D8A /* js_bindings_chipmunk_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_functions.cpp; sourceTree = "<group>"; };
263B98D516548EB700228D8A /* js_bindings_chipmunk_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_manual.cpp; sourceTree = "<group>"; };
A922753D1517C094001B78AA /* TestJavascript.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestJavascript.app; sourceTree = BUILT_PRODUCTS_DIR; };
A922753D1517C094001B78AA /* CocosDragonJS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CocosDragonJS.app; sourceTree = BUILT_PRODUCTS_DIR; };
A92275411517C094001B78AA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
A92275431517C094001B78AA /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
A92275451517C094001B78AA /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
@ -591,10 +589,9 @@
15628F5B15F0F5C2000CF24B /* Resources */ = {
isa = PBXGroup;
children = (
15E2AEA4165DC73200F7743F /* src */,
15E2AEA2165DC6DD00F7743F /* res */,
15DA88B61627C62000155276 /* cocos2dxapi.js */,
15DA88241627C44800155276 /* bindings */,
157EFBAF166730EF00BF1E11 /* Published files iOS */,
157EFBAD1667308300BF1E11 /* cocos2dxapi.js */,
157EFB941667302B00BF1E11 /* js */,
D446FDA616102D86000ADA7B /* Default-568h@2x.png */,
D446FDA416102D82000ADA7B /* Default@2x.png */,
D446FDA216102D7D000ADA7B /* Default.png */,
@ -602,6 +599,19 @@
name = Resources;
sourceTree = "<group>";
};
157EFB941667302B00BF1E11 /* js */ = {
isa = PBXGroup;
children = (
157EFB951667302B00BF1E11 /* jsb_constants.js */,
157EFB961667302B00BF1E11 /* jsb_constants_chipmunk.js */,
157EFB971667302B00BF1E11 /* jsb_constants_cocos2d.js */,
157EFB981667302B00BF1E11 /* jsb_constants_cocosbuilder.js */,
157EFB991667302B00BF1E11 /* jsb_constants_gl.js */,
);
name = js;
path = ../../../scripting/javascript/bindings/js;
sourceTree = "<group>";
};
15CFE18C1612FD0E00BF2188 /* CCControlExtension */ = {
isa = PBXGroup;
children = (
@ -634,19 +644,6 @@
path = CCControlExtension;
sourceTree = "<group>";
};
15DA88241627C44800155276 /* bindings */ = {
isa = PBXGroup;
children = (
15DA88251627C44800155276 /* jsb_constants.js */,
15DA88261627C44800155276 /* jsb_constants_chipmunk.js */,
15DA88271627C44800155276 /* jsb_constants_cocos2d.js */,
15DA88281627C44800155276 /* jsb_constants_cocosbuilder.js */,
15DA88291627C44800155276 /* jsb_constants_gl.js */,
);
name = bindings;
path = ../bindings;
sourceTree = "<group>";
};
15E2AE99165DC52C00F7743F /* physics_nodes */ = {
isa = PBXGroup;
children = (
@ -781,7 +778,7 @@
A922753E1517C094001B78AA /* Products */ = {
isa = PBXGroup;
children = (
A922753D1517C094001B78AA /* TestJavascript.app */,
A922753D1517C094001B78AA /* CocosDragonJS.app */,
);
name = Products;
sourceTree = "<group>";
@ -830,9 +827,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A922753C1517C094001B78AA /* TestJavascript */ = {
A922753C1517C094001B78AA /* CocosDragonJS */ = {
isa = PBXNativeTarget;
buildConfigurationList = A92277001517C097001B78AA /* Build configuration list for PBXNativeTarget "TestJavascript" */;
buildConfigurationList = A92277001517C097001B78AA /* Build configuration list for PBXNativeTarget "CocosDragonJS" */;
buildPhases = (
A92275391517C094001B78AA /* Sources */,
A922753A1517C094001B78AA /* Frameworks */,
@ -843,9 +840,9 @@
dependencies = (
15426FC215B5741900712A7F /* PBXTargetDependency */,
);
name = TestJavascript;
productName = TestJavascript;
productReference = A922753D1517C094001B78AA /* TestJavascript.app */;
name = CocosDragonJS;
productName = CocosDragonJS;
productReference = A922753D1517C094001B78AA /* CocosDragonJS.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@ -856,7 +853,7 @@
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = A92275371517C094001B78AA /* Build configuration list for PBXProject "TestJavascript" */;
buildConfigurationList = A92275371517C094001B78AA /* Build configuration list for PBXProject "CocosDragonJS" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -874,7 +871,7 @@
);
projectRoot = "";
targets = (
A922753C1517C094001B78AA /* TestJavascript */,
A922753C1517C094001B78AA /* CocosDragonJS */,
);
};
/* End PBXProject section */
@ -895,16 +892,9 @@
buildActionMask = 2147483647;
files = (
D446FDA316102D7D000ADA7B /* Default.png in Resources */,
15DA88B71627C62000155276 /* cocos2dxapi.js in Resources */,
15DA882A1627C44800155276 /* jsb_constants.js in Resources */,
15DA882B1627C44800155276 /* jsb_constants_chipmunk.js in Resources */,
15DA882C1627C44800155276 /* jsb_constants_cocos2d.js in Resources */,
15DA882D1627C44800155276 /* jsb_constants_cocosbuilder.js in Resources */,
15DA882E1627C44800155276 /* jsb_constants_gl.js in Resources */,
D446FDA516102D82000ADA7B /* Default@2x.png in Resources */,
D446FDA716102D86000ADA7B /* Default-568h@2x.png in Resources */,
15E2AEA3165DC6DD00F7743F /* res in Resources */,
15E2AEA5165DC73200F7743F /* src in Resources */,
157EFBB0166730EF00BF1E11 /* Published files iOS in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1009,6 +999,12 @@
263B98D716548EB700228D8A /* js_bindings_chipmunk_manual.cpp in Sources */,
15E2AE9E165DC52C00F7743F /* CCPhysicsDebugNode.cpp in Sources */,
15E2AE9F165DC52C00F7743F /* CCPhysicsSprite.cpp in Sources */,
157EFB9A1667302B00BF1E11 /* jsb_constants.js in Sources */,
157EFB9B1667302B00BF1E11 /* jsb_constants_chipmunk.js in Sources */,
157EFB9C1667302B00BF1E11 /* jsb_constants_cocos2d.js in Sources */,
157EFB9D1667302B00BF1E11 /* jsb_constants_cocosbuilder.js in Sources */,
157EFB9E1667302B00BF1E11 /* jsb_constants_gl.js in Sources */,
157EFBAE1667308300BF1E11 /* cocos2dxapi.js in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1088,7 +1084,7 @@
DEBUG,
"COCOS2D_DEBUG=1",
USE_FILE32API,
TARGET_OS_IPHONE,
CC_TARGET_OS_IPHONE,
CC_ENABLE_CHIPMUNK_INTEGRATION,
);
GCC_THUMB_SUPPORT = NO;
@ -1112,7 +1108,7 @@
"-lz",
"-ljs_static",
);
PRODUCT_NAME = TestJavascript;
PRODUCT_NAME = CocosDragonJS;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
@ -1129,10 +1125,11 @@
COCOS2D_JAVASCRIPT,
NDEBUG,
USE_FILE32API,
TARGET_OS_IPHONE,
CC_TARGET_OS_IPHONE,
CC_ENABLE_CHIPMUNK_INTEGRATION,
);
GCC_THUMB_SUPPORT = NO;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../../../cocos2dx\"",
"\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"",
@ -1152,7 +1149,7 @@
"-lz",
"-ljs_static",
);
PRODUCT_NAME = TestJavascript;
PRODUCT_NAME = CocosDragonJS;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
WRAPPER_EXTENSION = app;
@ -1162,7 +1159,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A92275371517C094001B78AA /* Build configuration list for PBXProject "TestJavascript" */ = {
A92275371517C094001B78AA /* Build configuration list for PBXProject "CocosDragonJS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A92276FE1517C097001B78AA /* Debug */,
@ -1171,7 +1168,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A92277001517C097001B78AA /* Build configuration list for PBXNativeTarget "TestJavascript" */ = {
A92277001517C097001B78AA /* Build configuration list for PBXNativeTarget "CocosDragonJS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A92277011517C097001B78AA /* Debug */,

View File

@ -1 +0,0 @@
3f35a7aa4c2d8c7b89f27eac3b7154ff7b300e48

View File

@ -95,8 +95,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\CocosDragonJSRes" rd /s /q "$(OutDir)\CocosDragonJSRes"
mkdir "$(OutDir)\CocosDragonJSRes"
xcopy "$(ProjectDir)..\bindings\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
xcopy "$(ProjectDir)..\Resources" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
xcopy "$(ProjectDir)..\..\..\scripting\javascript\bindings\js\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
xcopy "$(ProjectDir)..\..\TestJavascript\cocos2d-js-tests\games\CocosDragonJS\Published files iOS" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Copy js and resource files.</Message>
@ -148,8 +148,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
if exist "$(OutDir)\CocosDragonJSRes" rd /s /q "$(OutDir)\CocosDragonJSRes"
mkdir "$(OutDir)\CocosDragonJSRes"
xcopy "$(ProjectDir)..\bindings\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
xcopy "$(ProjectDir)..\Resources" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
xcopy "$(ProjectDir)..\..\..\scripting\javascript\bindings\js\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
xcopy "$(ProjectDir)..\..\TestJavascript\cocos2d-js-tests\games\CocosDragonJS\Published files iOS" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
<Message>Copy js and resource files.</Message>
</PreBuildEvent>
</ItemDefinitionGroup>

Some files were not shown because too many files have changed in this diff Show More