mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' into carlomorgantinizynga-new_develop_merge
Conflicts: cocos2dx/Android.mk
This commit is contained in:
commit
5ee6e7d79a
12
AUTHORS
12
AUTHORS
|
@ -3,13 +3,16 @@ cocos2d-x authors & contributors
|
|||
(ordered by the join in time)
|
||||
|
||||
Core Developers:
|
||||
Zhe Wang (Walzer)
|
||||
Ricardo Quesada
|
||||
XiaoMing Zhang (Minggo)
|
||||
JianHua Chen (Dumganhar)
|
||||
Zhe Wang (Walzer)
|
||||
Qingkui Hu (samuele3hu)
|
||||
Huabing Xu (dabingnn)
|
||||
Bo Yu (boyu0)
|
||||
|
||||
|
||||
Developers:
|
||||
Ricardo Quesada
|
||||
Rolando Abarca
|
||||
Javascript Binding and testjs
|
||||
|
||||
|
@ -549,6 +552,10 @@ Developers:
|
|||
|
||||
thp
|
||||
Port Cocos2D-X to Qt 5
|
||||
|
||||
Nako Sung (nakosung)
|
||||
Fixing a bug that wrong logic when pass an empty std::vector to WebSocket::init.
|
||||
Exposing cc.RemoveSelf to JS.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
@ -574,6 +581,7 @@ Retired Core Developers:
|
|||
timothyqiu
|
||||
Project creator: use absolute path for json config files
|
||||
Documentation fixes
|
||||
A better way to locate project creator
|
||||
|
||||
|
||||
Cocos2d-x can not grow so fast without the active community.
|
||||
|
|
|
@ -190,7 +190,6 @@ public:
|
|||
|
||||
/**
|
||||
@brief Pause all playing sound effect
|
||||
@param nSoundId The return value of function playEffect
|
||||
*/
|
||||
void pauseAllEffects();
|
||||
|
||||
|
@ -202,7 +201,6 @@ public:
|
|||
|
||||
/**
|
||||
@brief Resume all playing sound effect
|
||||
@param nSoundId The return value of function playEffect
|
||||
*/
|
||||
void resumeAllEffects();
|
||||
|
||||
|
|
|
@ -6,154 +6,47 @@ LOCAL_MODULE := cocos2dx_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libcocos2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CCConfiguration.cpp \
|
||||
CCDeprecated.cpp \
|
||||
CCScheduler.cpp \
|
||||
CCCamera.cpp \
|
||||
ccFPSImages.c \
|
||||
ccTypes.cpp \
|
||||
actions/CCAction.cpp \
|
||||
actions/CCActionCamera.cpp \
|
||||
actions/CCActionCatmullRom.cpp \
|
||||
actions/CCActionEase.cpp \
|
||||
actions/CCActionGrid.cpp \
|
||||
actions/CCActionGrid3D.cpp \
|
||||
actions/CCActionInstant.cpp \
|
||||
actions/CCActionInterval.cpp \
|
||||
actions/CCActionManager.cpp \
|
||||
actions/CCActionPageTurn3D.cpp \
|
||||
actions/CCActionProgressTimer.cpp \
|
||||
actions/CCActionTiledGrid.cpp \
|
||||
actions/CCActionTween.cpp \
|
||||
base_nodes/CCAtlasNode.cpp \
|
||||
base_nodes/CCNode.cpp \
|
||||
cocoa/CCAffineTransform.cpp \
|
||||
cocoa/CCGeometry.cpp \
|
||||
cocoa/CCAutoreleasePool.cpp \
|
||||
cocoa/CCDictionary.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 \
|
||||
effects/CCGrid.cpp \
|
||||
kazmath/src/aabb.c \
|
||||
kazmath/src/mat3.c \
|
||||
kazmath/src/mat4.c \
|
||||
kazmath/src/neon_matrix_impl.c \
|
||||
kazmath/src/plane.c \
|
||||
kazmath/src/quaternion.c \
|
||||
kazmath/src/ray2.c \
|
||||
kazmath/src/utility.c \
|
||||
kazmath/src/vec2.c \
|
||||
kazmath/src/vec3.c \
|
||||
kazmath/src/vec4.c \
|
||||
kazmath/src/GL/mat4stack.c \
|
||||
kazmath/src/GL/matrix.c \
|
||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
keyboard_dispatcher/CCKeyboardDispatcher.cpp \
|
||||
label_nodes/CCFont.cpp \
|
||||
label_nodes/CCFontAtlas.cpp \
|
||||
label_nodes/CCFontAtlasCache.cpp \
|
||||
label_nodes/CCFontAtlasFactory.cpp \
|
||||
label_nodes/CCFontCache.cpp \
|
||||
label_nodes/CCFontDefinition.cpp \
|
||||
label_nodes/CCFontFNT.cpp \
|
||||
label_nodes/CCFontFreeType.cpp \
|
||||
label_nodes/CCFontRenderFreeType.cpp \
|
||||
label_nodes/CCLabel.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
label_nodes/CCLabelTextFormatter.cpp \
|
||||
label_nodes/CCStringBMFont.cpp \
|
||||
label_nodes/CCStringTTF.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/CCTransitionProgress.cpp \
|
||||
menu_nodes/CCMenu.cpp \
|
||||
menu_nodes/CCMenuItem.cpp \
|
||||
misc_nodes/CCClippingNode.cpp \
|
||||
misc_nodes/CCMotionStreak.cpp \
|
||||
misc_nodes/CCProgressTimer.cpp \
|
||||
misc_nodes/CCRenderTexture.cpp \
|
||||
particle_nodes/CCParticleExamples.cpp \
|
||||
particle_nodes/CCParticleSystem.cpp \
|
||||
particle_nodes/CCParticleBatchNode.cpp \
|
||||
particle_nodes/CCParticleSystemQuad.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
platform/CCThread.cpp \
|
||||
platform/CCFileUtils.cpp \
|
||||
platform/CCEGLViewProtocol.cpp \
|
||||
platform/android/CCDevice.cpp \
|
||||
platform/android/CCEGLView.cpp \
|
||||
platform/android/CCAccelerometer.cpp \
|
||||
platform/android/CCApplication.cpp \
|
||||
platform/android/CCCommon.cpp \
|
||||
platform/android/CCFileUtilsAndroid.cpp \
|
||||
platform/android/CCImage.cpp \
|
||||
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \
|
||||
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \
|
||||
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp \
|
||||
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \
|
||||
platform/android/jni/JniHelper.cpp \
|
||||
platform/android/jni/IMEJni.cpp \
|
||||
platform/android/jni/TouchesJni.cpp \
|
||||
platform/android/jni/DPIJni.cpp \
|
||||
script_support/CCScriptSupport.cpp \
|
||||
shaders/ccShaders.cpp \
|
||||
shaders/CCGLProgram.cpp \
|
||||
shaders/ccGLStateCache.cpp \
|
||||
shaders/CCShaderCache.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/CCNotificationCenter.cpp \
|
||||
support/CCProfiling.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/user_default/CCUserDefaultAndroid.cpp \
|
||||
support/base64.cpp \
|
||||
support/ccUtils.cpp \
|
||||
support/CCVertex.cpp \
|
||||
support/data_support/ccCArray.cpp \
|
||||
support/image_support/TGAlib.cpp \
|
||||
support/tinyxml2/tinyxml2.cpp \
|
||||
support/zip_support/ZipUtils.cpp \
|
||||
support/zip_support/ioapi.cpp \
|
||||
support/zip_support/unzip.cpp \
|
||||
support/component/CCComponent.cpp \
|
||||
support/component/CCComponentContainer.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\
|
||||
tilemap_parallax_nodes/CCParallaxNode.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/CCTouchDispatcher.cpp \
|
||||
touch_dispatcher/CCTouchHandler.cpp \
|
||||
touch_dispatcher/CCTouch.cpp
|
||||
# need to accureate control of directories, so not use 'find' to list all
|
||||
cpp_dirs := $(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/base_nodes \
|
||||
$(LOCAL_PATH)/actions \
|
||||
$(LOCAL_PATH)/cocoa \
|
||||
$(LOCAL_PATH)/draw_nodes \
|
||||
$(LOCAL_PATH)/effects \
|
||||
$(LOCAL_PATH)/keyboard_dispatcher \
|
||||
$(LOCAL_PATH)/keypad_dispatcher \
|
||||
$(LOCAL_PATH)/label_nodes \
|
||||
$(LOCAL_PATH)/layers_scenes_transitions_nodes \
|
||||
$(LOCAL_PATH)/menu_nodes \
|
||||
$(LOCAL_PATH)/misc_nodes \
|
||||
$(LOCAL_PATH)/particle_nodes \
|
||||
$(LOCAL_PATH)/platform \
|
||||
$(LOCAL_PATH)/platform/third_party/common/etc \
|
||||
$(LOCAL_PATH)/platform/android \
|
||||
$(LOCAL_PATH)/platform/android/jni \
|
||||
$(LOCAL_PATH)/script_support \
|
||||
$(LOCAL_PATH)/shaders \
|
||||
$(LOCAL_PATH)/sprite_nodes \
|
||||
$(LOCAL_PATH)/support \
|
||||
$(LOCAL_PATH)/support/component \
|
||||
$(LOCAL_PATH)/support/data_support \
|
||||
$(LOCAL_PATH)/support/image_support \
|
||||
$(LOCAL_PATH)/support/tinyxml2 \
|
||||
$(LOCAL_PATH)/support/user_default \
|
||||
$(LOCAL_PATH)/support/zip_support \
|
||||
$(LOCAL_PATH)/text_input_node \
|
||||
$(LOCAL_PATH)/textures \
|
||||
$(LOCAL_PATH)/tilemap_parallax_nodes \
|
||||
$(LOCAL_PATH)/touch_dispatcher
|
||||
|
||||
c_dirs := $(LOCAL_PATH)\
|
||||
$(LOCAL_PATH)/kazmath/src \
|
||||
$(LOCAL_PATH)/kazmath/src/GL
|
||||
|
||||
find_cpp_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp))
|
||||
find_c_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.c))
|
||||
LOCAL_SRC_FILES := $(foreach dir, $(cpp_dirs), $(find_cpp_files))
|
||||
LOCAL_SRC_FILES += $(foreach dir, $(c_dirs), $(find_c_files))
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/include \
|
||||
|
|
|
@ -465,7 +465,7 @@ protected:
|
|||
nextScene is a weak reference. */
|
||||
Scene *_nextScene;
|
||||
|
||||
/* If YES, then "old" scene will receive the cleanup message */
|
||||
/* If true, then "old" scene will receive the cleanup message */
|
||||
bool _sendCleanupToScene;
|
||||
|
||||
/* scheduled scenes */
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
void update(float dt);
|
||||
|
||||
/** The scheduled method will be called every 'interval' seconds.
|
||||
If paused is YES, then it won't be called until it is resumed.
|
||||
If paused is true, then it won't be called until it is resumed.
|
||||
If 'interval' is 0, it will be called every frame, but if so, it's recommended to use 'scheduleUpdateForTarget:' instead.
|
||||
If the selector is already scheduled, then only the interval parameter will be updated without re-scheduling it again.
|
||||
repeat let the action be repeated repeat + 1 times, use kRepeatForever to let the action run continuously
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
void unscheduleAllWithMinPriority(int nMinPriority);
|
||||
|
||||
/** The scheduled script callback will be called every 'interval' seconds.
|
||||
If paused is YES, then it won't be called until it is resumed.
|
||||
If paused is true, then it won't be called until it is resumed.
|
||||
If 'interval' is 0, it will be called every frame.
|
||||
return schedule script entry ID, used for unscheduleScriptFunc().
|
||||
*/
|
||||
|
|
|
@ -193,7 +193,9 @@ protected:
|
|||
@brief Follow is an action that "follows" a node.
|
||||
|
||||
Eg:
|
||||
@code
|
||||
layer->runAction(Follow::actionWithTarget(hero));
|
||||
@endcode
|
||||
|
||||
Instead of using Camera as a "follower", use this action instead.
|
||||
@since v0.99.2
|
||||
|
@ -204,10 +206,11 @@ public:
|
|||
/**
|
||||
* Creates the action with a set boundary or with no boundary.
|
||||
*
|
||||
* @param followedNode The node to be followed.
|
||||
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
||||
* with no boundary.
|
||||
*/
|
||||
static Follow* create(Node *pFollowedNode, const Rect& rect = Rect::ZERO);
|
||||
static Follow* create(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||
|
||||
Follow()
|
||||
: _followedNode(NULL)
|
||||
|
@ -228,10 +231,11 @@ public:
|
|||
/**
|
||||
* Initializes the action with a set boundary or with no boundary.
|
||||
*
|
||||
* @param followedNode The node to be followed.
|
||||
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
||||
* with no boundary.
|
||||
*/
|
||||
bool initWithTarget(Node *pFollowedNode, const Rect& rect = Rect::ZERO);
|
||||
bool initWithTarget(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||
|
||||
//
|
||||
// Override
|
||||
|
|
|
@ -95,13 +95,13 @@ public:
|
|||
/** returns the tile that belongs to a certain position of the grid */
|
||||
Quad3 getTile(const Point& position) const;
|
||||
|
||||
/** @deprecatd Use getTile() instead */
|
||||
/** @deprecated Use getTile() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Point& position) { return getTile(position); }
|
||||
|
||||
/** returns the non-transformed tile that belongs to a certain position of the grid */
|
||||
Quad3 getOriginalTile(const Point& position) const;
|
||||
|
||||
/** @deprecatd Use getOriginalTile() instead */
|
||||
/** @deprecated Use getOriginalTile() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Point& position) { return getOriginalTile(position); }
|
||||
|
||||
/** sets a new tile to a certain position of the grid */
|
||||
|
|
|
@ -2201,8 +2201,11 @@ TargetedAction* TargetedAction::clone() const
|
|||
|
||||
TargetedAction* TargetedAction::reverse(void) const
|
||||
{
|
||||
// no reverse for this action, just clone it
|
||||
return this->clone();
|
||||
// just reverse the internal action
|
||||
auto a = new TargetedAction();
|
||||
a->initWithTarget(_forcedTarget, _action->reverse());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
void TargetedAction::startWithTarget(Node *target)
|
||||
|
|
|
@ -461,7 +461,7 @@ public:
|
|||
virtual JumpTo* reverse(void) const override;
|
||||
};
|
||||
|
||||
/** @typedef bezier configuration structure
|
||||
/** Bezier configuration structure
|
||||
*/
|
||||
typedef struct _ccBezierConfig {
|
||||
//! end position of the bezier
|
||||
|
|
|
@ -46,16 +46,18 @@ public:
|
|||
ActionTween is an action that lets you update any property of an object.
|
||||
For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then:
|
||||
|
||||
id modifyWidth = [ActionTween actionWithDuration:2 key:@"width" from:200 to:300];
|
||||
[target runAction:modifyWidth];
|
||||
|
||||
@code
|
||||
auto modifyWidth = ActionTween::create(2, "width", 200, 300);
|
||||
target->runAction(modifyWidth);
|
||||
@endcode
|
||||
|
||||
Another example: ScaleTo action could be rewritten using PropertyAction:
|
||||
|
||||
// scaleA and scaleB are equivalents
|
||||
id scaleA = [ScaleTo actionWithDuration:2 scale:3];
|
||||
id scaleB = [ActionTween actionWithDuration:2 key:@"scale" from:1 to:3];
|
||||
|
||||
@code
|
||||
// scaleA and scaleB are equivalents
|
||||
auto scaleA = ScaleTo::create(2, 3); // (duration, to)
|
||||
auto scaleB = ActionTween::create(2, "scale", 1, 3); // (duration, key, from, to)
|
||||
@endcode
|
||||
|
||||
@since v0.99.2
|
||||
*/
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
* The larger number it is, the later this node will be drawn in each message loop.
|
||||
* Please refer to setVertexZ(float) for the difference.
|
||||
*
|
||||
* @param nZOrder Z order of this node.
|
||||
* @param zOrder Z order of this node.
|
||||
*/
|
||||
virtual void setZOrder(int zOrder);
|
||||
/**
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
*
|
||||
* @warning Use it at your own risk since it might break the cocos2d parent-children z order
|
||||
*
|
||||
* @param fVertexZ OpenGL Z vertex of this node.
|
||||
* @param vertexZ OpenGL Z vertex of this node.
|
||||
*/
|
||||
virtual void setVertexZ(float vertexZ);
|
||||
/**
|
||||
|
@ -462,9 +462,9 @@ public:
|
|||
* 0 is the default rotation angle.
|
||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||
*
|
||||
* @param fRotationX The X rotation in degrees which performs a horizontal rotational skew.
|
||||
* @param rotationX The X rotation in degrees which performs a horizontal rotational skew.
|
||||
*/
|
||||
virtual void setRotationX(float rotaionX);
|
||||
virtual void setRotationX(float rotationX);
|
||||
/**
|
||||
* Gets the X rotation (angle) of the node in degrees which performs a horizontal rotation skew.
|
||||
*
|
||||
|
@ -481,7 +481,7 @@ public:
|
|||
* 0 is the default rotation angle.
|
||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||
*
|
||||
* @param fRotationY The Y rotation in degrees.
|
||||
* @param rotationY The Y rotation in degrees.
|
||||
*/
|
||||
virtual void setRotationY(float rotationY);
|
||||
/**
|
||||
|
@ -1062,6 +1062,7 @@ public:
|
|||
* this->schedule(schedule_selector(MyNode::TickMe), 0, 0, 0);
|
||||
* @endcode
|
||||
*
|
||||
* @param selector The SEL_SCHEDULE selector to be scheduled.
|
||||
* @param interval Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use scheduleUpdate() instead.
|
||||
* @param repeat The selector will be excuted (repeat + 1) times, you can use kRepeatForever for tick infinitely.
|
||||
* @param delay The amount of time that the first tick will wait before execution.
|
||||
|
@ -1072,7 +1073,7 @@ public:
|
|||
* Schedules a custom selector with an interval time in seconds.
|
||||
* @see schedule(SEL_SCHEDULE, float, unsigned int, float)
|
||||
*
|
||||
* @param selector A function wrapped as a selector
|
||||
* @param selector The SEL_SCHEDULE selector to be scheduled.
|
||||
* @param interval Callback interval time in seconds. 0 means tick every frame,
|
||||
*/
|
||||
void schedule(SEL_SCHEDULE selector, float interval);
|
||||
|
@ -1081,7 +1082,7 @@ public:
|
|||
* Schedules a selector that runs only once, with a delay of 0 or larger
|
||||
* @see schedule(SEL_SCHEDULE, float, unsigned int, float)
|
||||
*
|
||||
* @param selector A function wrapped as a selector
|
||||
* @param selector The SEL_SCHEDULE selector to be scheduled.
|
||||
* @param delay The amount of time that the first tick will wait before execution.
|
||||
*/
|
||||
void scheduleOnce(SEL_SCHEDULE selector, float delay);
|
||||
|
|
|
@ -246,24 +246,18 @@ public:
|
|||
}
|
||||
|
||||
/** A general line-line intersection test
|
||||
@param p1
|
||||
is the startpoint for the first line P1 = (p1 - p2)
|
||||
@param p2
|
||||
is the endpoint for the first line P1 = (p1 - p2)
|
||||
@param p3
|
||||
is the startpoint for the second line P2 = (p3 - p4)
|
||||
@param p4
|
||||
is the endpoint for the second line P2 = (p3 - p4)
|
||||
@param s
|
||||
is the range for a hitpoint in P1 (pa = p1 + s*(p2 - p1))
|
||||
@param t
|
||||
is the range for a hitpoint in P3 (pa = p2 + t*(p4 - p3))
|
||||
@return bool
|
||||
indicating successful intersection of a line
|
||||
note that to truly test intersection for segments we have to make
|
||||
sure that s & t lie within [0..1] and for rays, make sure s & t > 0
|
||||
the hit point is p3 + t * (p4 - p3);
|
||||
the hit point also is p1 + s * (p2 - p1);
|
||||
@param A the startpoint for the first line L1 = (A - B)
|
||||
@param B the endpoint for the first line L1 = (A - B)
|
||||
@param C the startpoint for the second line L2 = (C - D)
|
||||
@param D the endpoint for the second line L2 = (C - D)
|
||||
@param S the range for a hitpoint in L1 (p = A + S*(B - A))
|
||||
@param T the range for a hitpoint in L2 (p = C + T*(D - C))
|
||||
@returns whether these two lines interects.
|
||||
|
||||
Note that to truly test intersection for segments we have to make
|
||||
sure that S & T lie within [0..1] and for rays, make sure S & T > 0
|
||||
the hit point is C + T * (D - C);
|
||||
the hit point also is A + S * (B - A);
|
||||
@since 3.0
|
||||
*/
|
||||
static bool isLineIntersect(const Point& A, const Point& B,
|
||||
|
@ -271,7 +265,7 @@ public:
|
|||
float *S, float *T);
|
||||
|
||||
/*
|
||||
returns YES if Segment A-B intersects with segment C-D
|
||||
returns true if Segment A-B intersects with segment C-D
|
||||
@since v3.0
|
||||
*/
|
||||
static bool isSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D);
|
||||
|
|
|
@ -357,7 +357,7 @@ CC_DEPRECATED_ATTRIBUTE static inline bool ccpLineIntersect(const Point& p1, con
|
|||
}
|
||||
|
||||
/*
|
||||
ccpSegmentIntersect returns YES if Segment A-B intersects with segment C-D
|
||||
ccpSegmentIntersect returns true if Segment A-B intersects with segment C-D
|
||||
@since v1.0.0
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static inline bool ccpSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
/**
|
||||
* Changes the opacity.
|
||||
*
|
||||
* @param value Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.
|
||||
* @param opacity Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.
|
||||
*/
|
||||
virtual void setOpacity(GLubyte opacity) = 0;
|
||||
|
||||
|
@ -89,10 +89,10 @@ public:
|
|||
* If thie property is set to true, then the rendered color will be affected by opacity.
|
||||
* Normally, r = r * opacity/255, g = g * opacity/255, b = b * opacity/255.
|
||||
*
|
||||
* @param bValue true then the opacity will be applied as: glColor(R,G,B,opacity);
|
||||
* false then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);
|
||||
* @param value If true, then the opacity will be applied as: glColor(R,G,B,opacity);
|
||||
* If false, then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);
|
||||
*/
|
||||
virtual void setOpacityModifyRGB(bool bValue) = 0;
|
||||
virtual void setOpacityModifyRGB(bool value) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether or not the opacity will be applied using glColor(R,G,B,opacity)
|
||||
|
|
|
@ -302,7 +302,7 @@ public:
|
|||
bool initWithColor(const Color4B& start, const Color4B& end, const Point& v);
|
||||
|
||||
/** Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors
|
||||
Default: YES
|
||||
Default: true
|
||||
*/
|
||||
void setCompressedInterpolation(bool bCompressedInterpolation);
|
||||
bool isCompressedInterpolation() const;
|
||||
|
@ -385,11 +385,11 @@ public:
|
|||
void addLayer(Layer* layer);
|
||||
|
||||
/** switches to a certain layer indexed by n.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup:YES'.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup=true'.
|
||||
*/
|
||||
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'.
|
||||
The current (old) layer will be removed from it's parent with 'cleanup=true'.
|
||||
*/
|
||||
void switchToAndReleaseMe(unsigned int n);
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ public:
|
|||
GLfloat getAlphaThreshold() const;
|
||||
void setAlphaThreshold(GLfloat fAlphaThreshold);
|
||||
|
||||
/** Inverted. If this is set to YES,
|
||||
/** Inverted. If this is set to true,
|
||||
the stencil is inverted, so the content is drawn where the stencil is NOT drawn.
|
||||
This default to NO.
|
||||
This default to false.
|
||||
*/
|
||||
bool isInverted() const;
|
||||
void setInverted(bool bInverted);
|
||||
|
|
|
@ -106,12 +106,12 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE Image* newCCImage(bool flipImage = true) { return newImage(flipImage); };
|
||||
|
||||
/** saves the texture into a file using JPEG format. The file will be saved in the Documents folder.
|
||||
Returns YES if the operation is successful.
|
||||
Returns true if the operation is successful.
|
||||
*/
|
||||
bool saveToFile(const char *szFilePath);
|
||||
|
||||
/** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
|
||||
Returns YES if the operation is successful.
|
||||
Returns true if the operation is successful.
|
||||
*/
|
||||
bool saveToFile(const char *name, Image::Format format);
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
*/
|
||||
void listenToForeground(Object *obj);
|
||||
|
||||
/** Valid flags: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT. They can be OR'ed. Valid when "autoDraw is YES. */
|
||||
/** Valid flags: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT. They can be OR'ed. Valid when "autoDraw" is true. */
|
||||
inline unsigned int getClearFlags() const { return _clearFlags; };
|
||||
inline void setClearFlags(unsigned int clearFlags) { _clearFlags = clearFlags; };
|
||||
|
||||
|
@ -133,11 +133,11 @@ public:
|
|||
inline const Color4F& getClearColor() const { return _clearColor; };
|
||||
inline void setClearColor(const Color4F &clearColor) { _clearColor = clearColor; };
|
||||
|
||||
/** Value for clearDepth. Valid only when autoDraw is true. */
|
||||
/** Value for clearDepth. Valid only when "autoDraw" is true. */
|
||||
inline float getClearDepth() const { return _clearDepth; };
|
||||
inline void setClearDepth(float clearDepth) { _clearDepth = clearDepth; };
|
||||
|
||||
/** Value for clear Stencil. Valid only when autoDraw is true */
|
||||
/** Value for clear Stencil. Valid only when "autoDraw" is true */
|
||||
inline int getClearStencil() const { return _clearStencil; };
|
||||
inline void setClearStencil(int clearStencil) { _clearStencil = clearStencil; };
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
void initTexCoordsWithRect(const Rect& rect);
|
||||
|
||||
/** Sets a new SpriteFrame as particle.
|
||||
WARNING: this method is experimental. Use setTexture:withRect instead.
|
||||
WARNING: this method is experimental. Use setTextureWithRect instead.
|
||||
@since v0.99.4
|
||||
*/
|
||||
void setDisplayFrame(SpriteFrame *spriteFrame);
|
||||
|
|
|
@ -39,20 +39,18 @@ public:
|
|||
virtual bool applicationDidFinishLaunching() = 0;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@param the pointer of the application
|
||||
@brief This function will be called when the application enters background.
|
||||
*/
|
||||
virtual void applicationDidEnterBackground() = 0;
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@param the pointer of the application
|
||||
@brief This function will be called when the application enters foreground.
|
||||
*/
|
||||
virtual void applicationWillEnterForeground() = 0;
|
||||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, expressed in seconds, between current frame and next.
|
||||
@param interval The time, expressed in seconds, between current frame and next.
|
||||
*/
|
||||
virtual void setAnimationInterval(double interval) = 0;
|
||||
|
||||
|
|
|
@ -102,11 +102,11 @@ public:
|
|||
* Gets resource file data from a zip file.
|
||||
*
|
||||
* @param[in] filename The resource file name which contains the relative path of the zip file.
|
||||
* @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0.
|
||||
* @param[out] size If the file read operation succeeds, it will be the data size, otherwise 0.
|
||||
* @return Upon success, a pointer to the data is returned, otherwise NULL.
|
||||
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
|
||||
*/
|
||||
virtual unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* filename, unsigned long * pSize);
|
||||
virtual unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* filename, unsigned long *size);
|
||||
|
||||
|
||||
/** Returns the fullpath for a given filename.
|
||||
|
|
|
@ -102,15 +102,14 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
@brief Load the image from the specified path.
|
||||
@param strPath the absolute file path.
|
||||
@param imageType the type of image, currently only supporting two types.
|
||||
@return true if loaded correctly.
|
||||
@brief Load the image from the specified path.
|
||||
@param path the absolute file path.
|
||||
@return true if loaded correctly.
|
||||
*/
|
||||
bool initWithImageFile(const char * strPath);
|
||||
bool initWithImageFile(const char *path);
|
||||
|
||||
/**
|
||||
@brief Load image from stream buffer.
|
||||
@brief Load image from stream buffer.
|
||||
@param data stream buffer which holds the image data.
|
||||
@param dataLen data length expressed in (number of) bytes.
|
||||
@return true if loaded correctly.
|
||||
|
@ -121,21 +120,21 @@ public:
|
|||
bool initWithRawData(void *data, int dataLen, int nWidth, int nHeight, int nBitsPerComponent = 8, bool bPreMulti = false);
|
||||
|
||||
/**
|
||||
@brief Create image with specified string.
|
||||
@param pText the text the image will show (cannot be nil).
|
||||
@param nWidth the image width, if 0, the width will match the text's width.
|
||||
@param nHeight the image height, if 0, the height will match the text's height.
|
||||
@param eAlignMask the test Alignment
|
||||
@param pFontName the name of the font used to draw the text. If nil, use the default system font.
|
||||
@param nSize the font size, if 0, use the system default size.
|
||||
@brief Create image with specified string.
|
||||
@param text the text the image will show (cannot be nil).
|
||||
@param width the image width, if 0, the width will match the text's width.
|
||||
@param height the image height, if 0, the height will match the text's height.
|
||||
@param alignMask the test Alignment
|
||||
@param fontName the name of the font used to draw the text. If nil, use the default system font.
|
||||
@param size the font size, if 0, use the system default size.
|
||||
*/
|
||||
bool initWithString(
|
||||
const char * pText,
|
||||
int nWidth = 0,
|
||||
int nHeight = 0,
|
||||
TextAlign eAlignMask = TextAlign::CENTER,
|
||||
const char * pFontName = 0,
|
||||
int nSize = 0);
|
||||
const char * text,
|
||||
int width = 0,
|
||||
int height = 0,
|
||||
TextAlign alignMask = TextAlign::CENTER,
|
||||
const char * fontName = 0,
|
||||
int size = 0);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
|
||||
|
@ -184,10 +183,10 @@ public:
|
|||
|
||||
/**
|
||||
@brief Save Image data to the specified file, with specified format.
|
||||
@param pszFilePath the file's absolute path, including file suffix.
|
||||
@param bIsToRGB whether the image is saved as RGB format.
|
||||
@param filePath the file's absolute path, including file suffix.
|
||||
@param isToRGB whether the image is saved as RGB format.
|
||||
*/
|
||||
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);
|
||||
bool saveToFile(const char *filePath, bool isToRGB = true);
|
||||
|
||||
protected:
|
||||
bool initWithJpgData(void *data, int dataLen);
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director to limit FPS.
|
||||
@interval The time, expressed in seconds, between current frame and next.
|
||||
@param interval The time, expressed in seconds, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, which expressed in second in second, between current frame and next.
|
||||
@param interval The time, which expressed in second in second, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, expressed in seconds, between current frame and next.
|
||||
@param interval The time, expressed in seconds, between current frame and next.
|
||||
*/
|
||||
virtual void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, which expressed in second in second, between current frame and next.
|
||||
@param interval The time, which expressed in second in second, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, which expressed in second in second, between current frame and next.
|
||||
@param interval The time, which expressed in second in second, between current frame and next.
|
||||
*/
|
||||
virtual void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, which expressed in second in second, between current frame and next.
|
||||
@param interval The time, which expressed in second in second, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
|
|
|
@ -158,47 +158,47 @@ Application::getResourceRootPath()
|
|||
return m_resourceRootPath;
|
||||
}
|
||||
|
||||
TargetPlatform
|
||||
Application::Platform
|
||||
Application::getTargetPlatform()
|
||||
{
|
||||
return kTargetLinux;
|
||||
return Platform::OS_LINUX;
|
||||
}
|
||||
|
||||
ccLanguageType
|
||||
LanguageType
|
||||
Application::getCurrentLanguage()
|
||||
{
|
||||
QLocale locale;
|
||||
|
||||
switch (locale.language()) {
|
||||
case QLocale::English:
|
||||
return kLanguageEnglish;
|
||||
return LanguageType::ENGLISH;
|
||||
case QLocale::Chinese:
|
||||
return kLanguageChinese;
|
||||
return LanguageType::CHINESE;
|
||||
case QLocale::French:
|
||||
return kLanguageFrench;
|
||||
return LanguageType::FRENCH;
|
||||
case QLocale::Italian:
|
||||
return kLanguageItalian;
|
||||
return LanguageType::ITALIAN;
|
||||
case QLocale::German:
|
||||
return kLanguageGerman;
|
||||
return LanguageType::GERMAN;
|
||||
case QLocale::Spanish:
|
||||
return kLanguageSpanish;
|
||||
return LanguageType::SPANISH;
|
||||
case QLocale::Russian:
|
||||
return kLanguageRussian;
|
||||
return LanguageType::RUSSIAN;
|
||||
case QLocale::Korean:
|
||||
return kLanguageKorean;
|
||||
return LanguageType::KOREAN;
|
||||
case QLocale::Japanese:
|
||||
return kLanguageJapanese;
|
||||
return LanguageType::JAPANESE;
|
||||
case QLocale::Hungarian:
|
||||
return kLanguageHungarian;
|
||||
return LanguageType::HUNGARIAN;
|
||||
case QLocale::Portuguese:
|
||||
return kLanguagePortuguese;
|
||||
return LanguageType::PORTUGUESE;
|
||||
case QLocale::Arabic:
|
||||
return kLanguageArabic;
|
||||
return LanguageType::ARABIC;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return kLanguageEnglish;
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -45,7 +45,7 @@ class Application : public ApplicationProtocol {
|
|||
|
||||
/**
|
||||
@brief Callback by Director for limit FPS.
|
||||
@interval The time, which expressed in second in second, between current frame and next.
|
||||
@param interval The time, which expressed in second in second, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
|
@ -64,7 +64,7 @@ class Application : public ApplicationProtocol {
|
|||
CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
|
||||
|
||||
/* override functions */
|
||||
virtual ccLanguageType getCurrentLanguage();
|
||||
virtual LanguageType getCurrentLanguage();
|
||||
|
||||
/**
|
||||
* Sets the Resource root path.
|
||||
|
@ -81,7 +81,7 @@ class Application : public ApplicationProtocol {
|
|||
/**
|
||||
@brief Get target platform
|
||||
*/
|
||||
virtual TargetPlatform getTargetPlatform();
|
||||
virtual Platform getTargetPlatform();
|
||||
|
||||
protected:
|
||||
QGuiApplication *m_application;
|
||||
|
|
|
@ -68,7 +68,8 @@ Cocos2DQt5OpenGLIntegration::Cocos2DQt5OpenGLIntegration(EGLView *view, int widt
|
|||
{
|
||||
setSurfaceType(QSurface::OpenGLSurface);
|
||||
resize(width, height);
|
||||
showFullScreen();
|
||||
//showFullScreen();
|
||||
show();
|
||||
|
||||
m_context = new QOpenGLContext(this);
|
||||
m_context->create();
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
/**
|
||||
@brief Callback by Director to limit FPS.
|
||||
@interval The time, expressed in seconds, between current frame and next.
|
||||
@param interval The time, expressed in seconds, between current frame and next.
|
||||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
long getAnimationInterval();
|
||||
|
|
|
@ -29,34 +29,11 @@ using namespace std;
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
static char s_pszResourcePath[MAX_PATH] = {0};
|
||||
#define CC_MAX_PATH 512
|
||||
|
||||
static void _checkPath()
|
||||
{
|
||||
if (! s_pszResourcePath[0])
|
||||
{
|
||||
WCHAR wszPath[MAX_PATH] = {0};
|
||||
int nNum = WideCharToMultiByte(CP_ACP, 0, wszPath,
|
||||
GetCurrentDirectoryW(sizeof(wszPath), wszPath),
|
||||
s_pszResourcePath, MAX_PATH, NULL, NULL);
|
||||
s_pszResourcePath[nNum] = '\\';
|
||||
}
|
||||
}
|
||||
|
||||
// D:/aaa/bbb/ccc/ddd/abc.txt --> D:\aaa\bbb\ccc\ddd\abc.txt
|
||||
static inline std::string convertPathFormatToWindowStyle(const std::string& path)
|
||||
{
|
||||
std::string ret = path;
|
||||
int len = ret.length();
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
if (ret[i] == '/')
|
||||
{
|
||||
ret[i] = '\\';
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// The root path of resources, the character encoding is UTF-8.
|
||||
// UTF-8 is the only encoding supported by cocos2d-x API.
|
||||
static std::string s_resourcePath = "";
|
||||
|
||||
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
|
||||
static inline std::string convertPathFormatToUnixStyle(const std::string& path)
|
||||
|
@ -73,6 +50,21 @@ static inline std::string convertPathFormatToUnixStyle(const std::string& path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void _checkPath()
|
||||
{
|
||||
if (0 == s_resourcePath.length())
|
||||
{
|
||||
WCHAR utf16Path[CC_MAX_PATH] = {0};
|
||||
GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path);
|
||||
|
||||
char utf8Path[CC_MAX_PATH] = {0};
|
||||
int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), NULL, NULL);
|
||||
|
||||
s_resourcePath = convertPathFormatToUnixStyle(utf8Path);
|
||||
s_resourcePath.append("/");
|
||||
}
|
||||
}
|
||||
|
||||
FileUtils* FileUtils::getInstance()
|
||||
{
|
||||
if (s_sharedFileUtils == NULL)
|
||||
|
@ -95,7 +87,7 @@ FileUtilsWin32::FileUtilsWin32()
|
|||
bool FileUtilsWin32::init()
|
||||
{
|
||||
_checkPath();
|
||||
_defaultResRootPath = s_pszResourcePath;
|
||||
_defaultResRootPath = s_resourcePath;
|
||||
return FileUtils::init();
|
||||
}
|
||||
|
||||
|
@ -112,11 +104,10 @@ bool FileUtilsWin32::isFileExist(const std::string& strFilePath)
|
|||
strPath.insert(0, _defaultResRootPath);
|
||||
}
|
||||
|
||||
convertPathFormatToWindowStyle(strPath);
|
||||
WCHAR wszBuf[MAX_PATH] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), -1, wszBuf, sizeof(wszBuf));
|
||||
WCHAR utf16Buf[CC_MAX_PATH] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), -1, utf16Buf, sizeof(utf16Buf));
|
||||
|
||||
return GetFileAttributesW(wszBuf) != -1 ? true : false;
|
||||
return GetFileAttributesW(utf16Buf) != -1 ? true : false;
|
||||
}
|
||||
|
||||
bool FileUtilsWin32::isAbsolutePath(const std::string& strPath)
|
||||
|
@ -140,10 +131,9 @@ unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mod
|
|||
// read the file from hardware
|
||||
std::string fullPath = fullPathForFilename(filename);
|
||||
|
||||
WCHAR wszBuf[MAX_PATH] = {0};
|
||||
WCHAR wszBuf[CC_MAX_PATH] = {0};
|
||||
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf));
|
||||
|
||||
|
||||
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
|
||||
|
||||
|
@ -178,25 +168,25 @@ unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mod
|
|||
std::string FileUtilsWin32::getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath)
|
||||
{
|
||||
std::string unixFileName = convertPathFormatToUnixStyle(filename);
|
||||
std::string unixResolutionDirector = convertPathFormatToUnixStyle(resolutionDirectory);
|
||||
std::string unixResolutionDirectory = convertPathFormatToUnixStyle(resolutionDirectory);
|
||||
std::string unixSearchPath = convertPathFormatToUnixStyle(searchPath);
|
||||
|
||||
return FileUtils::getPathForFilename(unixFileName, unixResolutionDirector, unixSearchPath);
|
||||
return FileUtils::getPathForFilename(unixFileName, unixResolutionDirectory, unixSearchPath);
|
||||
}
|
||||
|
||||
std::string FileUtilsWin32::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename)
|
||||
{
|
||||
std::string dosDirectory = convertPathFormatToWindowStyle(strDirectory);
|
||||
std::string dosFilename = convertPathFormatToWindowStyle(strFilename);
|
||||
std::string unixDirectory = convertPathFormatToUnixStyle(strDirectory);
|
||||
std::string unixFilename = convertPathFormatToUnixStyle(strFilename);
|
||||
|
||||
return FileUtils::getFullPathForDirectoryAndFilename(dosDirectory, dosFilename);
|
||||
return FileUtils::getFullPathForDirectoryAndFilename(unixDirectory, unixFilename);
|
||||
}
|
||||
|
||||
string FileUtilsWin32::getWritablePath()
|
||||
{
|
||||
// Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe
|
||||
char full_path[_MAX_PATH + 1];
|
||||
::GetModuleFileNameA(NULL, full_path, _MAX_PATH + 1);
|
||||
char full_path[CC_MAX_PATH + 1];
|
||||
::GetModuleFileNameA(NULL, full_path, CC_MAX_PATH + 1);
|
||||
|
||||
// Debug app uses executable directory; Non-debug app uses local app data directory
|
||||
#ifndef _DEBUG
|
||||
|
@ -205,7 +195,7 @@ string FileUtilsWin32::getWritablePath()
|
|||
|
||||
if(base_name)
|
||||
{
|
||||
char app_data_path[_MAX_PATH + 1];
|
||||
char app_data_path[CC_MAX_PATH + 1];
|
||||
|
||||
// Get local app data directory, e.g. C:\Documents and Settings\username\Local Settings\Application Data
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, app_data_path)))
|
||||
|
@ -235,6 +225,8 @@ string FileUtilsWin32::getWritablePath()
|
|||
// remove xxx.exe
|
||||
ret = ret.substr(0, ret.rfind("\\") + 1);
|
||||
|
||||
ret = convertPathFormatToUnixStyle(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ protected:
|
|||
/**
|
||||
* Gets resource file data
|
||||
*
|
||||
* @param[in] filename The resource file name which contains the path.
|
||||
* @param[in] pszMode The read mode of the file.
|
||||
* @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0.
|
||||
* @param[in] filename The resource file name which contains the path.
|
||||
* @param[in] mode The read mode of the file.
|
||||
* @param[out] size If the file read operation succeeds, it will be the data size, otherwise 0.
|
||||
* @return Upon success, a pointer to the data is returned, otherwise NULL.
|
||||
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
|
||||
*/
|
||||
|
@ -77,11 +77,11 @@ protected:
|
|||
* @note Only iOS and Mac need to override this method since they are using
|
||||
* `[[NSBundle mainBundle] pathForResource: ofType: inDirectory:]` to make a full path.
|
||||
* Other platforms will use the default implementation of this method.
|
||||
* @param strDirectory The directory contains the file we are looking for.
|
||||
* @param strFilename The name of the file.
|
||||
* @param directory The directory contains the file we are looking for.
|
||||
* @param filename The name of the file.
|
||||
* @return The full path of the file, if the file can't be found, it will return an empty string.
|
||||
*/
|
||||
virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) override;
|
||||
virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) override;
|
||||
};
|
||||
|
||||
// end of platform group
|
||||
|
|
|
@ -63,7 +63,6 @@ SOURCES += ../actions/CCAction.cpp \
|
|||
../particle_nodes/CCParticleBatchNode.cpp \
|
||||
../platform/CCSAXParser.cpp \
|
||||
../platform/CCThread.cpp \
|
||||
../platform/CCImageCommonWebp.cpp \
|
||||
../platform/CCEGLViewProtocol.cpp \
|
||||
../platform/CCFileUtils.cpp \
|
||||
../platform/qt5/CCCommon.cpp \
|
||||
|
@ -102,9 +101,7 @@ SOURCES += ../actions/CCAction.cpp \
|
|||
../textures/CCTexture2D.cpp \
|
||||
../textures/CCTextureAtlas.cpp \
|
||||
../textures/CCTextureCache.cpp \
|
||||
../textures/CCTextureETC.cpp \
|
||||
../textures/CCTexturePVR.cpp \
|
||||
../textures/etc/etc1.cpp \
|
||||
../platform/third_party/common/etc/etc1.cpp \
|
||||
../tilemap_parallax_nodes/CCParallaxNode.cpp \
|
||||
../tilemap_parallax_nodes/CCTMXLayer.cpp \
|
||||
../tilemap_parallax_nodes/CCTMXObjectGroup.cpp \
|
||||
|
@ -158,6 +155,7 @@ INCLUDEPATH += ../../extensions/GUI/CCControlExtension
|
|||
INCLUDEPATH += ../../external/chipmunk/include/chipmunk
|
||||
INCLUDEPATH += ../../extensions/network
|
||||
INCLUDEPATH += ../../extensions/Components
|
||||
INCLUDEPATH += ../platform/third_party/common/etc
|
||||
|
||||
TARGET = $${LIB_OUTPUT_DIR}/cocos2d
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@ DISABLED_WARNINGS = -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-psabi
|
|||
QMAKE_CXXFLAGS += $${DISABLED_WARNINGS} -Wno-reorder
|
||||
QMAKE_CFLAGS += $${DISABLED_WARNINGS}
|
||||
|
||||
# C++11 support (GCC 4.6; for newer versions, change to -std=c++11)
|
||||
QMAKE_CXXFLAGS += -Doverride= -std=c++0x
|
||||
# C++11 support (Pick the first one if you have an old GCC version)
|
||||
#QMAKE_CXXFLAGS += -Doverride= -std=c++0x
|
||||
CONFIG += c++11
|
||||
|
||||
OS_TYPE = linux
|
||||
|
||||
|
|
|
@ -111,7 +111,9 @@ protected:
|
|||
The Animation object contains AnimationFrame objects, and a possible delay between the frames.
|
||||
You can animate a Animation object by using the Animate action. Example:
|
||||
|
||||
[sprite runAction:[Animate actionWithAnimation:animation]];
|
||||
@code
|
||||
sprite->runAction(Animate::create(animation));
|
||||
@endcode
|
||||
|
||||
*/
|
||||
class CC_DLL Animation : public Object, public Clonable
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
/** @deprecated Use getInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static AnimationCache* sharedAnimationCache() { return AnimationCache::getInstance(); }
|
||||
|
||||
/** @deprecatd Use destroyInstance() instead */
|
||||
/** @deprecated Use destroyInstance() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache() { return AnimationCache::destroyInstance(); }
|
||||
|
||||
bool init(void);
|
||||
|
@ -107,4 +107,4 @@ private:
|
|||
|
||||
NS_CC_END
|
||||
|
||||
#endif // __CC_ANIMATION_CACHE_H__
|
||||
#endif // __CC_ANIMATION_CACHE_H__
|
||||
|
|
|
@ -294,7 +294,7 @@ public:
|
|||
|
||||
/**
|
||||
* Updates the texture rect of the Sprite in points.
|
||||
* It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size.
|
||||
* It will call setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize) with \p rotated = false, and \p utrimmedSize = rect.size.
|
||||
*/
|
||||
virtual void setTextureRect(const Rect& rect);
|
||||
|
||||
|
@ -459,20 +459,20 @@ public:
|
|||
virtual void setScaleX(float scaleX) override;
|
||||
virtual void setScaleY(float scaleY) override;
|
||||
virtual void setPosition(const Point& pos) override;
|
||||
virtual void setRotation(float fRotation) override;
|
||||
virtual void setRotationX(float fRotationX) override;
|
||||
virtual void setRotationY(float fRotationY) override;
|
||||
virtual void setRotation(float rotation) override;
|
||||
virtual void setRotationX(float rotationX) override;
|
||||
virtual void setRotationY(float rotationY) override;
|
||||
virtual void setSkewX(float sx) override;
|
||||
virtual void setSkewY(float sy) override;
|
||||
virtual void removeChild(Node* child, bool bCleanup) override;
|
||||
virtual void removeAllChildrenWithCleanup(bool bCleanup) override;
|
||||
virtual void removeChild(Node* child, bool cleanup) override;
|
||||
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
||||
virtual void reorderChild(Node *child, int zOrder) override;
|
||||
virtual void addChild(Node *child) override;
|
||||
virtual void addChild(Node *child, int zOrder) override;
|
||||
virtual void addChild(Node *child, int zOrder, int tag) override;
|
||||
virtual void sortAllChildren() override;
|
||||
virtual void setScale(float fScale) override;
|
||||
virtual void setVertexZ(float fVertexZ) override;
|
||||
virtual void setScale(float scale) override;
|
||||
virtual void setVertexZ(float vertexZ) override;
|
||||
virtual void setAnchorPoint(const Point& anchor) override;
|
||||
virtual void ignoreAnchorPointForPosition(bool value) override;
|
||||
virtual void setVisible(bool bVisible) override;
|
||||
|
|
|
@ -81,9 +81,9 @@ public:
|
|||
public:
|
||||
/** Adds multiple Sprite Frames from a plist file.
|
||||
* A texture will be loaded automatically. The texture name will composed by replacing the .plist suffix with .png
|
||||
* If you want to use another texture, you should use the addSpriteFramesWithFile:texture method.
|
||||
* If you want to use another texture, you should use the addSpriteFramesWithFile(const char *plist, const char *textureFileName) method.
|
||||
*/
|
||||
void addSpriteFramesWithFile(const char *pszPlist);
|
||||
void addSpriteFramesWithFile(const char *plist);
|
||||
|
||||
/** Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames.
|
||||
@since v0.99.5
|
||||
|
@ -91,12 +91,12 @@ public:
|
|||
void addSpriteFramesWithFile(const char* plist, const char* textureFileName);
|
||||
|
||||
/** Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames. */
|
||||
void addSpriteFramesWithFile(const char *pszPlist, Texture2D *pobTexture);
|
||||
void addSpriteFramesWithFile(const char *plist, Texture2D *texture);
|
||||
|
||||
/** Adds an sprite frame with a given name.
|
||||
If the name already exists, then the contents of the old name will be replaced with the new one.
|
||||
*/
|
||||
void addSpriteFrame(SpriteFrame *pobFrame, const char *pszFrameName);
|
||||
void addSpriteFrame(SpriteFrame *frame, const char *frameName);
|
||||
|
||||
/** Purges the dictionary of loaded sprite frames.
|
||||
* Call this method if you receive the "Memory Warning".
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
void removeUnusedSpriteFrames(void);
|
||||
|
||||
/** Deletes an sprite frame from the sprite frame cache. */
|
||||
void removeSpriteFrameByName(const char *pszName);
|
||||
void removeSpriteFrameByName(const char *name);
|
||||
|
||||
/** Removes multiple Sprite Frames from a plist file.
|
||||
* Sprite Frames stored in this file will be removed.
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
private:
|
||||
/*Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
|
||||
*/
|
||||
void addSpriteFramesWithDictionary(Dictionary* pobDictionary, Texture2D *pobTexture);
|
||||
void addSpriteFramesWithDictionary(Dictionary* dictionary, Texture2D *texture);
|
||||
|
||||
/** Removes multiple Sprite Frames from Dictionary.
|
||||
* @since v0.99.5
|
||||
|
|
|
@ -29,7 +29,7 @@ using namespace std;
|
|||
NS_CC_BEGIN
|
||||
|
||||
//#pragma mark - Profiling Categories
|
||||
/* set to NO the categories that you don't want to profile */
|
||||
/* set to false the categories that you don't want to profile */
|
||||
bool kProfilerCategorySprite = false;
|
||||
bool kProfilerCategoryBatchSprite = false;
|
||||
bool kProfilerCategoryParticles = false;
|
||||
|
|
|
@ -34,7 +34,7 @@ NS_CC_BEGIN
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @file Vertex.h */
|
||||
/** @file CCVertex.h */
|
||||
|
||||
/** converts a line to a polygon */
|
||||
void CC_DLL ccVertexLineToPolygon(Point *points, float stroke, Vertex2F *vertices, unsigned int offset, unsigned int nuPoints);
|
||||
|
|
|
@ -17,74 +17,66 @@ CC_DLL int cc_wcslen(const unsigned short* str);
|
|||
|
||||
CC_DLL void cc_utf8_trim_ws(std::vector<unsigned short>* str);
|
||||
|
||||
/*
|
||||
* @ch is the unicode character whitespace?
|
||||
/**
|
||||
* Whether the character is a whitespace character.
|
||||
*
|
||||
* Reference: http://en.wikipedia.org/wiki/Whitespace_character#Unicode
|
||||
* @param ch the unicode character
|
||||
* @returns whether the character is a white space character.
|
||||
*
|
||||
* Return value: weather the character is a whitespace character.
|
||||
* @see http://en.wikipedia.org/wiki/Whitespace_character#Unicode
|
||||
* */
|
||||
CC_DLL bool isspace_unicode(unsigned short ch);
|
||||
|
||||
/*
|
||||
* cc_utf8_strlen:
|
||||
* @p: pointer to the start of a UTF-8 encoded string.
|
||||
* @max: the maximum number of bytes to examine. If @max
|
||||
* is less than 0, then the string is assumed to be
|
||||
* null-terminated. If @max is 0, @p will not be examined and
|
||||
* may be %NULL.
|
||||
*
|
||||
/**
|
||||
* Returns the length of the string in characters.
|
||||
*
|
||||
* Return value: the length of the string in characters
|
||||
* @param p pointer to the start of a UTF-8 encoded string.
|
||||
* @param max the maximum number of bytes to examine. If \p max is less than
|
||||
* 0, then the string is assumed to be null-terminated. If \p max
|
||||
* is 0, \p p will not be examined and my be %NULL.
|
||||
*
|
||||
* @returns the length of the string in characters
|
||||
**/
|
||||
CC_DLL long
|
||||
cc_utf8_strlen (const char * p, int max);
|
||||
|
||||
/*
|
||||
* @str: the string to search through.
|
||||
* @c: the character to not look for.
|
||||
/**
|
||||
* Find the last character that is not equal to the character given.
|
||||
*
|
||||
* Return value: the index of the last character that is not c.
|
||||
* @param str the string to be searched.
|
||||
* @param c the character to be searched for.
|
||||
*
|
||||
* @returns the index of the last character that is not \p c.
|
||||
* */
|
||||
CC_DLL unsigned int cc_utf8_find_last_not_char(std::vector<unsigned short> str, unsigned short c);
|
||||
|
||||
CC_DLL std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* str);
|
||||
|
||||
/*
|
||||
* cc_utf8_to_utf16:
|
||||
* @str_old: pointer to the start of a C string.
|
||||
*
|
||||
/**
|
||||
* Creates a utf8 string from a cstring.
|
||||
*
|
||||
* Return value: the newly created utf8 string.
|
||||
* @param str_old pointer to the start of a C string.
|
||||
*
|
||||
* @returns the newly created utf8 string.
|
||||
* */
|
||||
CC_DLL unsigned short* cc_utf8_to_utf16(const char* str_old, int length = -1, int* rUtf16Size = NULL);
|
||||
|
||||
/**
|
||||
* cc_utf16_to_utf8:
|
||||
* @str: a UTF-16 encoded string
|
||||
* @len: the maximum length of @str to use. If @len < 0, then
|
||||
* the string is terminated with a 0 character.
|
||||
* @items_read: location to store number of words read, or %NULL.
|
||||
* If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
|
||||
* returned in case @str contains a trailing partial
|
||||
* character. If an error occurs then the index of the
|
||||
* invalid input is stored here.
|
||||
* @items_written: location to store number of bytes written, or %NULL.
|
||||
* The value stored here does not include the trailing
|
||||
* 0 byte.
|
||||
* @error: location to store the error occuring, or %NULL to ignore
|
||||
* errors. Any of the errors in #GConvertError other than
|
||||
* %G_CONVERT_ERROR_NO_CONVERSION may occur.
|
||||
* Convert a string from UTF-16 to UTF-8. The result will be null terminated.
|
||||
*
|
||||
* Convert a string from UTF-16 to UTF-8. The result will be
|
||||
* terminated with a 0 byte.
|
||||
* @param str a UTF-16 encoded string
|
||||
* @param len the maximum length of \p str to use. If \p len < 0, then the
|
||||
* string is null terminated.
|
||||
* @param items_read location to store number of words read, or %NULL.
|
||||
* If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
|
||||
* returned in case \p str contains a trailing partial
|
||||
* character. If an error occurs then the index of the
|
||||
* invalid input is stored here.
|
||||
* @param items_written location to store number of bytes written, or %NULL.
|
||||
* The value stored here does not include the trailing null.
|
||||
*
|
||||
* Return value: a pointer to a newly allocated UTF-8 string.
|
||||
* This value must be freed with free(). If an
|
||||
* error occurs, %NULL will be returned and
|
||||
* @error set.
|
||||
* @returns a pointer to a newly allocated UTF-8 string. This value must be
|
||||
* freed with free(). If an error occurs, %NULL will be returned.
|
||||
**/
|
||||
CC_DLL char *
|
||||
cc_utf16_to_utf8 (const unsigned short *str,
|
||||
|
|
|
@ -129,8 +129,8 @@ public:
|
|||
|
||||
/** resize the capacity of the TextureAtlas.
|
||||
* The new capacity can be lower or higher than the current one
|
||||
* It returns YES if the resize was successful.
|
||||
* If it fails to resize the capacity it will return NO with a new capacity of 0.
|
||||
* It returns true if the resize was successful.
|
||||
* If it fails to resize the capacity it will return false with a new capacity of 0.
|
||||
*/
|
||||
bool resizeCapacity(int capacity);
|
||||
|
||||
|
|
|
@ -1,688 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2011 Jirka Fajfr for cocos2d-x
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2008 Apple Inc. All Rights Reserved.
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCTexture2D.h"
|
||||
#include "CCTexturePVR.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCConfiguration.h"
|
||||
#include "support/ccUtils.h"
|
||||
#include "CCStdC.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "support/zip_support/ZipUtils.h"
|
||||
#include "shaders/ccGLStateCache.h"
|
||||
#include <ctype.h>
|
||||
#include <cctype>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
#define PVR_TEXTURE_FLAG_TYPE_MASK 0xff
|
||||
|
||||
//
|
||||
// XXX DO NO ALTER THE ORDER IN THIS LIST XXX
|
||||
//
|
||||
static const ccPVRTexturePixelFormatInfo PVRTableFormats[] = {
|
||||
|
||||
// 0: BGRA_8888
|
||||
{GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 32, false, true, Texture2D::PixelFormat::RGBA8888},
|
||||
// 1: RGBA_8888
|
||||
{GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 32, false, true, Texture2D::PixelFormat::RGBA8888},
|
||||
// 2: RGBA_4444
|
||||
{GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, false, true, Texture2D::PixelFormat::RGBA4444},
|
||||
// 3: RGBA_5551
|
||||
{GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, false, true, Texture2D::PixelFormat::RGB5A1},
|
||||
// 4: RGB_565
|
||||
{GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 16, false, false, Texture2D::PixelFormat::RGB565},
|
||||
// 5: RGB_888
|
||||
{GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 24, false, false, Texture2D::PixelFormat::RGB888},
|
||||
// 6: A_8
|
||||
{GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, 8, false, false, Texture2D::PixelFormat::A8},
|
||||
// 7: L_8
|
||||
{GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, 8, false, false, Texture2D::PixelFormat::I8},
|
||||
// 8: LA_88
|
||||
{GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 16, false, true, Texture2D::PixelFormat::AI88},
|
||||
|
||||
// Not all platforms include GLES/gl2ext.h so these PVRTC enums are not always
|
||||
// available.
|
||||
#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
|
||||
// 9: PVRTC 2BPP RGB
|
||||
{GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 2, true, false, Texture2D::PixelFormat::PRVTC2},
|
||||
// 10: PVRTC 2BPP RGBA
|
||||
{GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 2, true, true, Texture2D::PixelFormat::PRVTC2},
|
||||
// 11: PVRTC 4BPP RGB
|
||||
{GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 4, true, false, Texture2D::PixelFormat::PRVTC4},
|
||||
// 12: PVRTC 4BPP RGBA
|
||||
{GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 4, true, true, Texture2D::PixelFormat::PRVTC4},
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _pixel_formathash {
|
||||
uint64_t pixelFormat;
|
||||
const ccPVRTexturePixelFormatInfo * pixelFormatInfo;
|
||||
};
|
||||
|
||||
// Values taken from PVRTexture.h from http://www.imgtec.com
|
||||
enum {
|
||||
kPVR2TextureFlagMipmap = (1<<8), // has mip map levels
|
||||
kPVR2TextureFlagTwiddle = (1<<9), // is twiddled
|
||||
kPVR2TextureFlagBumpmap = (1<<10), // has normals encoded for a bump map
|
||||
kPVR2TextureFlagTiling = (1<<11), // is bordered for tiled pvr
|
||||
kPVR2TextureFlagCubemap = (1<<12), // is a cubemap/skybox
|
||||
kPVR2TextureFlagFalseMipCol = (1<<13), // are there false colored MIP levels
|
||||
kPVR2TextureFlagVolume = (1<<14), // is this a volume texture
|
||||
kPVR2TextureFlagAlpha = (1<<15), // v2.1 is there transparency info in the texture
|
||||
kPVR2TextureFlagVerticalFlip = (1<<16), // v2.1 is the texture vertically flipped
|
||||
};
|
||||
|
||||
enum {
|
||||
kPVR3TextureFlagPremultipliedAlpha = (1<<1) // has premultiplied alpha
|
||||
};
|
||||
|
||||
static char gPVRTexIdentifier[5] = "PVR!";
|
||||
|
||||
// v2
|
||||
typedef enum
|
||||
{
|
||||
kPVR2TexturePixelFormat_RGBA_4444= 0x10,
|
||||
kPVR2TexturePixelFormat_RGBA_5551,
|
||||
kPVR2TexturePixelFormat_RGBA_8888,
|
||||
kPVR2TexturePixelFormat_RGB_565,
|
||||
kPVR2TexturePixelFormat_RGB_555, // unsupported
|
||||
kPVR2TexturePixelFormat_RGB_888,
|
||||
kPVR2TexturePixelFormat_I_8,
|
||||
kPVR2TexturePixelFormat_AI_88,
|
||||
kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA,
|
||||
kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA,
|
||||
kPVR2TexturePixelFormat_BGRA_8888,
|
||||
kPVR2TexturePixelFormat_A_8,
|
||||
} ccPVR2TexturePixelFormat;
|
||||
|
||||
// v3
|
||||
/* supported predefined formats */
|
||||
#define kPVR3TexturePixelFormat_PVRTC_2BPP_RGB 0
|
||||
#define kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA 1
|
||||
#define kPVR3TexturePixelFormat_PVRTC_4BPP_RGB 2
|
||||
#define kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA 3
|
||||
|
||||
/* supported channel type formats */
|
||||
#define kPVR3TexturePixelFormat_BGRA_8888 0x0808080861726762ULL
|
||||
#define kPVR3TexturePixelFormat_RGBA_8888 0x0808080861626772ULL
|
||||
#define kPVR3TexturePixelFormat_RGBA_4444 0x0404040461626772ULL
|
||||
#define kPVR3TexturePixelFormat_RGBA_5551 0x0105050561626772ULL
|
||||
#define kPVR3TexturePixelFormat_RGB_565 0x0005060500626772ULL
|
||||
#define kPVR3TexturePixelFormat_RGB_888 0x0008080800626772ULL
|
||||
#define kPVR3TexturePixelFormat_A_8 0x0000000800000061ULL
|
||||
#define kPVR3TexturePixelFormat_L_8 0x000000080000006cULL
|
||||
#define kPVR3TexturePixelFormat_LA_88 0x000008080000616cULL
|
||||
|
||||
|
||||
// v2
|
||||
static struct _pixel_formathash v2_pixel_formathash[] = {
|
||||
|
||||
{ kPVR2TexturePixelFormat_BGRA_8888, &PVRTableFormats[0] },
|
||||
{ kPVR2TexturePixelFormat_RGBA_8888, &PVRTableFormats[1] },
|
||||
{ kPVR2TexturePixelFormat_RGBA_4444, &PVRTableFormats[2] },
|
||||
{ kPVR2TexturePixelFormat_RGBA_5551, &PVRTableFormats[3] },
|
||||
{ kPVR2TexturePixelFormat_RGB_565, &PVRTableFormats[4] },
|
||||
{ kPVR2TexturePixelFormat_RGB_888, &PVRTableFormats[5] },
|
||||
{ kPVR2TexturePixelFormat_A_8, &PVRTableFormats[6] },
|
||||
{ kPVR2TexturePixelFormat_I_8, &PVRTableFormats[7] },
|
||||
{ kPVR2TexturePixelFormat_AI_88, &PVRTableFormats[8] },
|
||||
|
||||
#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
|
||||
{ kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA, &PVRTableFormats[10] },
|
||||
{ kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA, &PVRTableFormats[12] },
|
||||
#endif
|
||||
};
|
||||
|
||||
#define PVR2_MAX_TABLE_ELEMENTS (sizeof(v2_pixel_formathash) / sizeof(v2_pixel_formathash[0]))
|
||||
|
||||
// v3
|
||||
struct _pixel_formathash v3_pixel_formathash[] = {
|
||||
|
||||
{kPVR3TexturePixelFormat_BGRA_8888, &PVRTableFormats[0] },
|
||||
{kPVR3TexturePixelFormat_RGBA_8888, &PVRTableFormats[1] },
|
||||
{kPVR3TexturePixelFormat_RGBA_4444, &PVRTableFormats[2] },
|
||||
{kPVR3TexturePixelFormat_RGBA_5551, &PVRTableFormats[3] },
|
||||
{kPVR3TexturePixelFormat_RGB_565, &PVRTableFormats[4] },
|
||||
{kPVR3TexturePixelFormat_RGB_888, &PVRTableFormats[5] },
|
||||
{kPVR3TexturePixelFormat_A_8, &PVRTableFormats[6] },
|
||||
{kPVR3TexturePixelFormat_L_8, &PVRTableFormats[7] },
|
||||
{kPVR3TexturePixelFormat_LA_88, &PVRTableFormats[8] },
|
||||
|
||||
#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
|
||||
{kPVR3TexturePixelFormat_PVRTC_2BPP_RGB, &PVRTableFormats[9] },
|
||||
{kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA, &PVRTableFormats[10] },
|
||||
{kPVR3TexturePixelFormat_PVRTC_4BPP_RGB, &PVRTableFormats[11] },
|
||||
{kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA, &PVRTableFormats[12] },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
//Tells How large is tableFormats
|
||||
#define PVR3_MAX_TABLE_ELEMENTS (sizeof(v3_pixel_formathash) / sizeof(v3_pixel_formathash[0]))
|
||||
|
||||
|
||||
typedef struct _PVRTexHeader
|
||||
{
|
||||
unsigned int headerLength;
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
unsigned int numMipmaps;
|
||||
unsigned int flags;
|
||||
unsigned int dataLength;
|
||||
unsigned int bpp;
|
||||
unsigned int bitmaskRed;
|
||||
unsigned int bitmaskGreen;
|
||||
unsigned int bitmaskBlue;
|
||||
unsigned int bitmaskAlpha;
|
||||
unsigned int pvrTag;
|
||||
unsigned int numSurfs;
|
||||
} ccPVRv2TexHeader;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
typedef struct {
|
||||
uint32_t version;
|
||||
uint32_t flags;
|
||||
uint64_t pixelFormat;
|
||||
uint32_t colorSpace;
|
||||
uint32_t channelType;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t depth;
|
||||
uint32_t numberOfSurfaces;
|
||||
uint32_t numberOfFaces;
|
||||
uint32_t numberOfMipmaps;
|
||||
uint32_t metadataLength;
|
||||
#ifdef _MSC_VER
|
||||
} ccPVRv3TexHeader;
|
||||
#pragma pack(pop)
|
||||
#else
|
||||
} __attribute__((packed)) ccPVRv3TexHeader;
|
||||
#endif
|
||||
|
||||
|
||||
TexturePVR::TexturePVR()
|
||||
: _numberOfMipmaps(0)
|
||||
, _width(0)
|
||||
, _height(0)
|
||||
, _name(0)
|
||||
, _hasAlpha(false)
|
||||
, _hasPremultipliedAlpha(false)
|
||||
, _forcePremultipliedAlpha(false)
|
||||
, _retainName(false)
|
||||
, _format(Texture2D::PixelFormat::DEFAULT)
|
||||
, _pixelFormatInfo(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
TexturePVR::~TexturePVR()
|
||||
{
|
||||
CCLOGINFO( "cocos2d: deallocing TexturePVR: %p", this );
|
||||
|
||||
if (_name != 0 && ! _retainName)
|
||||
{
|
||||
GL::deleteTexture(_name);
|
||||
}
|
||||
}
|
||||
|
||||
bool TexturePVR::unpackPVRv2Data(unsigned char* data, unsigned int len)
|
||||
{
|
||||
bool success = false;
|
||||
ccPVRv2TexHeader *header = NULL;
|
||||
unsigned int flags, pvrTag;
|
||||
unsigned int dataLength = 0, dataOffset = 0, dataSize = 0;
|
||||
unsigned int blockSize = 0, widthBlocks = 0, heightBlocks = 0;
|
||||
unsigned int width = 0, height = 0, bpp = 4;
|
||||
unsigned char *bytes = NULL;
|
||||
unsigned int formatFlags;
|
||||
|
||||
//Cast first sizeof(PVRTexHeader) bytes of data stream as PVRTexHeader
|
||||
header = (ccPVRv2TexHeader *)data;
|
||||
|
||||
//Make sure that tag is in correct formatting
|
||||
pvrTag = CC_SWAP_INT32_LITTLE_TO_HOST(header->pvrTag);
|
||||
|
||||
if (gPVRTexIdentifier[0] != (char)(((pvrTag >> 0) & 0xff)) ||
|
||||
gPVRTexIdentifier[1] != (char)(((pvrTag >> 8) & 0xff)) ||
|
||||
gPVRTexIdentifier[2] != (char)(((pvrTag >> 16) & 0xff)) ||
|
||||
gPVRTexIdentifier[3] != (char)(((pvrTag >> 24) & 0xff)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Configuration *configuration = Configuration::getInstance();
|
||||
|
||||
flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags);
|
||||
formatFlags = flags & PVR_TEXTURE_FLAG_TYPE_MASK;
|
||||
bool flipped = (flags & kPVR2TextureFlagVerticalFlip) ? true : false;
|
||||
if (flipped)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool");
|
||||
}
|
||||
|
||||
if (! configuration->supportsNPOT() &&
|
||||
(header->width != ccNextPOT(header->width) || header->height != ccNextPOT(header->height)))
|
||||
{
|
||||
CCLOG("cocos2d: ERROR: Loading an NPOT texture (%dx%d) but is not supported on this device", header->width, header->height);
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int pvr2TableElements = PVR2_MAX_TABLE_ELEMENTS;
|
||||
if (! Configuration::getInstance()->supportsPVRTC())
|
||||
{
|
||||
pvr2TableElements = 9;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < pvr2TableElements; i++)
|
||||
{
|
||||
//Does image format in table fits to the one parsed from header?
|
||||
if (v2_pixel_formathash[i].pixelFormat == formatFlags)
|
||||
{
|
||||
_pixelFormatInfo = v2_pixel_formathash[i].pixelFormatInfo;
|
||||
|
||||
//Reset num of mipmaps
|
||||
_numberOfMipmaps = 0;
|
||||
|
||||
//Get size of mipmap
|
||||
_width = width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width);
|
||||
_height = height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height);
|
||||
|
||||
//Do we use alpha ?
|
||||
if (CC_SWAP_INT32_LITTLE_TO_HOST(header->bitmaskAlpha))
|
||||
{
|
||||
_hasAlpha = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hasAlpha = false;
|
||||
}
|
||||
|
||||
//Get ptr to where data starts..
|
||||
dataLength = CC_SWAP_INT32_LITTLE_TO_HOST(header->dataLength);
|
||||
|
||||
//Move by size of header
|
||||
bytes = ((unsigned char *)data) + sizeof(ccPVRv2TexHeader);
|
||||
_format = _pixelFormatInfo->ccPixelFormat;
|
||||
bpp = _pixelFormatInfo->bpp;
|
||||
|
||||
// Calculate the data size for each texture level and respect the minimum number of blocks
|
||||
while (dataOffset < dataLength)
|
||||
{
|
||||
switch (formatFlags) {
|
||||
case kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA:
|
||||
blockSize = 8 * 4; // Pixel by pixel block size for 2bpp
|
||||
widthBlocks = width / 8;
|
||||
heightBlocks = height / 4;
|
||||
break;
|
||||
case kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA:
|
||||
blockSize = 4 * 4; // Pixel by pixel block size for 4bpp
|
||||
widthBlocks = width / 4;
|
||||
heightBlocks = height / 4;
|
||||
break;
|
||||
case kPVR2TexturePixelFormat_BGRA_8888:
|
||||
if (Configuration::getInstance()->supportsBGRA8888() == false)
|
||||
{
|
||||
CCLOG("cocos2d: TexturePVR. BGRA8888 not supported on this device");
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
blockSize = 1;
|
||||
widthBlocks = width;
|
||||
heightBlocks = height;
|
||||
break;
|
||||
}
|
||||
|
||||
// Clamp to minimum number of blocks
|
||||
if (widthBlocks < 2)
|
||||
{
|
||||
widthBlocks = 2;
|
||||
}
|
||||
if (heightBlocks < 2)
|
||||
{
|
||||
heightBlocks = 2;
|
||||
}
|
||||
|
||||
dataSize = widthBlocks * heightBlocks * ((blockSize * bpp) / 8);
|
||||
unsigned int packetLength = (dataLength - dataOffset);
|
||||
packetLength = packetLength > dataSize ? dataSize : packetLength;
|
||||
|
||||
//Make record to the mipmaps array and increment counter
|
||||
_asMipmaps[_numberOfMipmaps].address = bytes + dataOffset;
|
||||
_asMipmaps[_numberOfMipmaps].len = packetLength;
|
||||
_numberOfMipmaps++;
|
||||
|
||||
//Check that we didn't overflow
|
||||
CCASSERT(_numberOfMipmaps < CC_PVRMIPMAP_MAX,
|
||||
"TexturePVR: Maximum number of mipmaps reached. Increase the CC_PVRMIPMAP_MAX value");
|
||||
|
||||
dataOffset += packetLength;
|
||||
|
||||
//Update width and height to the next lower power of two
|
||||
width = MAX(width >> 1, 1);
|
||||
height = MAX(height >> 1, 1);
|
||||
}
|
||||
|
||||
//Mark pass as success
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! success)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%2x. Re-encode it with a OpenGL pixel format variant", formatFlags);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool TexturePVR::unpackPVRv3Data(unsigned char* dataPointer, unsigned int dataLength)
|
||||
{
|
||||
if (dataLength < sizeof(ccPVRv3TexHeader))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ccPVRv3TexHeader *header = (ccPVRv3TexHeader *)dataPointer;
|
||||
|
||||
// validate version
|
||||
if (CC_SWAP_INT32_BIG_TO_HOST(header->version) != 0x50565203)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: pvr file version mismatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
// parse pixel format
|
||||
uint64_t pixelFormat = header->pixelFormat;
|
||||
|
||||
|
||||
bool infoValid = false;
|
||||
|
||||
unsigned int pvr3TableElements = PVR3_MAX_TABLE_ELEMENTS;
|
||||
if (! Configuration::getInstance()->supportsPVRTC())
|
||||
{
|
||||
pvr3TableElements = 9;
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < pvr3TableElements; i++)
|
||||
{
|
||||
if( v3_pixel_formathash[i].pixelFormat == pixelFormat )
|
||||
{
|
||||
_pixelFormatInfo = v3_pixel_formathash[i].pixelFormatInfo;
|
||||
_format = _pixelFormatInfo->ccPixelFormat;
|
||||
_hasAlpha = _pixelFormatInfo->alpha;
|
||||
infoValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// unsupported / bad pixel format
|
||||
if (! infoValid)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: unsupported pvr pixelformat: %lx", (unsigned long)pixelFormat );
|
||||
return false;
|
||||
}
|
||||
|
||||
// flags
|
||||
uint32_t flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags);
|
||||
|
||||
// PVRv3 specifies premultiply alpha in a flag -- should always respect this in PVRv3 files
|
||||
_forcePremultipliedAlpha = true;
|
||||
if (flags & kPVR3TextureFlagPremultipliedAlpha)
|
||||
{
|
||||
_hasPremultipliedAlpha = true;
|
||||
}
|
||||
|
||||
// sizing
|
||||
uint32_t width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width);
|
||||
uint32_t height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height);
|
||||
_width = width;
|
||||
_height = height;
|
||||
uint32_t dataOffset = 0, dataSize = 0;
|
||||
uint32_t blockSize = 0, widthBlocks = 0, heightBlocks = 0;
|
||||
uint8_t *bytes = NULL;
|
||||
|
||||
dataOffset = (sizeof(ccPVRv3TexHeader) + header->metadataLength);
|
||||
bytes = dataPointer;
|
||||
|
||||
_numberOfMipmaps = header->numberOfMipmaps;
|
||||
CCASSERT(_numberOfMipmaps < CC_PVRMIPMAP_MAX, "TexturePVR: Maximum number of mimpaps reached. Increate the CC_PVRMIPMAP_MAX value");
|
||||
|
||||
for (unsigned int i = 0; i < _numberOfMipmaps; i++)
|
||||
{
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case kPVR3TexturePixelFormat_PVRTC_2BPP_RGB :
|
||||
case kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA :
|
||||
blockSize = 8 * 4; // Pixel by pixel block size for 2bpp
|
||||
widthBlocks = width / 8;
|
||||
heightBlocks = height / 4;
|
||||
break;
|
||||
case kPVR3TexturePixelFormat_PVRTC_4BPP_RGB :
|
||||
case kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA :
|
||||
blockSize = 4 * 4; // Pixel by pixel block size for 4bpp
|
||||
widthBlocks = width / 4;
|
||||
heightBlocks = height / 4;
|
||||
break;
|
||||
case kPVR3TexturePixelFormat_BGRA_8888:
|
||||
if( ! Configuration::getInstance()->supportsBGRA8888())
|
||||
{
|
||||
CCLOG("cocos2d: TexturePVR. BGRA8888 not supported on this device");
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
blockSize = 1;
|
||||
widthBlocks = width;
|
||||
heightBlocks = height;
|
||||
break;
|
||||
}
|
||||
|
||||
// Clamp to minimum number of blocks
|
||||
if (widthBlocks < 2)
|
||||
{
|
||||
widthBlocks = 2;
|
||||
}
|
||||
if (heightBlocks < 2)
|
||||
{
|
||||
heightBlocks = 2;
|
||||
}
|
||||
|
||||
dataSize = widthBlocks * heightBlocks * ((blockSize * _pixelFormatInfo->bpp) / 8);
|
||||
unsigned int packetLength = ((unsigned int)dataLength-dataOffset);
|
||||
packetLength = packetLength > dataSize ? dataSize : packetLength;
|
||||
|
||||
_asMipmaps[i].address = bytes+dataOffset;
|
||||
_asMipmaps[i].len = packetLength;
|
||||
|
||||
dataOffset += packetLength;
|
||||
CCASSERT(dataOffset <= dataLength, "CCTexurePVR: Invalid lenght");
|
||||
|
||||
|
||||
width = MAX(width >> 1, 1);
|
||||
height = MAX(height >> 1, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TexturePVR::createGLTexture()
|
||||
{
|
||||
unsigned int width = _width;
|
||||
unsigned int height = _height;
|
||||
GLenum err;
|
||||
|
||||
if (_numberOfMipmaps > 0)
|
||||
{
|
||||
if (_name != 0)
|
||||
{
|
||||
GL::deleteTexture(_name);
|
||||
}
|
||||
|
||||
// From PVR sources: "PVR files are never row aligned."
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||
|
||||
glGenTextures(1, &_name);
|
||||
GL::bindTexture2D(_name);
|
||||
|
||||
// Default: Anti alias.
|
||||
if (_numberOfMipmaps == 1)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
CHECK_GL_ERROR_DEBUG(); // clean possible GL error
|
||||
|
||||
GLenum internalFormat = _pixelFormatInfo->internalFormat;
|
||||
GLenum format = _pixelFormatInfo->format;
|
||||
GLenum type = _pixelFormatInfo->type;
|
||||
bool compressed = _pixelFormatInfo->compressed;
|
||||
|
||||
// Generate textures with mipmaps
|
||||
for (unsigned int i = 0; i < _numberOfMipmaps; ++i)
|
||||
{
|
||||
if (compressed && ! Configuration::getInstance()->supportsPVRTC())
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: PVRTC images are not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned char *data = _asMipmaps[i].address;
|
||||
GLsizei datalen = _asMipmaps[i].len;
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, datalen, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, format, type, data);
|
||||
}
|
||||
|
||||
if (i > 0 && (width != height || ccNextPOT(width) != width ))
|
||||
{
|
||||
CCLOG("cocos2d: TexturePVR. WARNING. Mipmap level %u is not squared. Texture won't render correctly. width=%u != height=%u", i, width, height);
|
||||
}
|
||||
|
||||
err = glGetError();
|
||||
if (err != GL_NO_ERROR)
|
||||
{
|
||||
CCLOG("cocos2d: TexturePVR: Error uploading compressed texture level: %u . glError: 0x%04X", i, err);
|
||||
return false;
|
||||
}
|
||||
|
||||
width = MAX(width >> 1, 1);
|
||||
height = MAX(height >> 1, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TexturePVR::initWithContentsOfFile(const char* path)
|
||||
{
|
||||
unsigned char* pvrdata = NULL;
|
||||
int pvrlen = 0;
|
||||
|
||||
std::string lowerCase(path);
|
||||
for (unsigned int i = 0; i < lowerCase.length(); ++i)
|
||||
{
|
||||
lowerCase[i] = tolower(lowerCase[i]);
|
||||
}
|
||||
|
||||
if (lowerCase.find(".ccz") != std::string::npos)
|
||||
{
|
||||
pvrlen = ZipUtils::ccInflateCCZFile(path, &pvrdata);
|
||||
}
|
||||
else if (lowerCase.find(".gz") != std::string::npos)
|
||||
{
|
||||
pvrlen = ZipUtils::ccInflateGZipFile(path, &pvrdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
pvrdata = FileUtils::getInstance()->getFileData(path, "rb", (unsigned long *)(&pvrlen));
|
||||
}
|
||||
|
||||
if (pvrlen < 0)
|
||||
{
|
||||
this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
_numberOfMipmaps = 0;
|
||||
|
||||
_name = 0;
|
||||
_width = _height = 0;
|
||||
_pixelFormatInfo = NULL;
|
||||
_hasAlpha = false;
|
||||
_forcePremultipliedAlpha = false;
|
||||
_hasPremultipliedAlpha = false;
|
||||
|
||||
_retainName = false; // cocos2d integration
|
||||
|
||||
if (! ((unpackPVRv2Data(pvrdata, pvrlen) || unpackPVRv3Data(pvrdata, pvrlen)) && createGLTexture()) )
|
||||
{
|
||||
CC_SAFE_DELETE_ARRAY(pvrdata);
|
||||
this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE_ARRAY(pvrdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TexturePVR * TexturePVR::create(const char* path)
|
||||
{
|
||||
TexturePVR * texture = new TexturePVR();
|
||||
if (texture)
|
||||
{
|
||||
if (texture->initWithContentsOfFile(path))
|
||||
{
|
||||
texture->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete texture;
|
||||
texture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2011 Jirka Fajfr for cocos2d-x
|
||||
Copyright (c) 2010 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 __CCPVRTEXTURE_H__
|
||||
#define __CCPVRTEXTURE_H__
|
||||
|
||||
#include "CCStdC.h"
|
||||
#include "CCGL.h"
|
||||
#include "cocoa/CCObject.h"
|
||||
#include "cocoa/CCArray.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup textures
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief Structure which can tell where mipmap begins and how long is it
|
||||
*/
|
||||
struct CCPVRMipmap {
|
||||
unsigned char *address;
|
||||
unsigned int len;
|
||||
};
|
||||
|
||||
typedef struct _ccPVRTexturePixelFormatInfo {
|
||||
GLenum internalFormat;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
uint32_t bpp;
|
||||
bool compressed;
|
||||
bool alpha;
|
||||
Texture2D::PixelFormat ccPixelFormat;
|
||||
} ccPVRTexturePixelFormatInfo;
|
||||
|
||||
/**
|
||||
@brief Determine how many mipmaps can we have.
|
||||
Its same as define but it respects namespaces
|
||||
*/
|
||||
enum {
|
||||
CC_PVRMIPMAP_MAX = 16,
|
||||
};
|
||||
|
||||
|
||||
/** TexturePVR
|
||||
|
||||
Object that loads PVR images.
|
||||
|
||||
Supported PVR formats:
|
||||
- RGBA8888
|
||||
- BGRA8888
|
||||
- RGBA4444
|
||||
- RGBA5551
|
||||
- RGB565
|
||||
- A8
|
||||
- I8
|
||||
- AI88
|
||||
- PVRTC 4BPP
|
||||
- PVRTC 2BPP
|
||||
|
||||
Limitations:
|
||||
Pre-generated mipmaps, such as PVR textures with mipmap levels embedded in file,
|
||||
are only supported if all individual sprites are of _square_ size.
|
||||
To use mipmaps with non-square textures, instead call Texture2D#generateMipmap on the sheet texture itself
|
||||
(and to save space, save the PVR sprite sheet without mip maps included).
|
||||
*/
|
||||
class TexturePVR : public Object
|
||||
{
|
||||
public:
|
||||
/** creates and initializes a TexturePVR with a path */
|
||||
static TexturePVR* create(const char* path);
|
||||
|
||||
TexturePVR();
|
||||
virtual ~TexturePVR();
|
||||
|
||||
/** initializes a TexturePVR with a path */
|
||||
bool initWithContentsOfFile(const char* path);
|
||||
|
||||
// properties
|
||||
|
||||
/** texture id name */
|
||||
inline unsigned int getName() const { return _name; }
|
||||
/** texture width */
|
||||
inline unsigned int getWidth() const { return _width; }
|
||||
/** texture height */
|
||||
inline unsigned int getHeight() const { return _height; }
|
||||
/** whether or not the texture has alpha */
|
||||
inline bool hasAlpha() const { return _hasAlpha; }
|
||||
/** whether or not the texture has premultiplied alpha */
|
||||
inline bool hasPremultipliedAlpha() const { return _hasPremultipliedAlpha; }
|
||||
/** whether or not the texture should use hasPremultipliedAlpha instead of global default */
|
||||
inline bool isForcePremultipliedAlpha() const { return _forcePremultipliedAlpha; }
|
||||
/** how many mipmaps the texture has. 1 means one level (level 0 */
|
||||
inline unsigned int getNumberOfMipmaps() const { return _numberOfMipmaps; }
|
||||
inline Texture2D::PixelFormat getFormat() const { return _format; }
|
||||
inline bool isRetainName() const { return _retainName; }
|
||||
inline void setRetainName(bool retainName) { _retainName = retainName; }
|
||||
|
||||
private:
|
||||
bool unpackPVRv2Data(unsigned char* data, unsigned int len);
|
||||
bool unpackPVRv3Data(unsigned char* dataPointer, unsigned int dataLength);
|
||||
bool createGLTexture();
|
||||
|
||||
protected:
|
||||
struct CCPVRMipmap _asMipmaps[CC_PVRMIPMAP_MAX]; // pointer to mipmap images
|
||||
unsigned int _numberOfMipmaps; // number of mipmap used
|
||||
|
||||
unsigned int _width, _height;
|
||||
GLuint _name;
|
||||
bool _hasAlpha;
|
||||
bool _hasPremultipliedAlpha;
|
||||
bool _forcePremultipliedAlpha;
|
||||
|
||||
// cocos2d integration
|
||||
bool _retainName;
|
||||
Texture2D::PixelFormat _format;
|
||||
|
||||
const ccPVRTexturePixelFormatInfo *_pixelFormatInfo;
|
||||
};
|
||||
|
||||
// end of textures group
|
||||
/// @}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
|
||||
#endif //__CCPVRTEXTURE_H__
|
|
@ -70,7 +70,7 @@ public:
|
|||
Using this type of delegate results in two benefits:
|
||||
- 1. You don't need to deal with Sets, the dispatcher does the job of splitting
|
||||
them. You get exactly one UITouch per call.
|
||||
- 2. You can *claim* a UITouch by returning YES in ccTouchBegan. Updates of claimed
|
||||
- 2. You can *claim* a UITouch by returning true in ccTouchBegan. Updates of claimed
|
||||
touches are sent only to the delegate(s) that claimed them. So if you get a move/
|
||||
ended/canceled update you're sure it's your touch. This frees you from doing a
|
||||
lot of checks when doing multi-touch.
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
class CC_DLL TargetedTouchDelegate : public TouchDelegate
|
||||
{
|
||||
public:
|
||||
/** Return YES to claim the touch.
|
||||
/** Return true to claim the touch.
|
||||
@since v0
|
||||
*/
|
||||
virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) { CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);return false;};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#! /usr/bin/evn python
|
||||
#! /usr/bin/env python
|
||||
# filename = create-multi-platform-projects.py
|
||||
|
||||
import os
|
||||
from tools.project_creator import create_project
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.getcwd()+'/tools/project_creator/')
|
||||
root = os.path.abspath(os.path.dirname(__file__))
|
||||
os.chdir(os.path.join(root, 'tools/project_creator/'))
|
||||
create_project.createPlatformProjects()
|
||||
|
|
|
@ -5,105 +5,10 @@ LOCAL_MODULE := cocos_extension_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libextension
|
||||
|
||||
LOCAL_SRC_FILES := 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/GLES-Render.cpp \
|
||||
CCArmature/external_tool/Json/CSContentJsonDictionary.cpp \
|
||||
CCArmature/external_tool/Json/lib_json/json_value.cpp \
|
||||
CCArmature/external_tool/Json/lib_json/json_reader.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/CCBFileLoader.cpp \
|
||||
CCBReader/CCBReader.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/CCNodeLoader.cpp \
|
||||
CCBReader/CCNodeLoaderLibrary.cpp \
|
||||
CCBReader/CCParticleSystemQuadLoader.cpp \
|
||||
CCBReader/CCScale9SpriteLoader.cpp \
|
||||
CCBReader/CCScrollViewLoader.cpp \
|
||||
CCBReader/CCSpriteLoader.cpp \
|
||||
CCBReader/CCBAnimationManager.cpp \
|
||||
CCBReader/CCBKeyframe.cpp \
|
||||
CCBReader/CCBSequence.cpp \
|
||||
CCBReader/CCBSequenceProperty.cpp \
|
||||
CCBReader/CCBValue.cpp \
|
||||
CCBReader/CCNode+CCBRelativePositioning.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/CCControlSaturationBrightnessPicker.cpp \
|
||||
GUI/CCControlExtension/CCControlSlider.cpp \
|
||||
GUI/CCControlExtension/CCControlSwitch.cpp \
|
||||
GUI/CCControlExtension/CCControlUtils.cpp \
|
||||
GUI/CCControlExtension/CCInvocation.cpp \
|
||||
GUI/CCControlExtension/CCScale9Sprite.cpp \
|
||||
GUI/CCControlExtension/CCControlPotentiometer.cpp \
|
||||
GUI/CCControlExtension/CCControlStepper.cpp \
|
||||
GUI/CCScrollView/CCScrollView.cpp \
|
||||
GUI/CCScrollView/CCTableView.cpp \
|
||||
GUI/CCScrollView/CCTableViewCell.cpp \
|
||||
GUI/CCScrollView/CCSorting.cpp \
|
||||
GUI/CCEditBox/CCEditBox.cpp \
|
||||
GUI/CCEditBox/CCEditBoxImplAndroid.cpp \
|
||||
network/HttpClient.cpp \
|
||||
network/WebSocket.cpp \
|
||||
network/SocketIO.cpp \
|
||||
physics_nodes/CCPhysicsDebugNode.cpp \
|
||||
physics_nodes/CCPhysicsSprite.cpp \
|
||||
LocalStorage/LocalStorageAndroid.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/Json.cpp \
|
||||
spine/RegionAttachment.cpp \
|
||||
spine/Skeleton.cpp \
|
||||
spine/SkeletonData.cpp \
|
||||
spine/SkeletonJson.cpp \
|
||||
spine/Skin.cpp \
|
||||
spine/Slot.cpp \
|
||||
spine/SlotData.cpp \
|
||||
spine/extension.cpp \
|
||||
spine/CCSkeletonAnimation.cpp \
|
||||
spine/CCSkeleton.cpp \
|
||||
spine/spine-cocos2dx.cpp \
|
||||
CCDeprecated-ext.cpp
|
||||
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_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
virtual void onError(AssetsManager::ErrorCode errorCode) {};
|
||||
/** @brief Call back function for recording downloading percent
|
||||
@param percent How much percent downloaded
|
||||
@warn This call back function just for recording downloading percent.
|
||||
@warning This call back function just for recording downloading percent.
|
||||
AssetsManager will do some other thing after downloading, you should
|
||||
write code in onSuccess() after downloading.
|
||||
*/
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
* @param displayData it include the display information, like DisplayType.
|
||||
* If you want to create a sprite display, then create a SpriteDisplayData param
|
||||
*
|
||||
* @param _index the index of the display you want to replace or add to
|
||||
* @param index the index of the display you want to replace or add to
|
||||
* -1 : append display from back
|
||||
*/
|
||||
void addDisplay(DisplayData *displayData, int index);
|
||||
|
@ -84,9 +84,9 @@ public:
|
|||
|
||||
/**
|
||||
* Add a child to this bone, and it will let this child call setParent(Bone *_parent) function to set self to it's parent
|
||||
* @param _child the child you want to add
|
||||
* @param child The child you want to add.
|
||||
*/
|
||||
void addChildBone(Bone *_child);
|
||||
void addChildBone(Bone *child);
|
||||
|
||||
/**
|
||||
* Set parent bone.
|
||||
|
@ -106,13 +106,13 @@ public:
|
|||
|
||||
/**
|
||||
* Remove itself from its parent Bone.
|
||||
* @param recursion whether or not remove Child display
|
||||
* @param recursion Whether to remove Child display
|
||||
*/
|
||||
void removeFromParent(bool recursion);
|
||||
|
||||
/**
|
||||
* Removes a child Bone
|
||||
* @param bone the bone you want to remove
|
||||
* @param bone The bone you want to remove.
|
||||
*/
|
||||
void removeChildBone(Bone *bone, bool recursion);
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
/**
|
||||
* Play animation by index, the other param is the same to play.
|
||||
* @param _animationIndex the animation index you want to play
|
||||
* @param animationIndex the animation index you want to play
|
||||
*/
|
||||
void playByIndex(int animationIndex, int durationTo = -1, int durationTween = -1, int loop = -1, int tweenEasing = TWEEN_EASING_MAX);
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
* You should never call this function, unless you know what you do
|
||||
* Update the Process, include current process, current frame and son on
|
||||
*
|
||||
* @param The duration since last update
|
||||
* @param dt The duration since last update
|
||||
*/
|
||||
virtual void update(float dt);
|
||||
|
||||
|
|
|
@ -31,28 +31,28 @@ THE SOFTWARE.
|
|||
|
||||
#define CS_CREATE_NO_PARAM_NO_INIT(varType)\
|
||||
public: \
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var)\
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var)\
|
||||
{\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
}\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
}
|
||||
|
||||
#define CS_CREATE_NO_PARAM(varType)\
|
||||
public: \
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var && var->init())\
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var && var->init())\
|
||||
{\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
}\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
}
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
@ -72,19 +72,19 @@ public:
|
|||
* Copy datas from node
|
||||
* @param node A BaseData to copy datas
|
||||
*/
|
||||
virtual void copy(const BaseData *_node);
|
||||
virtual void copy(const BaseData *node);
|
||||
|
||||
/*
|
||||
* Calculate two BaseData's between value(_to - _from) and set to self
|
||||
* Calculate two BaseData's between value(to - from) and set to self
|
||||
*
|
||||
* @param from from BaseData
|
||||
* @param to to BaseData
|
||||
*/
|
||||
virtual void subtract(BaseData *_from, BaseData *_to);
|
||||
virtual void subtract(BaseData *from, BaseData *to);
|
||||
public:
|
||||
float x; //! position x attribute
|
||||
float y; //! position y attribute
|
||||
int zOrder; //! zorder attribute, used to order the Bone's depth order
|
||||
float x; //! position x attribute
|
||||
float y; //! position y attribute
|
||||
int zOrder; //! zorder attribute, used to order the Bone's depth order
|
||||
|
||||
/**
|
||||
* x y skewX skewY scaleX scaleY used to calculate transform matrix
|
||||
|
@ -96,9 +96,9 @@ public:
|
|||
float scaleX;
|
||||
float scaleY;
|
||||
|
||||
float tweenRotate; //! SkewX, SkewY, and TweenRotate effect the rotation
|
||||
float tweenRotate; //! SkewX, SkewY, and TweenRotate effect the rotation
|
||||
|
||||
bool isUseColorInfo; //! Whether or not this frame have the color changed Info
|
||||
bool isUseColorInfo; //! Whether or not this frame have the color changed Info
|
||||
int a, r, g, b;
|
||||
|
||||
};
|
||||
|
@ -242,9 +242,9 @@ public:
|
|||
void addDisplayData(DisplayData *displayData);
|
||||
DisplayData *getDisplayData(int index);
|
||||
public:
|
||||
std::string name; //! the bone's name
|
||||
std::string parentName; //! the bone parent's name
|
||||
Array displayDataList; //! save DisplayData informations for the Bone
|
||||
std::string name; //! the bone's name
|
||||
std::string parentName; //! the bone parent's name
|
||||
Array displayDataList; //! save DisplayData informations for the Bone
|
||||
};
|
||||
|
||||
|
||||
|
@ -313,10 +313,10 @@ public:
|
|||
void addFrameData(FrameData *frameData);
|
||||
FrameData *getFrameData(int index);
|
||||
public:
|
||||
float delay; //! movement delay percent, this value can produce a delay effect
|
||||
float scale; //! scale this movement
|
||||
float duration; //! this Bone in this movement will last _duration frames
|
||||
std::string name; //! bone name
|
||||
float delay; //! movement delay percent, this value can produce a delay effect
|
||||
float scale; //! scale this movement
|
||||
float duration; //! this Bone in this movement will last _duration frames
|
||||
std::string name; //! bone name
|
||||
|
||||
Array frameList;
|
||||
};
|
||||
|
@ -351,7 +351,7 @@ public:
|
|||
*/
|
||||
int durationTween;
|
||||
|
||||
bool loop; //! whether the movement is looped
|
||||
bool loop; //! whether the movement is looped
|
||||
|
||||
/**
|
||||
* Which tween easing effect the movement use
|
||||
|
@ -360,10 +360,9 @@ public:
|
|||
TweenType tweenEasing;
|
||||
|
||||
/**
|
||||
* @brief save movment bone datas
|
||||
* @key std::string
|
||||
* @value MovementBoneData *
|
||||
*/
|
||||
* Dictionary to save movment bone data.
|
||||
* Key type is std::string, value type is MovementBoneData *.
|
||||
*/
|
||||
Dictionary movBoneDataDic;
|
||||
};
|
||||
|
||||
|
@ -442,13 +441,13 @@ public:
|
|||
ContourData *getContourData(int index);
|
||||
public:
|
||||
|
||||
float height; //! The texture's width, height
|
||||
float width;
|
||||
float height; //! The texture's width, height
|
||||
float width;
|
||||
|
||||
float pivotX; //! The texture's anchor point
|
||||
float pivotX; //! The texture's anchor point
|
||||
float pivotY;
|
||||
|
||||
std::string name; //! The texture's name
|
||||
std::string name; //! The texture's name
|
||||
|
||||
Array contourDataList;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ THE SOFTWARE.
|
|||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
/**
|
||||
* @brief format and manage armature configuration and armature animation
|
||||
* @brief format and manage armature configuration and armature animation
|
||||
*/
|
||||
class ArmatureDataManager : public Object
|
||||
{
|
||||
|
@ -45,105 +45,101 @@ private:
|
|||
~ArmatureDataManager(void);
|
||||
|
||||
public:
|
||||
/**
|
||||
/**
|
||||
* Init ArmatureDataManager
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/**
|
||||
* Add armature data
|
||||
* @param id The id of the armature data
|
||||
* @param armatureData ArmatureData *
|
||||
* @brief Add armature data.
|
||||
*
|
||||
* @param id The id of the armature data.
|
||||
* @param armatureData The armature data to be added.
|
||||
*/
|
||||
void addArmatureData(const char *id, ArmatureData *armatureData);
|
||||
|
||||
/**
|
||||
* @brief get armature data
|
||||
/**
|
||||
* @brief Get armature data.
|
||||
*
|
||||
* @param id the id of the armature data you want to get
|
||||
*
|
||||
* @return ArmatureData *
|
||||
* @param id The id of the armature data you want to get.
|
||||
*
|
||||
* @return The ArmatureData whose id is @p id.
|
||||
*/
|
||||
ArmatureData *getArmatureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief add animation data
|
||||
* @brief Add animation data.
|
||||
*
|
||||
* @param id the id of the animation data
|
||||
*
|
||||
* @return AnimationData *
|
||||
* @param id The id of the animation data.
|
||||
* @param animationData The animation data to be added.
|
||||
*/
|
||||
void addAnimationData(const char *id, AnimationData *animationData);
|
||||
|
||||
/**
|
||||
* @brief get animation data from _animationDatas(Dictionary)
|
||||
/**
|
||||
* @brief Get animation data.
|
||||
*
|
||||
* @param id the id of the animation data you want to get
|
||||
*
|
||||
* @return AnimationData *
|
||||
* @param id The id of the animation data you want to get.
|
||||
*
|
||||
* @return The AnimationData whose id is @p id.
|
||||
*/
|
||||
AnimationData *getAnimationData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief add texture data
|
||||
* @brief Add texture data.
|
||||
*
|
||||
* @param id the id of the texture data
|
||||
*
|
||||
* @return TextureData *
|
||||
* @param id The id of the texture data.
|
||||
* @param textureData The texture data to be added.
|
||||
*/
|
||||
void addTextureData(const char *id, TextureData *textureData);
|
||||
|
||||
/**
|
||||
* @brief get texture data
|
||||
/**
|
||||
* @brief Get texture data.
|
||||
*
|
||||
* @param _id the id of the texture data you want to get
|
||||
*
|
||||
* @return TextureData *
|
||||
* @param id The id of the texture data you want to get.
|
||||
*
|
||||
* @return The TextureData whose id is @p id.
|
||||
*/
|
||||
TextureData *getTextureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
void addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
|
||||
/**
|
||||
* @brief Add sprite frame to SpriteFrameCache, it will save display name and it's relative image name
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
|
||||
/**
|
||||
* @brief Add sprite frame to SpriteFrameCache, it will save display name and it's relative image name
|
||||
*/
|
||||
void addSpriteFrameFromFile(const char *plistPath, const char *imagePath);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clear the data in the _armarureDatas and _animationDatas, and set _armarureDatas and _animationDatas to NULL
|
||||
|
||||
/**
|
||||
* @brief Clear the data in the _armarureDatas and _animationDatas, and set _armarureDatas and _animationDatas to NULL
|
||||
*/
|
||||
void removeAll();
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief save amature datas
|
||||
* @key std::string
|
||||
* @value ArmatureData *
|
||||
* Dictionary to save amature data.
|
||||
* Key type is std::string, value type is ArmatureData *.
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _armarureDatas, ArmarureDatas);
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _armarureDatas, ArmarureDatas);
|
||||
|
||||
/**
|
||||
* @brief save animation datas
|
||||
* @key std::string
|
||||
* @value AnimationData *
|
||||
* Dictionary to save animation data.
|
||||
* Key type is std::string, value type is AnimationData *.
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _animationDatas, AnimationDatas);
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _animationDatas, AnimationDatas);
|
||||
|
||||
/**
|
||||
* @brief save texture datas
|
||||
* @key std::string
|
||||
* @value TextureData *
|
||||
/**
|
||||
* Dictionary to save texture data.
|
||||
* Key type is std::string, value type is TextureData *.
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _textureDatas, TextureDatas);
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _textureDatas, TextureDatas);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
* Translate XML export from Dragon Bone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param xmlPath Path of pak file
|
||||
* @param xmlPakPath Path of pak file
|
||||
*/
|
||||
static void addDataFromXMLPak(const char *xmlPakPath);
|
||||
|
||||
|
@ -72,9 +72,9 @@ public:
|
|||
* Translate XML export from Dragon Bone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param xmlPath The cache of the xml
|
||||
* @param fileContent The cache of the xml
|
||||
*/
|
||||
static void addDataFromCache(const char *pFileContent);
|
||||
static void addDataFromCache(const char *fileContent);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,22 +32,22 @@ class CCBMemberVariableAssigner {
|
|||
/**
|
||||
* The callback function of assigning member variable.
|
||||
* @note The member variable must be Node or its subclass.
|
||||
* @param pTarget The custom class.
|
||||
* @param pMemberVariableName The name of the member variable.
|
||||
* @param pNode The member variable.
|
||||
* @param target The custom class.
|
||||
* @param memberVariableName The name of the member variable.
|
||||
* @param node The member variable.
|
||||
* @return Whether the assignment was successful.
|
||||
*/
|
||||
virtual bool onAssignCCBMemberVariable(Object* pTarget, const char* pMemberVariableName, Node* pNode) = 0;
|
||||
virtual bool onAssignCCBMemberVariable(Object* target, const char* memberVariableName, Node* node) = 0;
|
||||
|
||||
/**
|
||||
* The callback function of assigning custom properties.
|
||||
* @note The member variable must be Integer, Float, Boolean or String.
|
||||
* @param pTarget The custom class.
|
||||
* @param pMemberVariableName The name of the member variable.
|
||||
* @param pValue The value of the property.
|
||||
* @param target The custom class.
|
||||
* @param memberVariableName The name of the member variable.
|
||||
* @param value The value of the property.
|
||||
* @return Whether the assignment was successful.
|
||||
*/
|
||||
virtual bool onAssignCCBCustomProperty(Object* pTarget, const char* pMemberVariableName, CCBValue* pCCBValue) { return false; };
|
||||
virtual bool onAssignCCBCustomProperty(Object* target, const char* memberVariableName, CCBValue* value) { return false; };
|
||||
};
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
* If a property is not specified for a state, the default is to use
|
||||
* the ButtonStateNormal value.
|
||||
*
|
||||
* @param title The title label to use for the specified state.
|
||||
* @param label The title label to use for the specified state.
|
||||
* @param state The state that uses the specified title. The values are described
|
||||
* in "CCControlState".
|
||||
*/
|
||||
|
@ -243,4 +243,4 @@ protected:
|
|||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
/**
|
||||
* Initializes a potentiometer with a track sprite and a progress bar.
|
||||
*
|
||||
* @param trackSprite Sprite, that is used as a background.
|
||||
* @param progressSprite ProgressTimer, that is used as a progress bar.
|
||||
* @param trackSprite Sprite, that is used as a background.
|
||||
* @param progressTimer ProgressTimer, that is used as a progress bar.
|
||||
*/
|
||||
bool initWithTrackSprite_ProgressTimer_ThumbSprite(Sprite* trackSprite, ProgressTimer* progressTimer, Sprite* thumbSprite);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
*
|
||||
* @param backgroundSprite Sprite, that is used as a background.
|
||||
* @param progressSprite Sprite, that is used as a progress bar.
|
||||
* @param thumbItem Sprite, that is used as a thumb.
|
||||
* @param thumbSprite Sprite, that is used as a thumb.
|
||||
*/
|
||||
virtual bool initWithSprites(Sprite * backgroundSprite, Sprite* progressSprite, Sprite* thumbSprite);
|
||||
|
||||
|
@ -120,4 +120,4 @@ protected:
|
|||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -73,8 +73,6 @@ public:
|
|||
/**
|
||||
* Returns an autoreleased scroll view object.
|
||||
*
|
||||
* @param size view size
|
||||
* @param container parent object
|
||||
* @return autoreleased scroll view object
|
||||
*/
|
||||
static ScrollView* create();
|
||||
|
@ -97,8 +95,8 @@ public:
|
|||
/**
|
||||
* Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
|
||||
*
|
||||
* @param offset new offset
|
||||
* @param If YES, the view scrolls to the new offset
|
||||
* @param offset The new offset.
|
||||
* @param animated If true, the view will scroll to the new offset.
|
||||
*/
|
||||
void setContentOffset(Point offset, bool animated = false);
|
||||
Point getContentOffset();
|
||||
|
@ -106,8 +104,8 @@ public:
|
|||
* Sets a new content offset. It ignores max/min offset. It just sets what's given. (just like UIKit's UIScrollView)
|
||||
* You can override the animation duration with this method.
|
||||
*
|
||||
* @param offset new offset
|
||||
* @param animation duration
|
||||
* @param offset The new offset.
|
||||
* @param dt The animation duration.
|
||||
*/
|
||||
void setContentOffsetInDuration(Point offset, float dt);
|
||||
|
||||
|
@ -115,8 +113,8 @@ public:
|
|||
/**
|
||||
* Sets a new scale and does that for a predefined duration.
|
||||
*
|
||||
* @param s a new scale vale
|
||||
* @param animated if YES, scaling is animated
|
||||
* @param s The new scale vale
|
||||
* @param animated If true, scaling is animated
|
||||
*/
|
||||
void setZoomScale(float s, bool animated);
|
||||
|
||||
|
@ -125,8 +123,8 @@ public:
|
|||
/**
|
||||
* Sets a new scale for container in a given duration.
|
||||
*
|
||||
* @param s a new scale value
|
||||
* @param animation duration
|
||||
* @param s The new scale value
|
||||
* @param dt The animation duration
|
||||
*/
|
||||
void setZoomScaleInDuration(float s, float dt);
|
||||
/**
|
||||
|
@ -140,7 +138,7 @@ public:
|
|||
/**
|
||||
* Determines if a given node's bounding box is in visible bounds
|
||||
*
|
||||
* @return YES if it is in visible bounds
|
||||
* @returns true if it is in visible bounds
|
||||
*/
|
||||
bool isNodeVisible(Node * node);
|
||||
/**
|
||||
|
@ -203,7 +201,7 @@ protected:
|
|||
/**
|
||||
* Relocates the container at the proper offset, in bounds of max/min offsets.
|
||||
*
|
||||
* @param animated If YES, relocation is animated
|
||||
* @param animated If true, relocation is animated
|
||||
*/
|
||||
void relocateContainer(bool animated);
|
||||
/**
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
* If the compare message does not result NSComparisonResult, sorting behavior
|
||||
* is not defined. It ignores duplicate entries and inserts next to it.
|
||||
*
|
||||
* @param object to insert
|
||||
* @param object The object to be inserted.
|
||||
*/
|
||||
void insertSortedObject(SortableObject* object);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
* Removes an object with given key and value. If no object is found in array
|
||||
* with the key and value, no action is taken.
|
||||
*
|
||||
* @param value to remove
|
||||
* @param object The object to be removed.
|
||||
*/
|
||||
void removeSortedObject(SortableObject* object);
|
||||
/*!
|
||||
|
@ -72,8 +72,8 @@ public:
|
|||
* keep consistency of being sorted. If it is changed externally, it must be
|
||||
* sorted completely again.
|
||||
*
|
||||
* @param value to set
|
||||
* @param object the object which has the value
|
||||
* @param tag The value to be set to.
|
||||
* @param object The object which has the value.
|
||||
*/
|
||||
void setObjectID_ofSortedObject(unsigned int tag, SortableObject* object);
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
* Returns an object with given key and value. If no object is found,
|
||||
* it returns nil.
|
||||
*
|
||||
* @param value to locate object
|
||||
* @param tag The value to locate object
|
||||
* @return object found or nil.
|
||||
*/
|
||||
SortableObject* getObjectWithObjectID(unsigned int tag);
|
||||
|
@ -97,8 +97,8 @@ public:
|
|||
* would have been located. If object must be located at the end of array,
|
||||
* it returns the length of the array, which is out of bound.
|
||||
*
|
||||
* @param value to locate object
|
||||
* @return index of an object found
|
||||
* @param obj The object
|
||||
* @return index of the object
|
||||
*/
|
||||
unsigned int indexOfSortedObject(SortableObject* obj);
|
||||
|
||||
|
|
|
@ -59,22 +59,19 @@ public:
|
|||
* Add a get request to task queue
|
||||
* @param request a HttpRequest object, which includes url, response callback etc.
|
||||
please make sure request->_requestData is clear before calling "send" here.
|
||||
* @return NULL
|
||||
*/
|
||||
void send(HttpRequest* request);
|
||||
|
||||
|
||||
/**
|
||||
* Change the connect timeout
|
||||
* @param timeout
|
||||
* @return NULL
|
||||
* @param value The desired timeout.
|
||||
*/
|
||||
inline void setTimeoutForConnect(int value) {_timeoutForConnect = value;};
|
||||
|
||||
/**
|
||||
* Get connect timeout
|
||||
* @return int
|
||||
*
|
||||
*/
|
||||
inline int getTimeoutForConnect() {return _timeoutForConnect;}
|
||||
|
||||
|
@ -82,7 +79,6 @@ public:
|
|||
/**
|
||||
* Change the download timeout
|
||||
* @param value
|
||||
* @return NULL
|
||||
*/
|
||||
inline void setTimeoutForRead(int value) {_timeoutForRead = value;};
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ bool WebSocket::init(const Delegate& delegate,
|
|||
_wsProtocols = new libwebsocket_protocols[protocolCount+1];
|
||||
memset(_wsProtocols, 0, sizeof(libwebsocket_protocols)*(protocolCount+1));
|
||||
|
||||
if (protocols)
|
||||
if (protocols && protocols->size() > 0)
|
||||
{
|
||||
int i = 0;
|
||||
for (std::vector<std::string>::const_iterator iter = protocols->begin(); iter != protocols->end(); ++iter, ++i)
|
||||
|
|
|
@ -6,52 +6,10 @@ LOCAL_MODULE := box2d_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libbox2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
Collision/Shapes/b2ChainShape.cpp \
|
||||
Collision/Shapes/b2CircleShape.cpp \
|
||||
Collision/Shapes/b2EdgeShape.cpp \
|
||||
Collision/Shapes/b2PolygonShape.cpp \
|
||||
Collision/b2BroadPhase.cpp \
|
||||
Collision/b2CollideCircle.cpp \
|
||||
Collision/b2CollideEdge.cpp \
|
||||
Collision/b2CollidePolygon.cpp \
|
||||
Collision/b2Collision.cpp \
|
||||
Collision/b2Distance.cpp \
|
||||
Collision/b2DynamicTree.cpp \
|
||||
Collision/b2TimeOfImpact.cpp \
|
||||
Common/b2BlockAllocator.cpp \
|
||||
Common/b2Draw.cpp \
|
||||
Common/b2Math.cpp \
|
||||
Common/b2Settings.cpp \
|
||||
Common/b2StackAllocator.cpp \
|
||||
Common/b2Timer.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 \
|
||||
Dynamics/b2Body.cpp \
|
||||
Dynamics/b2ContactManager.cpp \
|
||||
Dynamics/b2Fixture.cpp \
|
||||
Dynamics/b2Island.cpp \
|
||||
Dynamics/b2World.cpp \
|
||||
Dynamics/b2WorldCallbacks.cpp \
|
||||
Rope/b2Rope.cpp
|
||||
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_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
|
|
|
@ -6,36 +6,10 @@ LOCAL_MODULE := chipmunk_static
|
|||
|
||||
LOCAL_MODULE_FILENAME := libchipmunk
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
src/chipmunk.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 \
|
||||
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
|
||||
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_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
|
||||
|
|
|
@ -6,111 +6,10 @@ LOCAL_MODULE := cocos_testcpp_common
|
|||
|
||||
LOCAL_MODULE_FILENAME := libtestcppcommon
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
Classes/AccelerometerTest/AccelerometerTest.cpp \
|
||||
Classes/ActionManagerTest/ActionManagerTest.cpp \
|
||||
Classes/ActionsTest/ActionsTest.cpp \
|
||||
Classes/ActionsEaseTest/ActionsEaseTest.cpp \
|
||||
Classes/ActionsProgressTest/ActionsProgressTest.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/CurlTest/CurlTest.cpp \
|
||||
Classes/CurrentLanguageTest/CurrentLanguageTest.cpp \
|
||||
Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp \
|
||||
Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp \
|
||||
Classes/EffectsTest/EffectsTest.cpp \
|
||||
Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \
|
||||
Classes/ExtensionsTest/ExtensionsTest.cpp \
|
||||
Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.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/CocosBuilderTest/CocosBuilderTest.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \
|
||||
Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.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/NetworkTest/HttpClientTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \
|
||||
Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp \
|
||||
Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \
|
||||
Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \
|
||||
Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \
|
||||
Classes/FontTest/FontTest.cpp \
|
||||
Classes/IntervalTest/IntervalTest.cpp \
|
||||
Classes/KeypadTest/KeypadTest.cpp \
|
||||
Classes/LabelTest/LabelTest.cpp \
|
||||
Classes/LayerTest/LayerTest.cpp \
|
||||
Classes/NodeTest/NodeTest.cpp \
|
||||
Classes/TextInputTest/TextInputTest.cpp \
|
||||
Classes/MenuTest/MenuTest.cpp \
|
||||
Classes/MotionStreakTest/MotionStreakTest.cpp \
|
||||
Classes/MutiTouchTest/MutiTouchTest.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/TextureCacheTest/TextureCacheTest.cpp \
|
||||
Classes/Texture2dTest/Texture2dTest.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 \
|
||||
Classes/FileUtilsTest/FileUtilsTest.cpp \
|
||||
Classes/DataVisitorTest/DataVisitorTest.cpp \
|
||||
Classes/ConfigurationTest/ConfigurationTest.cpp \
|
||||
Classes/controller.cpp \
|
||||
Classes/testBasic.cpp \
|
||||
Classes/AppDelegate.cpp \
|
||||
Classes/BaseTest.cpp \
|
||||
Classes/VisibleRect.cpp
|
||||
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_C_INCLUDES := $(LOCAL_PATH)/Classes
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ static std::function<Layer*()> createFunctions[] = {
|
|||
CL(ActionOrbit),
|
||||
CL(ActionFollow),
|
||||
CL(ActionTargeted),
|
||||
CL(ActionTargetedReverse),
|
||||
CL(ActionMoveStacked),
|
||||
CL(ActionMoveJumpStacked),
|
||||
CL(ActionMoveBezierStacked),
|
||||
|
@ -1335,6 +1336,37 @@ std::string ActionTargeted::subtitle()
|
|||
return "Action that runs on another target. Useful for sequences";
|
||||
}
|
||||
|
||||
|
||||
void ActionTargetedReverse::onEnter()
|
||||
{
|
||||
ActionsDemo::onEnter();
|
||||
centerSprites(2);
|
||||
|
||||
|
||||
auto jump1 = JumpBy::create(2,Point::ZERO,100,3);
|
||||
auto jump2 = jump1->clone();
|
||||
auto rot1 = RotateBy::create(1, 360);
|
||||
auto rot2 = rot1->clone();
|
||||
|
||||
auto t1 = TargetedAction::create(_kathia, jump2);
|
||||
auto t2 = TargetedAction::create(_kathia, rot2);
|
||||
|
||||
auto seq = Sequence::create(jump1, t1->reverse(), rot1, t2->reverse(), NULL);
|
||||
auto always = RepeatForever::create(seq);
|
||||
|
||||
_tamara->runAction(always);
|
||||
}
|
||||
|
||||
std::string ActionTargetedReverse::title()
|
||||
{
|
||||
return "ActionTargetedReverse";
|
||||
}
|
||||
|
||||
std::string ActionTargetedReverse::subtitle()
|
||||
{
|
||||
return "Action that runs reversely on another target. Useful for sequences";
|
||||
}
|
||||
|
||||
//#pragma mark - ActionStacked
|
||||
|
||||
void ActionStacked::onEnter()
|
||||
|
|
|
@ -289,6 +289,14 @@ public:
|
|||
virtual std::string subtitle();
|
||||
};
|
||||
|
||||
class ActionTargetedReverse : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
||||
class ActionStacked : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 14bfdc37af1e2c28ec6f8568d9034bc747478ec5
|
||||
Subproject commit 57b1444dc0f2b4176d9709e6d026ac3da76be1a2
|
|
@ -71,7 +71,7 @@ public:
|
|||
@brief Remove Object from lua state
|
||||
@param object to remove
|
||||
*/
|
||||
virtual void removeScriptObjectByObject(Object* pObj);
|
||||
virtual void removeScriptObjectByObject(Object* object);
|
||||
|
||||
/**
|
||||
@brief Remove Lua function reference
|
||||
|
|
|
@ -62,9 +62,9 @@ public:
|
|||
|
||||
/**
|
||||
@brief Remove Object from lua state
|
||||
@param object to remove
|
||||
@param object The object to be removed.
|
||||
*/
|
||||
virtual void removeScriptObjectByObject(Object* pObj);
|
||||
virtual void removeScriptObjectByObject(Object* object);
|
||||
|
||||
/**
|
||||
@brief Remove Lua function reference
|
||||
|
|
|
@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/inc
|
|||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||
classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak
|
||||
classes = Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
|
|
Loading…
Reference in New Issue