mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2433-lua-bindings-generator
This commit is contained in:
commit
6ae80bcaf0
|
@ -42,26 +42,6 @@ THE SOFTWARE.
|
|||
|
||||
namespace CocosDenshion {
|
||||
|
||||
class TypeInfo
|
||||
{
|
||||
public:
|
||||
virtual long getClassTypeInfo() = 0;
|
||||
};
|
||||
|
||||
static inline unsigned int getHashCodeByString(const char *key)
|
||||
{
|
||||
unsigned int len = strlen(key);
|
||||
const char *end=key+len;
|
||||
unsigned int hash;
|
||||
|
||||
for (hash = 0; key < end; key++)
|
||||
{
|
||||
hash *= 16777619;
|
||||
hash ^= (unsigned int) (unsigned char) toupper(*key);
|
||||
}
|
||||
return (hash);
|
||||
}
|
||||
|
||||
/**
|
||||
@class SimpleAudioEngine
|
||||
@brief Offers a VERY simple interface to play background music & sound effects.
|
||||
|
@ -69,7 +49,7 @@ static inline unsigned int getHashCodeByString(const char *key)
|
|||
to release allocated resources.
|
||||
*/
|
||||
|
||||
class EXPORT_DLL SimpleAudioEngine : public TypeInfo
|
||||
class EXPORT_DLL SimpleAudioEngine
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -90,10 +70,6 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
virtual long getClassTypeInfo() {
|
||||
return getHashCodeByString(typeid(CocosDenshion::SimpleAudioEngine).name());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Preload background music
|
||||
@param pszFilePath The path of the background music file.
|
||||
|
|
|
@ -1 +1 @@
|
|||
9420774ce7a3c38be6597cebe5a2888835d9c410
|
||||
027d1d69c91552623e04c46fd002c5976c4bb40c
|
|
@ -7,12 +7,14 @@ LOCAL_MODULE := cocos2dx_static
|
|||
LOCAL_MODULE_FILENAME := libcocos2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CCCamera.cpp \
|
||||
CCConfiguration.cpp \
|
||||
CCDeprecated.cpp \
|
||||
CCScheduler.cpp \
|
||||
CCCamera.cpp \
|
||||
CCDirector.cpp \
|
||||
ccFPSImages.c \
|
||||
CCScheduler.cpp \
|
||||
ccTypes.cpp \
|
||||
cocos2d.cpp \
|
||||
actions/CCAction.cpp \
|
||||
actions/CCActionCamera.cpp \
|
||||
actions/CCActionCatmullRom.cpp \
|
||||
|
@ -29,18 +31,16 @@ actions/CCActionTween.cpp \
|
|||
base_nodes/CCAtlasNode.cpp \
|
||||
base_nodes/CCNode.cpp \
|
||||
cocoa/CCAffineTransform.cpp \
|
||||
cocoa/CCGeometry.cpp \
|
||||
cocoa/CCArray.cpp \
|
||||
cocoa/CCAutoreleasePool.cpp \
|
||||
cocoa/CCData.cpp \
|
||||
cocoa/CCDataVisitor.cpp \
|
||||
cocoa/CCDictionary.cpp \
|
||||
cocoa/CCGeometry.cpp \
|
||||
cocoa/CCNS.cpp \
|
||||
cocoa/CCObject.cpp \
|
||||
cocoa/CCSet.cpp \
|
||||
cocoa/CCString.cpp \
|
||||
cocoa/CCArray.cpp \
|
||||
cocoa/CCDataVisitor.cpp \
|
||||
cocoa/CCData.cpp \
|
||||
cocos2d.cpp \
|
||||
CCDirector.cpp \
|
||||
draw_nodes/CCDrawingPrimitives.cpp \
|
||||
draw_nodes/CCDrawNode.cpp \
|
||||
effects/CCGrabber.cpp \
|
||||
|
@ -58,9 +58,9 @@ kazmath/src/vec3.c \
|
|||
kazmath/src/vec4.c \
|
||||
kazmath/src/GL/mat4stack.c \
|
||||
kazmath/src/GL/matrix.c \
|
||||
keyboard_dispatcher/CCKeyboardDispatcher.cpp \
|
||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
keyboard_dispatcher/CCKeyboardDispatcher.cpp \
|
||||
label_nodes/CCFont.cpp \
|
||||
label_nodes/CCFontAtlas.cpp \
|
||||
label_nodes/CCFontAtlasCache.cpp \
|
||||
|
@ -71,13 +71,13 @@ label_nodes/CCFontFreeType.cpp \
|
|||
label_nodes/CCLabel.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
label_nodes/CCLabelTextFormatter.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
label_nodes/CCTextImage.cpp \
|
||||
layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransition.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionProgress.cpp \
|
||||
menu_nodes/CCMenu.cpp \
|
||||
menu_nodes/CCMenuItem.cpp \
|
||||
|
@ -85,58 +85,58 @@ misc_nodes/CCClippingNode.cpp \
|
|||
misc_nodes/CCMotionStreak.cpp \
|
||||
misc_nodes/CCProgressTimer.cpp \
|
||||
misc_nodes/CCRenderTexture.cpp \
|
||||
particle_nodes/CCParticleBatchNode.cpp \
|
||||
particle_nodes/CCParticleExamples.cpp \
|
||||
particle_nodes/CCParticleSystem.cpp \
|
||||
particle_nodes/CCParticleBatchNode.cpp \
|
||||
particle_nodes/CCParticleSystemQuad.cpp \
|
||||
platform/CCEGLViewProtocol.cpp \
|
||||
platform/CCFileUtils.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
platform/CCThread.cpp \
|
||||
platform/CCFileUtils.cpp \
|
||||
platform/CCEGLViewProtocol.cpp \
|
||||
platform/third_party/common/atitc/atitc.cpp \
|
||||
platform/third_party/common/etc/etc1.cpp \
|
||||
platform/third_party/common/s3tc/s3tc.cpp \
|
||||
script_support/CCScriptSupport.cpp \
|
||||
shaders/ccShaders.cpp \
|
||||
shaders/CCGLProgram.cpp \
|
||||
shaders/ccGLStateCache.cpp \
|
||||
shaders/CCShaderCache.cpp \
|
||||
shaders/ccShaders.cpp \
|
||||
sprite_nodes/CCAnimation.cpp \
|
||||
sprite_nodes/CCAnimationCache.cpp \
|
||||
sprite_nodes/CCSprite.cpp \
|
||||
sprite_nodes/CCSpriteBatchNode.cpp \
|
||||
sprite_nodes/CCSpriteFrame.cpp \
|
||||
sprite_nodes/CCSpriteFrameCache.cpp \
|
||||
support/ccUTF8.cpp \
|
||||
support/base64.cpp \
|
||||
support/CCNotificationCenter.cpp \
|
||||
support/CCProfiling.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/user_default/CCUserDefaultAndroid.cpp \
|
||||
support/base64.cpp \
|
||||
support/ccUTF8.cpp \
|
||||
support/ccUtils.cpp \
|
||||
support/CCVertex.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/component/CCComponent.cpp \
|
||||
support/component/CCComponentContainer.cpp \
|
||||
support/data_support/ccCArray.cpp \
|
||||
support/image_support/TGAlib.cpp \
|
||||
support/tinyxml2/tinyxml2.cpp \
|
||||
support/zip_support/ZipUtils.cpp \
|
||||
support/user_default/CCUserDefaultAndroid.cpp \
|
||||
support/zip_support/ioapi.cpp \
|
||||
support/zip_support/unzip.cpp \
|
||||
support/component/CCComponent.cpp \
|
||||
support/component/CCComponentContainer.cpp \
|
||||
support/zip_support/ZipUtils.cpp \
|
||||
text_input_node/CCIMEDispatcher.cpp \
|
||||
text_input_node/CCTextFieldTTF.cpp \
|
||||
textures/CCTexture2D.cpp \
|
||||
textures/CCTextureAtlas.cpp \
|
||||
textures/CCTextureCache.cpp \
|
||||
platform/third_party/common/etc/etc1.cpp \
|
||||
platform/third_party/common/s3tc/s3tc.cpp \
|
||||
platform/third_party/common/atitc/atitc.cpp \
|
||||
tilemap_parallax_nodes/CCParallaxNode.cpp \
|
||||
tilemap_parallax_nodes/CCTileMapAtlas.cpp \
|
||||
tilemap_parallax_nodes/CCTMXLayer.cpp \
|
||||
tilemap_parallax_nodes/CCTMXObjectGroup.cpp \
|
||||
tilemap_parallax_nodes/CCTMXTiledMap.cpp \
|
||||
tilemap_parallax_nodes/CCTMXXMLParser.cpp \
|
||||
tilemap_parallax_nodes/CCTileMapAtlas.cpp \
|
||||
touch_dispatcher/CCTouch.cpp \
|
||||
touch_dispatcher/CCTouchDispatcher.cpp \
|
||||
touch_dispatcher/CCTouchHandler.cpp \
|
||||
touch_dispatcher/CCTouch.cpp
|
||||
touch_dispatcher/CCTouchHandler.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/include \
|
||||
|
|
|
@ -36,7 +36,6 @@ THE SOFTWARE.
|
|||
#include "CCGL.h"
|
||||
#include "kazmath/mat4.h"
|
||||
#include "label_nodes/CCLabelAtlas.h"
|
||||
#include "ccTypeInfo.h"
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -79,7 +78,7 @@ and when to execute the Scenes.
|
|||
- GL_COLOR_ARRAY is enabled
|
||||
- GL_TEXTURE_COORD_ARRAY is enabled
|
||||
*/
|
||||
class CC_DLL Director : public Object, public TypeInfo
|
||||
class CC_DLL Director : public Object
|
||||
{
|
||||
public:
|
||||
/** @typedef ccDirectorProjection
|
||||
|
@ -109,10 +108,6 @@ public:
|
|||
Director(void);
|
||||
virtual ~Director(void);
|
||||
virtual bool init(void);
|
||||
virtual long getClassTypeInfo() {
|
||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::Director).name());
|
||||
return id;
|
||||
}
|
||||
|
||||
// attribute
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ THE SOFTWARE.
|
|||
#include <functional>
|
||||
|
||||
#include "CCStdC.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include "CCAction.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -297,7 +296,7 @@ protected:
|
|||
@brief Calls a 'callback' with the node as the first argument
|
||||
N means Node
|
||||
*/
|
||||
class CC_DLL CallFuncN : public CallFunc, public TypeInfo
|
||||
class CC_DLL CallFuncN : public CallFunc
|
||||
{
|
||||
public:
|
||||
/** creates the action with the callback of type std::function<void()>.
|
||||
|
@ -325,11 +324,6 @@ public:
|
|||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* pSelectorTarget, SEL_CallFuncN selector);
|
||||
|
||||
virtual long getClassTypeInfo() {
|
||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CallFunc).name());
|
||||
return id;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -353,11 +347,6 @@ public:
|
|||
/** creates the action with the callback and the data to pass as an argument */
|
||||
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* selectorTarget, SEL_CallFuncND selector, void* d);
|
||||
|
||||
virtual long getClassTypeInfo() {
|
||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CallFunc).name());
|
||||
return id;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** initializes the action with the callback and the data to pass as an argument */
|
||||
bool initWithTarget(Object* selectorTarget, SEL_CallFuncND selector, void* d);
|
||||
|
@ -382,7 +371,7 @@ protected:
|
|||
@since v0.99.5
|
||||
*/
|
||||
|
||||
class CC_DLL __CCCallFuncO : public CallFunc, public TypeInfo
|
||||
class CC_DLL __CCCallFuncO : public CallFunc
|
||||
{
|
||||
public:
|
||||
/** creates the action with the callback
|
||||
|
@ -394,11 +383,6 @@ public:
|
|||
__CCCallFuncO();
|
||||
virtual ~__CCCallFuncO();
|
||||
|
||||
virtual long getClassTypeInfo() {
|
||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::CallFunc).name());
|
||||
return id;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** initializes the action with the callback
|
||||
|
||||
|
|
|
@ -26,6 +26,13 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
Color4B::Color4B(const Color4F &color4F)
|
||||
: r((GLubyte)(color4F.r * 255.0f)),
|
||||
g((GLubyte)(color4F.g * 255.0f)),
|
||||
b((GLubyte)(color4F.b * 255.0f)),
|
||||
a((GLubyte)(color4F.a * 255.0f))
|
||||
{}
|
||||
|
||||
const Color3B Color3B::WHITE(255,255,255);
|
||||
const Color3B Color3B::YELLOW(255,255,0);
|
||||
const Color3B Color3B::GREEN(0,255,0);
|
||||
|
@ -36,12 +43,25 @@ const Color3B Color3B::BLACK(0,0,0);
|
|||
const Color3B Color3B::ORANGE(255,127,0);
|
||||
const Color3B Color3B::GRAY(166,166,166);
|
||||
|
||||
Color4B::Color4B(const Color4F &color4F)
|
||||
: r((GLubyte)(color4F.r * 255.0f)),
|
||||
g((GLubyte)(color4F.g * 255.0f)),
|
||||
b((GLubyte)(color4F.b * 255.0f)),
|
||||
a((GLubyte)(color4F.a * 255.0f))
|
||||
{}
|
||||
const Color4B Color4B::WHITE(255,255,255,255);
|
||||
const Color4B Color4B::YELLOW(255,255,0,255);
|
||||
const Color4B Color4B::GREEN(0,255,0,255);
|
||||
const Color4B Color4B::BLUE(0,0,255,255);
|
||||
const Color4B Color4B::RED(255,0,0,255);
|
||||
const Color4B Color4B::MAGENTA(255,0,255,255);
|
||||
const Color4B Color4B::BLACK(0,0,0,255);
|
||||
const Color4B Color4B::ORANGE(255,127,0,255);
|
||||
const Color4B Color4B::GRAY(166,166,166,255);
|
||||
|
||||
const Color4F Color4F::WHITE(1,1,1,1);
|
||||
const Color4F Color4F::YELLOW(1,1,0,1);
|
||||
const Color4F Color4F::GREEN(0,1,0,1);
|
||||
const Color4F Color4F::BLUE(0,0,1,1);
|
||||
const Color4F Color4F::RED(1,0,0,1);
|
||||
const Color4F Color4F::MAGENTA(1,0,1,1);
|
||||
const Color4F Color4F::BLACK(0,0,0,1);
|
||||
const Color4F Color4F::ORANGE(1,0.5,0,1);
|
||||
const Color4F Color4F::GRAY(0.65,0.65,0.65,1);
|
||||
|
||||
const BlendFunc BlendFunc::DISABLE = {GL_ONE, GL_ZERO};
|
||||
const BlendFunc BlendFunc::ALPHA_PREMULTIPLIED = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef cocos2dx_ccTypeInfo_h
|
||||
#define cocos2dx_ccTypeInfo_h
|
||||
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
|
||||
#include <typeinfo>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class TypeInfo
|
||||
{
|
||||
public:
|
||||
virtual long getClassTypeInfo() = 0;
|
||||
};
|
||||
|
||||
static inline unsigned int getHashCodeByString(const char *key)
|
||||
{
|
||||
size_t len = strlen(key);
|
||||
const char *end=key+len;
|
||||
unsigned int hash;
|
||||
|
||||
for (hash = 0; key < end; key++)
|
||||
{
|
||||
hash *= 16777619;
|
||||
hash ^= (unsigned int) (unsigned char) toupper(*key);
|
||||
}
|
||||
return (hash);
|
||||
}
|
||||
NS_CC_END
|
||||
|
||||
#endif
|
|
@ -92,6 +92,16 @@ struct Color4B
|
|||
GLubyte g;
|
||||
GLubyte b;
|
||||
GLubyte a;
|
||||
|
||||
const static Color4B WHITE;
|
||||
const static Color4B YELLOW;
|
||||
const static Color4B BLUE;
|
||||
const static Color4B GREEN;
|
||||
const static Color4B RED;
|
||||
const static Color4B MAGENTA;
|
||||
const static Color4B BLACK;
|
||||
const static Color4B ORANGE;
|
||||
const static Color4B GRAY;
|
||||
};
|
||||
|
||||
|
||||
|
@ -135,6 +145,16 @@ struct Color4F
|
|||
GLfloat g;
|
||||
GLfloat b;
|
||||
GLfloat a;
|
||||
|
||||
const static Color4F WHITE;
|
||||
const static Color4F YELLOW;
|
||||
const static Color4F BLUE;
|
||||
const static Color4F GREEN;
|
||||
const static Color4F RED;
|
||||
const static Color4F MAGENTA;
|
||||
const static Color4F BLACK;
|
||||
const static Color4F ORANGE;
|
||||
const static Color4F GRAY;
|
||||
};
|
||||
|
||||
/** A vertex composed of 2 floats: x, y
|
||||
|
|
|
@ -29,7 +29,6 @@ THE SOFTWARE.
|
|||
#include <map>
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -41,20 +40,11 @@ class Array;
|
|||
*/
|
||||
|
||||
//! @brief Helper class to handle file operations
|
||||
class CC_DLL FileUtils : public TypeInfo
|
||||
class CC_DLL FileUtils
|
||||
{
|
||||
friend class Array;
|
||||
friend class Dictionary;
|
||||
public:
|
||||
/**
|
||||
* Returns an unique ID for this class.
|
||||
* @note It's only used for JSBindings now.
|
||||
* @return The unique ID for this class.
|
||||
*/
|
||||
virtual long getClassTypeInfo() {
|
||||
static const long id = cocos2d::getHashCodeByString(typeid(cocos2d::FileUtils).name());
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the instance of FileUtils.
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "jni.h"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <vector>
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <vector>
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ THE SOFTWARE.
|
|||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
#include <unistd.h>
|
||||
|
||||
USING_NS_CC;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "platform/CCPlatformMacros.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -29,7 +29,6 @@ THE SOFTWARE.
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
#include "ccTypeInfo.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ Sprite* Sprite::create(const char *filename, const Rect& rect)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Sprite* Sprite::createWithSpriteFrame(SpriteFrame *pSpriteFrame)
|
||||
Sprite* Sprite::createWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
Sprite *sprite = new Sprite();
|
||||
if (pSpriteFrame && sprite && sprite->initWithSpriteFrame(pSpriteFrame))
|
||||
if (spriteFrame && sprite && sprite->initWithSpriteFrame(spriteFrame))
|
||||
{
|
||||
sprite->autorelease();
|
||||
return sprite;
|
||||
|
@ -118,26 +118,26 @@ Sprite* Sprite::createWithSpriteFrame(SpriteFrame *pSpriteFrame)
|
|||
|
||||
Sprite* Sprite::createWithSpriteFrameName(const char *spriteFrameName)
|
||||
{
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
|
||||
#if COCOS2D_DEBUG > 0
|
||||
char msg[256] = {0};
|
||||
sprintf(msg, "Invalid spriteFrameName: %s", spriteFrameName);
|
||||
CCASSERT(pFrame != NULL, msg);
|
||||
CCASSERT(frame != NULL, msg);
|
||||
#endif
|
||||
|
||||
return createWithSpriteFrame(pFrame);
|
||||
return createWithSpriteFrame(frame);
|
||||
}
|
||||
|
||||
Sprite* Sprite::create()
|
||||
{
|
||||
Sprite *pSprite = new Sprite();
|
||||
if (pSprite && pSprite->init())
|
||||
Sprite *sprite = new Sprite();
|
||||
if (sprite && sprite->init())
|
||||
{
|
||||
pSprite->autorelease();
|
||||
return pSprite;
|
||||
sprite->autorelease();
|
||||
return sprite;
|
||||
}
|
||||
CC_SAFE_DELETE(pSprite);
|
||||
CC_SAFE_DELETE(sprite);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -174,11 +174,10 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
|||
memset(&_quad, 0, sizeof(_quad));
|
||||
|
||||
// Atlas: Color
|
||||
Color4B tmpColor(255, 255, 255, 255);
|
||||
_quad.bl.colors = tmpColor;
|
||||
_quad.br.colors = tmpColor;
|
||||
_quad.tl.colors = tmpColor;
|
||||
_quad.tr.colors = tmpColor;
|
||||
_quad.bl.colors = Color4B::WHITE;
|
||||
_quad.br.colors = Color4B::WHITE;
|
||||
_quad.tl.colors = Color4B::WHITE;
|
||||
_quad.tr.colors = Color4B::WHITE;
|
||||
|
||||
// shader program
|
||||
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
|
@ -248,12 +247,12 @@ bool Sprite::initWithFile(const char *filename, const Rect& rect)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Sprite::initWithSpriteFrame(SpriteFrame *pSpriteFrame)
|
||||
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
CCASSERT(pSpriteFrame != NULL, "");
|
||||
CCASSERT(spriteFrame != NULL, "");
|
||||
|
||||
bool bRet = initWithTexture(pSpriteFrame->getTexture(), pSpriteFrame->getRect());
|
||||
setDisplayFrame(pSpriteFrame);
|
||||
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
|
||||
setDisplayFrame(spriteFrame);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
@ -262,8 +261,8 @@ bool Sprite::initWithSpriteFrameName(const char *spriteFrameName)
|
|||
{
|
||||
CCASSERT(spriteFrameName != NULL, "");
|
||||
|
||||
SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
return initWithSpriteFrame(pFrame);
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
return initWithSpriteFrame(frame);
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
|
@ -293,8 +292,8 @@ Sprite* Sprite::initWithCGImage(CGImageRef pImage, const char *pszKey)
|
|||
*/
|
||||
|
||||
Sprite::Sprite(void)
|
||||
: _shouldBeHidden(false),
|
||||
_texture(NULL)
|
||||
: _shouldBeHidden(false)
|
||||
, _texture(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -453,7 +452,7 @@ void Sprite::updateTransform(void)
|
|||
if( isDirty() ) {
|
||||
|
||||
// If it is not visible, or one of its ancestors is not visible, then do nothing:
|
||||
if( !_visible || ( _parent && _parent != _batchNode && ((Sprite*)_parent)->_shouldBeHidden) )
|
||||
if( !_visible || ( _parent && _parent != _batchNode && static_cast<Sprite*>(_parent)->_shouldBeHidden) )
|
||||
{
|
||||
_quad.br.vertices = _quad.tl.vertices = _quad.tr.vertices = _quad.bl.vertices = Vertex3F(0,0,0);
|
||||
_shouldBeHidden = true;
|
||||
|
@ -469,7 +468,7 @@ void Sprite::updateTransform(void)
|
|||
else
|
||||
{
|
||||
CCASSERT( dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
|
||||
_transformToBatch = AffineTransformConcat( getNodeToParentTransform() , ((Sprite*)_parent)->_transformToBatch );
|
||||
_transformToBatch = AffineTransformConcat( getNodeToParentTransform() , static_cast<Sprite*>(_parent)->_transformToBatch );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -659,25 +658,25 @@ void Sprite::reorderChild(Node *child, int zOrder)
|
|||
Node::reorderChild(child, zOrder);
|
||||
}
|
||||
|
||||
void Sprite::removeChild(Node *child, bool bCleanup)
|
||||
void Sprite::removeChild(Node *child, bool cleanup)
|
||||
{
|
||||
if (_batchNode)
|
||||
{
|
||||
_batchNode->removeSpriteFromAtlas((Sprite*)(child));
|
||||
}
|
||||
|
||||
Node::removeChild(child, bCleanup);
|
||||
Node::removeChild(child, cleanup);
|
||||
|
||||
}
|
||||
|
||||
void Sprite::removeAllChildrenWithCleanup(bool bCleanup)
|
||||
void Sprite::removeAllChildrenWithCleanup(bool cleanup)
|
||||
{
|
||||
if (_batchNode)
|
||||
{
|
||||
Object* pObject = NULL;
|
||||
CCARRAY_FOREACH(_children, pObject)
|
||||
Object* object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Sprite* child = dynamic_cast<Sprite*>(pObject);
|
||||
Sprite* child = dynamic_cast<Sprite*>(object);
|
||||
if (child)
|
||||
{
|
||||
_batchNode->removeSpriteFromAtlas(child);
|
||||
|
@ -685,7 +684,7 @@ void Sprite::removeAllChildrenWithCleanup(bool bCleanup)
|
|||
}
|
||||
}
|
||||
|
||||
Node::removeAllChildrenWithCleanup(bCleanup);
|
||||
Node::removeAllChildrenWithCleanup(cleanup);
|
||||
|
||||
_hasChildren = false;
|
||||
}
|
||||
|
@ -736,11 +735,11 @@ void Sprite::setReorderChildDirtyRecursively(void)
|
|||
if ( ! _reorderChildDirty )
|
||||
{
|
||||
_reorderChildDirty = true;
|
||||
Node* pNode = (Node*)_parent;
|
||||
while (pNode && pNode != _batchNode)
|
||||
Node* node = static_cast<Node*>(_parent);
|
||||
while (node && node != _batchNode)
|
||||
{
|
||||
((Sprite*)pNode)->setReorderChildDirtyRecursively();
|
||||
pNode=pNode->getParent();
|
||||
static_cast<Sprite*>(node)->setReorderChildDirtyRecursively();
|
||||
node=node->getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -753,10 +752,10 @@ void Sprite::setDirtyRecursively(bool bValue)
|
|||
// recursively set dirty
|
||||
if (_hasChildren)
|
||||
{
|
||||
Object* pObject = NULL;
|
||||
CCARRAY_FOREACH(_children, pObject)
|
||||
Object* object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Sprite* child = dynamic_cast<Sprite*>(pObject);
|
||||
Sprite* child = dynamic_cast<Sprite*>(object);
|
||||
if (child)
|
||||
{
|
||||
child->setDirtyRecursively(true);
|
||||
|
@ -996,13 +995,13 @@ void Sprite::setDisplayFrameWithAnimationName(const char *animationName, int fra
|
|||
setDisplayFrame(frame->getSpriteFrame());
|
||||
}
|
||||
|
||||
bool Sprite::isFrameDisplayed(SpriteFrame *pFrame) const
|
||||
bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
||||
{
|
||||
Rect r = pFrame->getRect();
|
||||
Rect r = frame->getRect();
|
||||
|
||||
return (r.equals(_rect) &&
|
||||
pFrame->getTexture()->getName() == _texture->getName() &&
|
||||
pFrame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
||||
frame->getTexture()->getName() == _texture->getName() &&
|
||||
frame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
||||
}
|
||||
|
||||
SpriteFrame* Sprite::displayFrame(void)
|
||||
|
|
|
@ -125,7 +125,7 @@ const char* ProfilingTimer::description() const
|
|||
{
|
||||
static char s_desciption[512] = {0};
|
||||
|
||||
sprintf(s_desciption, "%s ::\tavg1: %dµ,\tavg2: %dµ,\tmin: %dµ,\tmax: %dµ,\ttotal: %.4fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls);
|
||||
sprintf(s_desciption, "%s ::\tavg1: %dµ,\tavg2: %dµ,\tmin: %dµ,\tmax: %dµ,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls);
|
||||
return s_desciption;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,111 @@ LOCAL_MODULE := cocos_extension_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libextension
|
||||
|
||||
dirs := $(shell find $(LOCAL_PATH) -type d -print)
|
||||
find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp))
|
||||
|
||||
LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files))
|
||||
LOCAL_SRC_FILES := \
|
||||
CCDeprecated-ext.cpp \
|
||||
AssetsManager/AssetsManager.cpp \
|
||||
CCArmature/CCArmature.cpp \
|
||||
CCArmature/CCBone.cpp \
|
||||
CCArmature/animation/CCArmatureAnimation.cpp \
|
||||
CCArmature/animation/CCProcessBase.cpp \
|
||||
CCArmature/animation/CCTween.cpp \
|
||||
CCArmature/datas/CCDatas.cpp \
|
||||
CCArmature/display/CCBatchNode.cpp \
|
||||
CCArmature/display/CCDecorativeDisplay.cpp \
|
||||
CCArmature/display/CCDisplayFactory.cpp \
|
||||
CCArmature/display/CCDisplayManager.cpp \
|
||||
CCArmature/display/CCShaderNode.cpp \
|
||||
CCArmature/display/CCSkin.cpp \
|
||||
CCArmature/external_tool/CCTexture2DMutable.cpp \
|
||||
CCArmature/external_tool/GLES-Render.cpp \
|
||||
CCArmature/external_tool/Json/CSContentJsonDictionary.cpp \
|
||||
CCArmature/external_tool/Json/lib_json/json_reader.cpp \
|
||||
CCArmature/external_tool/Json/lib_json/json_value.cpp \
|
||||
CCArmature/external_tool/Json/lib_json/json_writer.cpp \
|
||||
CCArmature/physics/CCColliderDetector.cpp \
|
||||
CCArmature/physics/CCPhysicsWorld.cpp \
|
||||
CCArmature/utils/CCArmatureDataManager.cpp \
|
||||
CCArmature/utils/CCDataReaderHelper.cpp \
|
||||
CCArmature/utils/CCSpriteFrameCacheHelper.cpp \
|
||||
CCArmature/utils/CCTransformHelp.cpp \
|
||||
CCArmature/utils/CCTweenFunction.cpp \
|
||||
CCArmature/utils/CCUtilMath.cpp \
|
||||
CCBReader/CCBAnimationManager.cpp \
|
||||
CCBReader/CCBFileLoader.cpp \
|
||||
CCBReader/CCBKeyframe.cpp \
|
||||
CCBReader/CCBReader.cpp \
|
||||
CCBReader/CCBSequence.cpp \
|
||||
CCBReader/CCBSequenceProperty.cpp \
|
||||
CCBReader/CCBValue.cpp \
|
||||
CCBReader/CCControlButtonLoader.cpp \
|
||||
CCBReader/CCControlLoader.cpp \
|
||||
CCBReader/CCLabelBMFontLoader.cpp \
|
||||
CCBReader/CCLabelTTFLoader.cpp \
|
||||
CCBReader/CCLayerColorLoader.cpp \
|
||||
CCBReader/CCLayerGradientLoader.cpp \
|
||||
CCBReader/CCLayerLoader.cpp \
|
||||
CCBReader/CCMenuItemImageLoader.cpp \
|
||||
CCBReader/CCMenuItemLoader.cpp \
|
||||
CCBReader/CCNode+CCBRelativePositioning.cpp \
|
||||
CCBReader/CCNodeLoader.cpp \
|
||||
CCBReader/CCNodeLoaderLibrary.cpp \
|
||||
CCBReader/CCParticleSystemQuadLoader.cpp \
|
||||
CCBReader/CCScale9SpriteLoader.cpp \
|
||||
CCBReader/CCScrollViewLoader.cpp \
|
||||
CCBReader/CCSpriteLoader.cpp \
|
||||
Components/CCComAttribute.cpp \
|
||||
Components/CCComAudio.cpp \
|
||||
Components/CCComController.cpp \
|
||||
Components/CCInputDelegate.cpp \
|
||||
GUI/CCControlExtension/CCControl.cpp \
|
||||
GUI/CCControlExtension/CCControlButton.cpp \
|
||||
GUI/CCControlExtension/CCControlColourPicker.cpp \
|
||||
GUI/CCControlExtension/CCControlHuePicker.cpp \
|
||||
GUI/CCControlExtension/CCControlPotentiometer.cpp \
|
||||
GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp \
|
||||
GUI/CCControlExtension/CCControlSlider.cpp \
|
||||
GUI/CCControlExtension/CCControlStepper.cpp \
|
||||
GUI/CCControlExtension/CCControlSwitch.cpp \
|
||||
GUI/CCControlExtension/CCControlUtils.cpp \
|
||||
GUI/CCControlExtension/CCInvocation.cpp \
|
||||
GUI/CCControlExtension/CCScale9Sprite.cpp \
|
||||
GUI/CCEditBox/CCEditBox.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplAndroid.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplNone.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplTizen.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplWin.cpp \
|
||||
GUI/CCScrollView/CCScrollView.cpp \
|
||||
GUI/CCScrollView/CCSorting.cpp \
|
||||
GUI/CCScrollView/CCTableView.cpp \
|
||||
GUI/CCScrollView/CCTableViewCell.cpp \
|
||||
LocalStorage/LocalStorage.cpp \
|
||||
LocalStorage/LocalStorageAndroid.cpp \
|
||||
network/HttpClient.cpp \
|
||||
network/SocketIO.cpp \
|
||||
network/WebSocket.cpp \
|
||||
physics_nodes/CCPhysicsDebugNode.cpp \
|
||||
physics_nodes/CCPhysicsSprite.cpp \
|
||||
spine/Animation.cpp \
|
||||
spine/AnimationState.cpp \
|
||||
spine/AnimationStateData.cpp \
|
||||
spine/Atlas.cpp \
|
||||
spine/AtlasAttachmentLoader.cpp \
|
||||
spine/Attachment.cpp \
|
||||
spine/AttachmentLoader.cpp \
|
||||
spine/Bone.cpp \
|
||||
spine/BoneData.cpp \
|
||||
spine/CCSkeleton.cpp \
|
||||
spine/CCSkeletonAnimation.cpp \
|
||||
spine/extension.cpp \
|
||||
spine/Json.cpp \
|
||||
spine/RegionAttachment.cpp \
|
||||
spine/Skeleton.cpp \
|
||||
spine/SkeletonData.cpp \
|
||||
spine/SkeletonJson.cpp \
|
||||
spine/Skin.cpp \
|
||||
spine/Slot.cpp \
|
||||
spine/SlotData.cpp \
|
||||
spine/spine-cocos2dx.cpp
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
|
|
|
@ -6,10 +6,52 @@ LOCAL_MODULE := box2d_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libbox2d
|
||||
|
||||
dirs := $(shell find $(LOCAL_PATH) -type d -print)
|
||||
find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp))
|
||||
|
||||
LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files))
|
||||
LOCAL_SRC_FILES := \
|
||||
Collision/b2BroadPhase.cpp \
|
||||
Collision/b2CollideCircle.cpp \
|
||||
Collision/b2CollideEdge.cpp \
|
||||
Collision/b2CollidePolygon.cpp \
|
||||
Collision/b2Collision.cpp \
|
||||
Collision/b2Distance.cpp \
|
||||
Collision/b2DynamicTree.cpp \
|
||||
Collision/b2TimeOfImpact.cpp \
|
||||
Collision/Shapes/b2ChainShape.cpp \
|
||||
Collision/Shapes/b2CircleShape.cpp \
|
||||
Collision/Shapes/b2EdgeShape.cpp \
|
||||
Collision/Shapes/b2PolygonShape.cpp \
|
||||
Common/b2BlockAllocator.cpp \
|
||||
Common/b2Draw.cpp \
|
||||
Common/b2Math.cpp \
|
||||
Common/b2Settings.cpp \
|
||||
Common/b2StackAllocator.cpp \
|
||||
Common/b2Timer.cpp \
|
||||
Dynamics/b2Body.cpp \
|
||||
Dynamics/b2ContactManager.cpp \
|
||||
Dynamics/b2Fixture.cpp \
|
||||
Dynamics/b2Island.cpp \
|
||||
Dynamics/b2World.cpp \
|
||||
Dynamics/b2WorldCallbacks.cpp \
|
||||
Dynamics/Contacts/b2ChainAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2ChainAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2CircleContact.cpp \
|
||||
Dynamics/Contacts/b2Contact.cpp \
|
||||
Dynamics/Contacts/b2ContactSolver.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonContact.cpp \
|
||||
Dynamics/Joints/b2DistanceJoint.cpp \
|
||||
Dynamics/Joints/b2FrictionJoint.cpp \
|
||||
Dynamics/Joints/b2GearJoint.cpp \
|
||||
Dynamics/Joints/b2Joint.cpp \
|
||||
Dynamics/Joints/b2MouseJoint.cpp \
|
||||
Dynamics/Joints/b2PrismaticJoint.cpp \
|
||||
Dynamics/Joints/b2PulleyJoint.cpp \
|
||||
Dynamics/Joints/b2RevoluteJoint.cpp \
|
||||
Dynamics/Joints/b2RopeJoint.cpp \
|
||||
Dynamics/Joints/b2WeldJoint.cpp \
|
||||
Dynamics/Joints/b2WheelJoint.cpp \
|
||||
Rope/b2Rope.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
|
|
|
@ -6,10 +6,36 @@ LOCAL_MODULE := chipmunk_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libchipmunk
|
||||
|
||||
dirs := $(shell find $(LOCAL_PATH) -type d -print)
|
||||
find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.c))
|
||||
|
||||
LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files))
|
||||
LOCAL_SRC_FILES := \
|
||||
src/chipmunk.c \
|
||||
src/cpArbiter.c \
|
||||
src/cpArray.c \
|
||||
src/cpBB.c \
|
||||
src/cpBBTree.c \
|
||||
src/cpBody.c \
|
||||
src/cpCollision.c \
|
||||
src/cpHashSet.c \
|
||||
src/cpPolyShape.c \
|
||||
src/cpShape.c \
|
||||
src/cpSpace.c \
|
||||
src/cpSpaceComponent.c \
|
||||
src/cpSpaceHash.c \
|
||||
src/cpSpaceQuery.c \
|
||||
src/cpSpaceStep.c \
|
||||
src/cpSpatialIndex.c \
|
||||
src/cpSweep1D.c \
|
||||
src/cpVect.c \
|
||||
src/constraints/cpConstraint.c \
|
||||
src/constraints/cpDampedRotarySpring.c \
|
||||
src/constraints/cpDampedSpring.c \
|
||||
src/constraints/cpGearJoint.c \
|
||||
src/constraints/cpGrooveJoint.c \
|
||||
src/constraints/cpPinJoint.c \
|
||||
src/constraints/cpPivotJoint.c \
|
||||
src/constraints/cpRatchetJoint.c \
|
||||
src/constraints/cpRotaryLimitJoint.c \
|
||||
src/constraints/cpSimpleMotor.c \
|
||||
src/constraints/cpSlideJoint.c
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;libcurl_imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;libcurl_imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -155,7 +155,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;libcurl_imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;libcurl_imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -6,10 +6,113 @@ LOCAL_MODULE := cocos_testcpp_common
|
|||
|
||||
LOCAL_MODULE_FILENAME := libtestcppcommon
|
||||
|
||||
dirs := $(shell find $(LOCAL_PATH)/Classes -type d -print)
|
||||
find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp))
|
||||
|
||||
LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files))
|
||||
LOCAL_SRC_FILES := \
|
||||
Classes/AppDelegate.cpp \
|
||||
Classes/BaseTest.cpp \
|
||||
Classes/controller.cpp \
|
||||
Classes/testBasic.cpp \
|
||||
Classes/VisibleRect.cpp \
|
||||
Classes/AccelerometerTest/AccelerometerTest.cpp \
|
||||
Classes/ActionManagerTest/ActionManagerTest.cpp \
|
||||
Classes/ActionsEaseTest/ActionsEaseTest.cpp \
|
||||
Classes/ActionsProgressTest/ActionsProgressTest.cpp \
|
||||
Classes/ActionsTest/ActionsTest.cpp \
|
||||
Classes/Box2DTest/Box2dTest.cpp \
|
||||
Classes/Box2DTestBed/Box2dView.cpp \
|
||||
Classes/Box2DTestBed/GLES-Render.cpp \
|
||||
Classes/Box2DTestBed/Test.cpp \
|
||||
Classes/Box2DTestBed/TestEntries.cpp \
|
||||
Classes/BugsTest/Bug-1159.cpp \
|
||||
Classes/BugsTest/Bug-1174.cpp \
|
||||
Classes/BugsTest/Bug-350.cpp \
|
||||
Classes/BugsTest/Bug-422.cpp \
|
||||
Classes/BugsTest/Bug-624.cpp \
|
||||
Classes/BugsTest/Bug-886.cpp \
|
||||
Classes/BugsTest/Bug-899.cpp \
|
||||
Classes/BugsTest/Bug-914.cpp \
|
||||
Classes/BugsTest/BugsTest.cpp \
|
||||
Classes/BugsTest/Bug-458/Bug-458.cpp \
|
||||
Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp \
|
||||
Classes/ChipmunkTest/ChipmunkTest.cpp \
|
||||
Classes/ClickAndMoveTest/ClickAndMoveTest.cpp \
|
||||
Classes/ClippingNodeTest/ClippingNodeTest.cpp \
|
||||
Classes/CocosDenshionTest/CocosDenshionTest.cpp \
|
||||
Classes/ConfigurationTest/ConfigurationTest.cpp \
|
||||
Classes/CurlTest/CurlTest.cpp \
|
||||
Classes/CurrentLanguageTest/CurrentLanguageTest.cpp \
|
||||
Classes/DataVisitorTest/DataVisitorTest.cpp \
|
||||
Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp \
|
||||
Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp \
|
||||
Classes/EffectsTest/EffectsTest.cpp \
|
||||
Classes/ExtensionsTest/ExtensionsTest.cpp \
|
||||
Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \
|
||||
Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp \
|
||||
Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \
|
||||
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
|
||||
Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \
|
||||
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
|
||||
Classes/FileUtilsTest/FileUtilsTest.cpp \
|
||||
Classes/FontTest/FontTest.cpp \
|
||||
Classes/IntervalTest/IntervalTest.cpp \
|
||||
Classes/KeyboardTest/KeyboardTest.cpp \
|
||||
Classes/KeypadTest/KeypadTest.cpp \
|
||||
Classes/LabelTest/LabelTest.cpp \
|
||||
Classes/LabelTest/LabelTestNew.cpp \
|
||||
Classes/LayerTest/LayerTest.cpp \
|
||||
Classes/MenuTest/MenuTest.cpp \
|
||||
Classes/MotionStreakTest/MotionStreakTest.cpp \
|
||||
Classes/MutiTouchTest/MutiTouchTest.cpp \
|
||||
Classes/NodeTest/NodeTest.cpp \
|
||||
Classes/ParallaxTest/ParallaxTest.cpp \
|
||||
Classes/ParticleTest/ParticleTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceParticleTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceSpriteTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceTextureTest.cpp \
|
||||
Classes/PerformanceTest/PerformanceTouchesTest.cpp \
|
||||
Classes/RenderTextureTest/RenderTextureTest.cpp \
|
||||
Classes/RotateWorldTest/RotateWorldTest.cpp \
|
||||
Classes/SceneTest/SceneTest.cpp \
|
||||
Classes/SchedulerTest/SchedulerTest.cpp \
|
||||
Classes/ShaderTest/ShaderTest.cpp \
|
||||
Classes/SpineTest/SpineTest.cpp \
|
||||
Classes/SpriteTest/SpriteTest.cpp \
|
||||
Classes/TextInputTest/TextInputTest.cpp \
|
||||
Classes/Texture2dTest/Texture2dTest.cpp \
|
||||
Classes/TextureCacheTest/TextureCacheTest.cpp \
|
||||
Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp \
|
||||
Classes/TileMapTest/TileMapTest.cpp \
|
||||
Classes/TouchesTest/Ball.cpp \
|
||||
Classes/TouchesTest/Paddle.cpp \
|
||||
Classes/TouchesTest/TouchesTest.cpp \
|
||||
Classes/TransitionsTest/TransitionsTest.cpp \
|
||||
Classes/UserDefaultTest/UserDefaultTest.cpp \
|
||||
Classes/ZwoptexTest/ZwoptexTest.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/Classes
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "PerformanceNodeChildrenTest.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Enable profiles for this file
|
||||
#undef CC_PROFILER_DISPLAY_TIMERS
|
||||
#define CC_PROFILER_DISPLAY_TIMERS() Profiler::getInstance()->displayTimers()
|
||||
|
@ -33,6 +35,9 @@ static std::function<NodeChildrenMainScene*()> createFunctions[] =
|
|||
CL(IterateSpriteSheetCArray),
|
||||
CL(IterateSpriteSheetIterator),
|
||||
|
||||
CL(CallFuncsSpriteSheetForEach),
|
||||
CL(CallFuncsSpriteSheetCMacro),
|
||||
|
||||
CL(AddSpriteSheet),
|
||||
CL(RemoveSpriteSheet),
|
||||
CL(ReorderSpriteSheet),
|
||||
|
@ -364,7 +369,78 @@ const char* IterateSpriteSheetIterator::profilerName()
|
|||
return "Iterator: begin(), end()";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// CallFuncsSpriteSheetForEach
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
void CallFuncsSpriteSheetForEach::update(float dt)
|
||||
{
|
||||
// iterate using fast enumeration protocol
|
||||
auto children = batchNode->getChildren();
|
||||
|
||||
CC_PROFILER_START(this->profilerName());
|
||||
|
||||
std::for_each(std::begin(*children), std::end(*children), [](Object* obj) {
|
||||
static_cast<Node*>(obj)->getPosition();
|
||||
});
|
||||
|
||||
CC_PROFILER_STOP(this->profilerName());
|
||||
}
|
||||
|
||||
|
||||
std::string CallFuncsSpriteSheetForEach::title()
|
||||
{
|
||||
return "D - 'map' functional call";
|
||||
}
|
||||
|
||||
std::string CallFuncsSpriteSheetForEach::subtitle()
|
||||
{
|
||||
return "Using 'std::for_each()'. See console";
|
||||
}
|
||||
|
||||
const char* CallFuncsSpriteSheetForEach::profilerName()
|
||||
{
|
||||
static char _name[256];
|
||||
snprintf(_name, sizeof(_name)-1, "Map: std::for_each(%d)", quantityOfNodes);
|
||||
return _name;
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// CallFuncsSpriteSheetCMacro
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
void CallFuncsSpriteSheetCMacro::update(float dt)
|
||||
{
|
||||
// iterate using fast enumeration protocol
|
||||
auto children = batchNode->getChildren();
|
||||
|
||||
CC_PROFILER_START(this->profilerName());
|
||||
|
||||
arrayMakeObjectsPerformSelector(children, getPosition, Node*);
|
||||
|
||||
CC_PROFILER_STOP(this->profilerName());
|
||||
}
|
||||
|
||||
|
||||
std::string CallFuncsSpriteSheetCMacro::title()
|
||||
{
|
||||
return "E - 'map' functional call";
|
||||
}
|
||||
|
||||
std::string CallFuncsSpriteSheetCMacro::subtitle()
|
||||
{
|
||||
return "Using 'arrayMakeObjectsPerformSelector'. See console";
|
||||
}
|
||||
|
||||
const char* CallFuncsSpriteSheetCMacro::profilerName()
|
||||
{
|
||||
static char _name[256];
|
||||
snprintf(_name, sizeof(_name)-1, "Map: arrayMakeObjectsPerformSelector(%d)", quantityOfNodes);
|
||||
return _name;
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// AddRemoveSpriteSheet
|
||||
|
|
|
@ -94,6 +94,30 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
class CallFuncsSpriteSheetForEach : public IterateSpriteSheet
|
||||
{
|
||||
public:
|
||||
virtual void update(float dt);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
class CallFuncsSpriteSheetCMacro : public IterateSpriteSheet
|
||||
{
|
||||
public:
|
||||
virtual void update(float dt);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
class AddSpriteSheet : public AddRemoveSpriteSheet
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -2072,9 +2072,9 @@ std::string TextureS3TCDxt5::subtitle()
|
|||
//Implement of ATITC
|
||||
TextureATITCRGB::TextureATITCRGB()
|
||||
{
|
||||
Sprite *sprite = Sprite::create("Images/test_256x256_ATC_RGB_mipmaps.ktx");
|
||||
auto sprite = Sprite::create("Images/test_256x256_ATC_RGB_mipmaps.ktx");
|
||||
|
||||
Size size = Director::getInstance()->getWinSize();
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
sprite->setPosition(Point(size.width / 2, size.height / 2));
|
||||
|
||||
addChild(sprite);
|
||||
|
@ -2090,9 +2090,9 @@ std::string TextureATITCRGB::subtitle()
|
|||
|
||||
TextureATITCExplicit::TextureATITCExplicit()
|
||||
{
|
||||
Sprite *sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Explicit_mipmaps.ktx");
|
||||
auto sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Explicit_mipmaps.ktx");
|
||||
|
||||
Size size = Director::getInstance()->getWinSize();
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
sprite->setPosition(Point(size.width / 2, size.height / 2));
|
||||
|
||||
addChild(sprite);
|
||||
|
@ -2108,9 +2108,9 @@ std::string TextureATITCExplicit::subtitle()
|
|||
|
||||
TextureATITCInterpolated::TextureATITCInterpolated()
|
||||
{
|
||||
Sprite *sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Interpolated_mipmaps.ktx");
|
||||
auto sprite = Sprite::create("Images/test_256x256_ATC_RGBA_Interpolated_mipmaps.ktx");
|
||||
|
||||
Size size = Director::getInstance()->getWinSize();
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
sprite->setPosition(Point(size.width / 2, size.height /2));
|
||||
|
||||
addChild(sprite);
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -155,7 +155,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -155,7 +155,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -153,7 +153,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -55,6 +55,8 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
|
||||
sc->start();
|
||||
|
||||
FileUtils::getInstance()->addSearchPath("res");
|
||||
|
||||
auto pEngine = ScriptingCore::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||
#ifdef JS_OBFUSCATED
|
||||
|
|
|
@ -101,7 +101,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -157,7 +157,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\libwebsockets\win32\lib\*.*" "$(O
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -155,7 +155,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\li
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -40,15 +40,10 @@ extern callfuncTarget_proxy_t *_callfuncTarget_native_ht;
|
|||
template <class T>
|
||||
inline js_type_class_t *js_get_type_from_native(T* native_obj) {
|
||||
js_type_class_t *typeProxy;
|
||||
long typeId = cocos2d::getHashCodeByString(typeid(*native_obj).name());
|
||||
long typeId = typeid(*native_obj).hash_code();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
|
||||
if (!typeProxy) {
|
||||
cocos2d::TypeInfo *typeInfo = dynamic_cast<cocos2d::TypeInfo *>(native_obj);
|
||||
if (typeInfo) {
|
||||
typeId = typeInfo->getClassTypeInfo();
|
||||
} else {
|
||||
typeId = cocos2d::getHashCodeByString(typeid(T).name());
|
||||
}
|
||||
typeId = typeid(T).hash_code();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
|
||||
}
|
||||
return typeProxy;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit aad3156eaf669d8ff6dac0972a67f94f29d75f7d
|
||||
Subproject commit 5b4a4c5b94ba4920a70900d47246612adcdc0ac5
|
|
@ -37,7 +37,7 @@ class TypeTest
|
|||
But the return string from typeid(*native_obj).name() is the same string, so we must convert the string to hash id to make sure we can get unique id.
|
||||
*/
|
||||
// static const long id = reinterpret_cast<long>(typeid( DERIVED ).name());
|
||||
static const long id = cocos2d::getHashCodeByString(typeid( DERIVED ).name());
|
||||
static const long id = typeid( DERIVED ).hash_code();
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*
|
|||
xcopy /Y /Q "$(ProjectDir)..\..\..\external\libwebsockets\win32\lib\*.*" "$(OutDir)"</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -155,7 +155,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*
|
|||
xcopy /Y /Q "$(ProjectDir)..\..\..\external\libwebsockets\win32\lib\*.*" "$(OutDir)"</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;libCocosDenshion.lib;libchipmunk.lib;libJSBinding.lib;libcurl_imp.lib;mozjs-23.0.lib;ws2_32.lib;sqlite3.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import cStringIO
|
||||
import re
|
||||
|
||||
try:
|
||||
import PathUtils
|
||||
except ImportError, e:
|
||||
sys.path.append(os.path.abspath(os.path.join(os.curdir, "../pylib")))
|
||||
import PathUtils
|
||||
|
||||
COCOS_ROOT = "../../"
|
||||
|
||||
COCOS_ROOT = os.path.abspath(os.path.join(os.curdir, COCOS_ROOT))
|
||||
|
||||
def gen_android_mk(mkfile, pathes, suffix = ("c", "cpp",), exclude = ()):
|
||||
utils = PathUtils.PathUtils(COCOS_ROOT)
|
||||
filelst = utils.find_files(pathes, suffix, exclude)
|
||||
|
||||
# generate file list string
|
||||
filestrio = cStringIO.StringIO()
|
||||
for filename in filelst:
|
||||
filestrio.write(' \\\n')
|
||||
filestrio.write(os.path.relpath(filename, os.path.dirname(os.path.join(COCOS_ROOT, mkfile))))
|
||||
filestrio.write('\n')
|
||||
|
||||
# read mk file
|
||||
file = open(os.path.join(COCOS_ROOT, mkfile))
|
||||
mkstrio = cStringIO.StringIO()
|
||||
rep = re.compile("\s*LOCAL_SRC_FILES\s*:=")
|
||||
try:
|
||||
# read lines before encounter "LOCAL_EXPORT_C_INCLUDES"
|
||||
for line in file:
|
||||
if rep.match(line):
|
||||
mkstrio.write("LOCAL_SRC_FILES :=")
|
||||
break
|
||||
else:
|
||||
mkstrio.write(line)
|
||||
#mkstrio.write('\n')
|
||||
|
||||
# write file list
|
||||
mkstrio.write(filestrio.getvalue())
|
||||
|
||||
# write remaining lines
|
||||
delete = True if line[len(line) - 2] == '\\' else False
|
||||
for line in file:
|
||||
if delete:
|
||||
delete = True if line[len(line) - 2] == '\\' else False
|
||||
else:
|
||||
mkstrio.write(line)
|
||||
#mkstrio.write('\n')
|
||||
finally:
|
||||
file.close()
|
||||
|
||||
|
||||
|
||||
file = open(os.path.join(COCOS_ROOT, mkfile), "w")
|
||||
file.write(mkstrio.getvalue())
|
||||
file.close()
|
||||
|
||||
filestrio.close()
|
||||
mkstrio.close()
|
||||
|
||||
def main():
|
||||
config = open("./config.py")
|
||||
params = eval(config.read())
|
||||
config.close()
|
||||
|
||||
for param in params:
|
||||
gen_android_mk(**param)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
|
@ -0,0 +1,24 @@
|
|||
[
|
||||
{
|
||||
'mkfile' : 'cocos2dx/Android.mk',
|
||||
'pathes' : ("cocos2dx/",),
|
||||
'exclude' : ("cocos2dx/platform/android", "cocos2dx/platform/emscripten", "cocos2dx/platform/ios", "cocos2dx/platform/linux", "cocos2dx/platform/mac", "cocos2dx/platform/nacl", "cocos2dx/platform/qt5", "cocos2dx/platform/tizen", "cocos2dx/platform/win32", "cocos2dx/label_nodes/CCFontCache.cpp", "cocos2dx/base_nodes/CCGLBufferedNode.cpp","cocos2dx/support/user_default/CCUserDefault.cpp")
|
||||
},
|
||||
{
|
||||
'mkfile' : 'samples/Cpp/TestCpp/Android.mk',
|
||||
'pathes' : ("samples/Cpp/TestCpp/Classes",),
|
||||
},
|
||||
{
|
||||
'mkfile' : 'extensions/Android.mk',
|
||||
'pathes' : ("extensions/",),
|
||||
'exclude' : ("extensions/proj.win32", "extensions/proj.emscripten", "extensions/proj.ios", "extensions/proj.linux", "extensions/proj.mac", "extensions/proj.nacl", "extensions/proj.qt5", "extensions/proj.tizen")
|
||||
},
|
||||
{
|
||||
'mkfile' : 'external/Box2D/Android.mk',
|
||||
'pathes' : ("external/Box2D/",),
|
||||
},
|
||||
{
|
||||
'mkfile' : 'external/chipmunk/Android.mk',
|
||||
'pathes' : ("external/chipmunk/",),
|
||||
},
|
||||
]
|
|
@ -32,12 +32,20 @@
|
|||
# ANOTHER_A_NAME* a = new A();
|
||||
# We will not convert it to auto for you.
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
import re
|
||||
import types
|
||||
import fileinput
|
||||
import cStringIO
|
||||
|
||||
try:
|
||||
import PathUtils
|
||||
except ImportError, e:
|
||||
import os.path
|
||||
sys.path.append(os.path.abspath("../pylib"))
|
||||
import PathUtils
|
||||
|
||||
# The cocos root entry. We will aspect it as parent dictionary, all other file or dictionary
|
||||
# relative path are base on this.
|
||||
COCOS_ROOT = "../../"
|
||||
|
@ -48,8 +56,6 @@ CXX_DIR = ("Samples",)
|
|||
# The dictionaries and files with class declaration you don't want to search, you can exclude some third party
|
||||
# dictionaries in here
|
||||
EXCLUDE = ("cocos2dx/platform/third_party/",)
|
||||
# The extra dictionaries and files with class declaration. You can add some extra .h files in it
|
||||
INCLUDE = ()
|
||||
# The macroes use with declare class, like "class CC_DLL A{}"
|
||||
MACROES_WITH_CLASS = ("CC_DLL",)
|
||||
# The strings represent the null pointer, because you set a point to null, we will not change that
|
||||
|
@ -57,218 +63,152 @@ MACROES_WITH_CLASS = ("CC_DLL",)
|
|||
NULL_PTR = ("0", "NULL", "nullptr")
|
||||
|
||||
# normalize the path
|
||||
COCOS_ROOT = os.path.abspath(COCOS_ROOT)
|
||||
|
||||
def check_file_match_rep(repString, filePath):
|
||||
'''Check the file with filepath is match the repstring or not.
|
||||
Return True if match, return False if not.
|
||||
NOTE: it will check the EXCLUDE files and directories, if the file is in the EXCLUDE directories
|
||||
or is a EXCLUDE file, it will return False.'''
|
||||
|
||||
#normalize the path
|
||||
realFilePath = os.path.abspath(filePath)
|
||||
|
||||
if not os.path.isfile(realFilePath):
|
||||
return False
|
||||
|
||||
rep = re.compile(repString)
|
||||
curDir, fileName = os.path.split(realFilePath)
|
||||
|
||||
# check dir is exclude or not
|
||||
for dir in EXCLUDE:
|
||||
dir = os.path.abspath(os.path.join(COCOS_ROOT, dir))
|
||||
if os.path.isdir(dir) and os.path.isdir(curDir[:len(dir)]):
|
||||
if os.path.samefile(dir, curDir[:len(dir)]):
|
||||
return False
|
||||
|
||||
if rep.match(fileName):
|
||||
# check file is exclude or not
|
||||
for file in EXCLUDE:
|
||||
if os.path.isfile(os.path.join(COCOS_ROOT, file)):
|
||||
if os.path.samefile(realFilePath, os.path.join(COCOS_ROOT, file)):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def walk_collect_h_files(lst, dirname, names):
|
||||
"collect *.h files and insert into lst"
|
||||
|
||||
for name in names:
|
||||
if check_file_match_rep(".*\.h$", os.path.join(dirname, name)):
|
||||
if type(lst) is types.ListType:
|
||||
lst += [os.path.relpath(os.path.abspath(os.path.join(dirname, name)), COCOS_ROOT)]
|
||||
|
||||
def walk_collect_cxx_files(lst, dirname, names):
|
||||
"collect *.cpp and *.mm files and insert into lst"
|
||||
|
||||
for name in names:
|
||||
if check_file_match_rep(".*\.(?:cpp)|(?:mm)$", os.path.join(dirname, name)):
|
||||
if type(lst) is types.ListType:
|
||||
lst += [os.path.relpath(os.path.abspath(os.path.join(dirname, name)), COCOS_ROOT)]
|
||||
COCOS_ROOT = os.path.abspath(os.path.join(os.curdir, COCOS_ROOT))
|
||||
|
||||
def collect_class_name(filename, st):
|
||||
"collect all class name appear in the file"
|
||||
"collect all class name appear in the file"
|
||||
|
||||
#generate the rep
|
||||
if not hasattr(collect_class_name, "rep"):
|
||||
repString = cStringIO.StringIO()
|
||||
repString.write("(?:\s+|^)class\s+")
|
||||
for word in MACROES_WITH_CLASS:
|
||||
repString.write(word + "\s+")
|
||||
repString.write("(?P<cls_name>\w+)")
|
||||
#generate the rep
|
||||
if not hasattr(collect_class_name, "rep"):
|
||||
repString = cStringIO.StringIO()
|
||||
repString.write("(?:\s+|^)class\s+")
|
||||
for word in MACROES_WITH_CLASS:
|
||||
repString.write(word + "\s+")
|
||||
repString.write("(?P<cls_name>\w+)")
|
||||
|
||||
collect_class_name.rep = re.compile(repString.getvalue())
|
||||
repString.close()
|
||||
collect_class_name.rep = re.compile(repString.getvalue())
|
||||
repString.close()
|
||||
|
||||
f = open(os.path.join(COCOS_ROOT, filename))
|
||||
try:
|
||||
for line in f:
|
||||
res = collect_class_name.rep.match(line)
|
||||
if res:
|
||||
if type(st) == type(set()):
|
||||
st.add(res.group("cls_name"))
|
||||
finally:
|
||||
f.close()
|
||||
f = open(os.path.join(COCOS_ROOT, filename))
|
||||
try:
|
||||
for line in f:
|
||||
res = collect_class_name.rep.match(line)
|
||||
if res:
|
||||
if type(st) == type(set()):
|
||||
st.add(res.group("cls_name"))
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
def change_local_classvarname_to_auto(filename, rep, change):
|
||||
"change all local class variable name to auto"
|
||||
f = open(filename)
|
||||
"change all local class variable name to auto"
|
||||
f = open(filename)
|
||||
|
||||
content = None
|
||||
changed = False
|
||||
# read the file, change it, and save it to content
|
||||
try:
|
||||
content = cStringIO.StringIO()
|
||||
changed = False
|
||||
|
||||
for line in f:
|
||||
i = 0
|
||||
#start to replace
|
||||
while True:
|
||||
result = rep.match(line, i)
|
||||
# founded
|
||||
if result:
|
||||
changed = True
|
||||
#find the matched string where to start
|
||||
startIndex = line.index(result.group(0))
|
||||
#replace the change part
|
||||
line = line.replace(result.group(change), "auto ", startIndex)
|
||||
i += 1
|
||||
else:
|
||||
break
|
||||
#write the result to content
|
||||
content.write(line)
|
||||
finally:
|
||||
f.close()
|
||||
if changed:
|
||||
f = open(filename, "w")
|
||||
f.write(content.getvalue())
|
||||
f.close()
|
||||
content.close()
|
||||
content = None
|
||||
changed = False
|
||||
# read the file, change it, and save it to content
|
||||
try:
|
||||
content = cStringIO.StringIO()
|
||||
changed = False
|
||||
|
||||
for line in f:
|
||||
i = 0
|
||||
#start to replace
|
||||
while True:
|
||||
result = rep.match(line, i)
|
||||
# founded
|
||||
if result:
|
||||
changed = True
|
||||
#find the matched string where to start
|
||||
startIndex = line.index(result.group(0))
|
||||
#replace the change part
|
||||
line = line.replace(result.group(change), "auto ", startIndex)
|
||||
i += 1
|
||||
else:
|
||||
break
|
||||
#write the result to content
|
||||
content.write(line)
|
||||
finally:
|
||||
f.close()
|
||||
if changed:
|
||||
f = open(filename, "w")
|
||||
f.write(content.getvalue())
|
||||
f.close()
|
||||
content.close()
|
||||
|
||||
def main():
|
||||
|
||||
print ".......VARIABLES......."
|
||||
print "COCOS_ROOT:",
|
||||
print COCOS_ROOT
|
||||
print "H_DIR:",
|
||||
print H_DIR
|
||||
print "CXX_DIR:",
|
||||
print CXX_DIR
|
||||
print "EXCLUDE:",
|
||||
print EXCLUDE
|
||||
print "INCLUDE:",
|
||||
print INCLUDE
|
||||
print ".......VARIABLES END......"
|
||||
print ".......VARIABLES......."
|
||||
print "COCOS_ROOT:",
|
||||
print COCOS_ROOT
|
||||
print "H_DIR:",
|
||||
print H_DIR
|
||||
print "CXX_DIR:",
|
||||
print CXX_DIR
|
||||
print "EXCLUDE:",
|
||||
print EXCLUDE
|
||||
print ".......VARIABLES END......"
|
||||
|
||||
utils = PathUtils.PathUtils(COCOS_ROOT)
|
||||
# save the .h file for search
|
||||
hfiles = utils.find_files(H_DIR, ("h",), EXCLUDE)
|
||||
# save the .cpp and .mm file for search
|
||||
cxxfiles = utils.find_files(CXX_DIR, ("cpp", "mm"))
|
||||
|
||||
print "search class declarations"
|
||||
# the class set, ignore the namespace
|
||||
classes = set()
|
||||
for file in hfiles:
|
||||
collect_class_name(file, classes)
|
||||
print "search end"
|
||||
|
||||
# generate example rep:
|
||||
# (\W+|^)(?P<keyWord>\S*(?:Class1|Class2|class3)\s*(?:\*+|\s+)\s*)\w+\s*=(?!\s*(?:0|NULL|nullptr)\s*\W)
|
||||
# examples:
|
||||
# Class1* c = new Class1() ; //match
|
||||
# Class1* c; //not match
|
||||
# Class1* c = nullptr; //not match
|
||||
# Class1* c = nullptrabc; //match
|
||||
# Class1 c; //not match
|
||||
# Class1 c = Class1(); //match
|
||||
def gen_rep(keyWord):
|
||||
s = cStringIO.StringIO()
|
||||
s.write("(?:\W+|^)(?P<")
|
||||
s.write(keyWord)
|
||||
s.write(">(?:")
|
||||
|
||||
# add classes want to match
|
||||
first = True
|
||||
for cls in classes:
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
s.write("|")
|
||||
|
||||
s.write(cls)
|
||||
|
||||
s.write(")\s*(?:\*+|\s+)\s*)\w+\s*=(?!\s*(?:")
|
||||
|
||||
# let nullptr assignment not to convert
|
||||
first = True
|
||||
for nullptr in NULL_PTR:
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
s.write("|")
|
||||
|
||||
s.write(nullptr)
|
||||
|
||||
s.write(")\s*\W)")
|
||||
|
||||
result = s.getvalue()
|
||||
s.close()
|
||||
|
||||
print "generated regular expression is:"
|
||||
print result
|
||||
return re.compile(result)
|
||||
|
||||
# save the .h file for search
|
||||
hfiles = []
|
||||
# save the .cpp and .mm file for search
|
||||
cxxfiles = []
|
||||
|
||||
print "search .h files..."
|
||||
for dir in H_DIR:
|
||||
os.path.walk(os.path.join(COCOS_ROOT, dir), walk_collect_h_files, hfiles)
|
||||
|
||||
for dir in INCLUDE:
|
||||
if os.path.isdir(os.path.join(COCOS_ROOT, dir)):
|
||||
os.path.walk(os.path.join(COCOS_ROOT, dir), walk_collect_h_files, hfiles)
|
||||
else:
|
||||
hfiles += [dir]
|
||||
print "search end"
|
||||
|
||||
print "search .cxx files..."
|
||||
for dir in CXX_DIR:
|
||||
os.path.walk(os.path.join(COCOS_ROOT, dir), walk_collect_cxx_files, cxxfiles)
|
||||
print "search end"
|
||||
|
||||
print "search class declarations"
|
||||
# the class set, ignore the namespace
|
||||
classes = set()
|
||||
for file in hfiles:
|
||||
collect_class_name(file, classes)
|
||||
print "search end"
|
||||
|
||||
# generate example rep:
|
||||
# (\W+|^)(?P<keyWord>\S*(?:Class1|Class2|class3)\s*(?:\*+|\s+)\s*)\w+\s*=(?!\s*(?:0|NULL|nullptr)\s*\W)
|
||||
# examples:
|
||||
# Class1* c = new Class1() ; //match
|
||||
# Class1* c; //not match
|
||||
# Class1* c = nullptr; //not match
|
||||
# Class1* c = nullptrabc; //match
|
||||
# Class1 c; //not match
|
||||
# Class1 c = Class1(); //match
|
||||
def gen_rep(keyWord):
|
||||
s = cStringIO.StringIO()
|
||||
s.write("(?:\W+|^)(?P<")
|
||||
s.write(keyWord)
|
||||
s.write(">\S*(?:")
|
||||
|
||||
# add classes want to match
|
||||
first = True
|
||||
for cls in classes:
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
s.write("|")
|
||||
|
||||
s.write(cls)
|
||||
|
||||
s.write(")\s*(?:\*+|\s+)\s*)\w+\s*=(?!\s*(?:")
|
||||
|
||||
# let nullptr assignment not to convert
|
||||
first = True
|
||||
for nullptr in NULL_PTR:
|
||||
if first:
|
||||
first = False
|
||||
else:
|
||||
s.write("|")
|
||||
|
||||
s.write(nullptr)
|
||||
|
||||
s.write(")\s*\W)")
|
||||
|
||||
result = s.getvalue()
|
||||
s.close()
|
||||
|
||||
print "generated regular expression is:"
|
||||
print result
|
||||
return re.compile(result)
|
||||
|
||||
repWord = "change"
|
||||
rep = gen_rep(repWord)
|
||||
repWord = "change"
|
||||
rep = gen_rep(repWord)
|
||||
|
||||
|
||||
print "scan and edit the .cxx files..."
|
||||
# scan the cxx files
|
||||
for file in cxxfiles:
|
||||
change_local_classvarname_to_auto(os.path.join(COCOS_ROOT, file), rep, repWord)
|
||||
print "scan and edit the .cxx files..."
|
||||
# scan the cxx files
|
||||
for file in cxxfiles:
|
||||
change_local_classvarname_to_auto(os.path.join(COCOS_ROOT, file), rep, repWord)
|
||||
|
||||
print "success!"
|
||||
print "success!"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin.python
|
||||
''' some common path and file operation '''
|
||||
import os.path
|
||||
import re
|
||||
import types
|
||||
import fileinput
|
||||
import cStringIO
|
||||
|
||||
|
||||
class PathUtils:
|
||||
|
||||
def __init__(self, root):
|
||||
self.__root = root
|
||||
|
||||
def __check_file_matchs(self, filePath):
|
||||
|
||||
#normalize the path
|
||||
realFilePath = os.path.abspath(filePath)
|
||||
|
||||
if not os.path.isfile(realFilePath):
|
||||
return False
|
||||
|
||||
curDir, fileName = os.path.split(realFilePath)
|
||||
|
||||
# check dir is exclude or not
|
||||
for dir in self.__exclude:
|
||||
dir = os.path.abspath(os.path.join(self.__root, dir))
|
||||
if os.path.isdir(dir) and os.path.isdir(curDir[:len(dir)]):
|
||||
if os.path.samefile(dir, curDir[:len(dir)]):
|
||||
return False
|
||||
|
||||
if self.__rep.match(fileName):
|
||||
# check file is exclude or not
|
||||
for file in self.__exclude:
|
||||
if os.path.isfile(os.path.join(self.__root, file)):
|
||||
if os.path.samefile(realFilePath, os.path.join(self.__root, file)):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def __walk_collect_files(self, lst, dirname, names):
|
||||
for name in names:
|
||||
if self.__check_file_matchs(os.path.join(dirname, name)):
|
||||
if type(lst) is types.ListType:
|
||||
lst += [os.path.abspath(os.path.join(dirname, name))]
|
||||
|
||||
def set_root(self, root):
|
||||
"set the root path"
|
||||
self._root = root
|
||||
|
||||
def find_files(self, pathes, suffixes = (), exclude = ()):
|
||||
"find files in pathes(a list) with suffixes. It will not collect files your specified in exclude. all of these pathes passed in must be relative to root"
|
||||
lst = []
|
||||
|
||||
# rep generate with params to search the files
|
||||
repStr = cStringIO.StringIO()
|
||||
repStr.write(".+")
|
||||
for i, suffix in enumerate(suffixes):
|
||||
if i == 0:
|
||||
repStr.write("\.(?:(?:")
|
||||
else:
|
||||
repStr.write("|(?:")
|
||||
|
||||
repStr.write(suffix)
|
||||
|
||||
if i == len(suffixes) - 1:
|
||||
repStr.write("))$")
|
||||
else:
|
||||
repStr.write(")")
|
||||
|
||||
self.__rep = re.compile(repStr.getvalue())
|
||||
repStr.close()
|
||||
self.__exclude = exclude
|
||||
|
||||
# find files
|
||||
for path in pathes:
|
||||
path = os.path.join(self.__root, path)
|
||||
if os.path.isdir(path):
|
||||
os.path.walk(path, self.__walk_collect_files, lst)
|
||||
else:
|
||||
lst += [os.path.abspath(path)]
|
||||
|
||||
return lst
|
Loading…
Reference in New Issue