Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cocos/2d/CCAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ class CC_DLL Action : public Ref, public Clonable
inline int getTag() const { return _tag; }
inline void setTag(int tag) { _tag = tag; }

protected:
CC_CONSTRUCTOR_ACCESS:
Action();
virtual ~Action();

protected:
Node *_originalTarget;
/** The "target".
The target will be set with the 'startWithTarget' method.
Expand Down Expand Up @@ -140,12 +141,13 @@ class CC_DLL FiniteTimeAction : public Action
virtual FiniteTimeAction* reverse() const override = 0;
virtual FiniteTimeAction* clone() const override = 0;

protected:
CC_CONSTRUCTOR_ACCESS:
FiniteTimeAction()
: _duration(0)
{}
virtual ~FiniteTimeAction(){}

protected:
//! duration in seconds
float _duration;

Expand Down
6 changes: 4 additions & 2 deletions cocos/2d/CCActionGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ class CC_DLL GridAction : public ActionInterval
virtual GridAction* reverse() const override;
virtual void startWithTarget(Node *target) override;

protected:
CC_CONSTRUCTOR_ACCESS:
GridAction() {}
virtual ~GridAction() {}
/** initializes the action with size and duration */
bool initWithDuration(float duration, const Size& gridSize);

protected:
Size _gridSize;

NodeGrid* _gridNodeTarget;
Expand Down Expand Up @@ -273,10 +274,11 @@ class CC_DLL StopGrid : public ActionInstant
virtual StopGrid* clone() const override;
virtual StopGrid* reverse() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
StopGrid() {}
virtual ~StopGrid() {}

protected:
NodeGrid* _gridNodeTarget;

void cacheTargetAsGridNode();
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCActionGrid3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CC_DLL FlipY3D : public FlipX3D
virtual void update(float time) override;
virtual FlipY3D* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
FlipY3D() {}
virtual ~FlipY3D() {}
private:
Expand Down
13 changes: 7 additions & 6 deletions cocos/2d/CCActionInstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CC_DLL Show : public ActionInstant
virtual ActionInstant* reverse() const override;
virtual Show* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
Show(){}
virtual ~Show(){}

Expand All @@ -98,7 +98,7 @@ class CC_DLL Hide : public ActionInstant
virtual ActionInstant* reverse() const override;
virtual Hide* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
Hide(){}
virtual ~Hide(){}

Expand All @@ -121,7 +121,7 @@ class CC_DLL ToggleVisibility : public ActionInstant
virtual ToggleVisibility* reverse() const override;
virtual ToggleVisibility* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
ToggleVisibility(){}
virtual ~ToggleVisibility(){}

Expand Down Expand Up @@ -402,13 +402,14 @@ class CC_DLL __CCCallFuncND : public CallFunc
virtual __CCCallFuncND* clone() const override;
virtual void execute() override;

protected:
CC_CONSTRUCTOR_ACCESS:
__CCCallFuncND() {}
virtual ~__CCCallFuncND() {}

/** initializes the action with the callback and the data to pass as an argument */
bool initWithTarget(Ref* target, SEL_CallFuncND selector, void* d);

protected:
SEL_CallFuncND _callFuncND;
void* _data;

Expand Down Expand Up @@ -441,7 +442,7 @@ class CC_DLL __CCCallFuncO : public CallFunc
Ref* getObject() const;
void setObject(Ref* obj);

protected:
CC_CONSTRUCTOR_ACCESS:
__CCCallFuncO();
virtual ~__CCCallFuncO();
/** initializes the action with the callback
Expand All @@ -450,7 +451,7 @@ class CC_DLL __CCCallFuncO : public CallFunc
*/
bool initWithTarget(Ref* target, SEL_CallFuncO selector, Ref* object);


protected:
/** object to be passed as argument */
Ref* _object;
SEL_CallFuncO _callFuncO;
Expand Down
8 changes: 4 additions & 4 deletions cocos/2d/CCActionTiledGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class CC_DLL FadeOutTRTiles : public TiledGrid3DAction
virtual void update(float time) override;
virtual FadeOutTRTiles* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
FadeOutTRTiles() {}
virtual ~FadeOutTRTiles() {}

Expand All @@ -163,7 +163,7 @@ class CC_DLL FadeOutBLTiles : public FadeOutTRTiles
virtual float testFunc(const Size& pos, float time) override;
virtual FadeOutBLTiles* clone() const override;

protected:
CC_CONSTRUCTOR_ACCESS:
FadeOutBLTiles() {}
virtual ~FadeOutBLTiles() {}

Expand All @@ -186,7 +186,7 @@ class CC_DLL FadeOutUpTiles : public FadeOutTRTiles
virtual FadeOutUpTiles* clone() const override;
virtual float testFunc(const Size& pos, float time) override;

protected:
CC_CONSTRUCTOR_ACCESS:
FadeOutUpTiles() {}
virtual ~FadeOutUpTiles() {}

Expand All @@ -207,7 +207,7 @@ class CC_DLL FadeOutDownTiles : public FadeOutUpTiles
virtual FadeOutDownTiles* clone() const override;
virtual float testFunc(const Size& pos, float time) override;

protected:
CC_CONSTRUCTOR_ACCESS:
FadeOutDownTiles() {}
virtual ~FadeOutDownTiles() {}

Expand Down
23 changes: 12 additions & 11 deletions cocos/2d/CCLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ class CC_DLL Label : public SpriteBatchNode, public LabelProtocol

CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return getLineHeight();}

CC_CONSTRUCTOR_ACCESS:
/**
* @js NA
*/
Label(FontAtlas *atlas = nullptr, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP,bool useDistanceField = false,bool useA8Shader = false);
/**
* @js NA
* @lua NA
*/
virtual ~Label();

protected:
void onDraw(const Mat4& transform, bool transformUpdated);

Expand All @@ -294,17 +306,6 @@ class CC_DLL Label : public SpriteBatchNode, public LabelProtocol
STRING_TEXTURE
};

/**
* @js NA
*/
Label(FontAtlas *atlas = nullptr, TextHAlignment hAlignment = TextHAlignment::LEFT,
TextVAlignment vAlignment = TextVAlignment::TOP,bool useDistanceField = false,bool useA8Shader = false);
/**
* @js NA
* @lua NA
*/
virtual ~Label();

virtual void setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled = false, bool useA8Shader = false);

bool recordLetterInfo(const cocos2d::Vec2& point,const FontLetterDefinition& letterDef, int spriteIndex);
Expand Down
4 changes: 3 additions & 1 deletion cocos/2d/CCLabelAtlas.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CC_DLL LabelAtlas : public AtlasNode, public LabelProtocol
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
#endif

protected:
CC_CONSTRUCTOR_ACCESS:
LabelAtlas()
:_string("")
{}
Expand All @@ -96,6 +96,8 @@ class CC_DLL LabelAtlas : public AtlasNode, public LabelProtocol
{
_string.clear();
}

protected:
virtual void updateColor() override;

#if CC_LABELATLAS_DEBUG_DRAW
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class CC_DLL __LayerRGBA : public Layer, public __RGBAProtocol
virtual void setOpacityModifyRGB(bool bValue) override { return Layer::setOpacityModifyRGB(bValue); }
virtual bool isOpacityModifyRGB() const override { return Layer::isOpacityModifyRGB(); }

protected:
CC_CONSTRUCTOR_ACCESS:
__LayerRGBA();
virtual ~__LayerRGBA() {}

Expand Down
5 changes: 3 additions & 2 deletions cocos/2d/CCNodeGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class NodeGrid : public Node
// overrides
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;

protected:
CC_CONSTRUCTOR_ACCESS:
NodeGrid();
virtual ~NodeGrid();


protected:
void onGridBeginDraw();
void onGridEndDraw();

Expand Down
3 changes: 2 additions & 1 deletion cocos/2d/CCParallaxNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CC_DLL ParallaxNode : public Node
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;

protected:
CC_CONSTRUCTOR_ACCESS:
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
It returns self, so you can chain several addChilds.
@since v0.8
Expand All @@ -83,6 +83,7 @@ class CC_DLL ParallaxNode : public Node
*/
virtual ~ParallaxNode();

protected:
Vec2 absolutePosition();

Vec2 _lastPosition;
Expand Down
2 changes: 1 addition & 1 deletion cocos/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/. \
$(LOCAL_PATH)/platform/android \
$(LOCAL_PATH)/base
$(LOCAL_PATH)/base \
$(LOCAL_PATH)/../external/tinyxml2 \
$(LOCAL_PATH)/../external/unzip \
$(LOCAL_PATH)/../external/chipmunk/include/chipmunk \
Expand Down
2 changes: 1 addition & 1 deletion cocos/base/CCEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Event : public Ref
CUSTOM
};

protected:
CC_CONSTRUCTOR_ACCESS:
/** Constructor */
Event(Type type);
public:
Expand Down
2 changes: 1 addition & 1 deletion cocos/base/CCEventListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class EventListener : public Ref

typedef std::string ListenerID;

protected:
CC_CONSTRUCTOR_ACCESS:
/** Constructor */
EventListener();

Expand Down
5 changes: 4 additions & 1 deletion cocos/base/CCEventListenerAcceleration.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ class EventListenerAcceleration : public EventListener
/// Overrides
virtual EventListenerAcceleration* clone() override;
virtual bool checkAvailable() override;
private:

CC_CONSTRUCTOR_ACCESS:
EventListenerAcceleration();

bool init(const std::function<void(Acceleration*, Event* event)>& callback);

private:
std::function<void(Acceleration*, Event*)> onAccelerationEvent;

friend class LuaEventListenerAcceleration;
Expand Down
4 changes: 2 additions & 2 deletions cocos/base/CCEventListenerFocus.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class EventListenerFocus : public EventListener
public:
std::function<void(ui::Widget*, ui::Widget*)> onFocusChanged;

private:
CC_CONSTRUCTOR_ACCESS:
EventListenerFocus();
bool init();
private:
friend class EventDispatcher;
};

Expand Down
2 changes: 1 addition & 1 deletion cocos/base/CCEventListenerKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class EventListenerKeyboard : public EventListener

std::function<void(EventKeyboard::KeyCode, Event*)> onKeyPressed;
std::function<void(EventKeyboard::KeyCode, Event*)> onKeyReleased;
private:
CC_CONSTRUCTOR_ACCESS:
EventListenerKeyboard();
bool init();
};
Expand Down
2 changes: 1 addition & 1 deletion cocos/base/CCEventListenerMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EventListenerMouse : public EventListener
std::function<void(Event* event)> onMouseMove;
std::function<void(Event* event)> onMouseScroll;

private:
CC_CONSTRUCTOR_ACCESS:
EventListenerMouse();
bool init();
};
Expand Down
6 changes: 3 additions & 3 deletions cocos/base/CCEventListenerTouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class EventListenerTouchOneByOne : public EventListener
std::function<void(Touch*, Event*)> onTouchEnded;
std::function<void(Touch*, Event*)> onTouchCancelled;

private:
CC_CONSTRUCTOR_ACCESS:
EventListenerTouchOneByOne();
bool init();
private:
std::vector<Touch*> _claimedTouches;
bool _needSwallow;

Expand All @@ -85,7 +85,7 @@ class EventListenerTouchAllAtOnce : public EventListener
std::function<void(const std::vector<Touch*>&, Event*)> onTouchesEnded;
std::function<void(const std::vector<Touch*>&, Event*)> onTouchesCancelled;

private:
CC_CONSTRUCTOR_ACCESS:
EventListenerTouchAllAtOnce();
bool init();
private:
Expand Down
2 changes: 1 addition & 1 deletion cocos/editor-support/cocostudio/CCInputDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace cocostudio {
*/
class InputDelegate
{
protected:
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
Expand Down
5 changes: 4 additions & 1 deletion cocos/editor-support/cocostudio/CCSSceneReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ class SceneReader
void setTarget(const std::function<void(cocos2d::Ref* obj, void* doc)>& selector);
cocos2d::Node* getNodeByTag(int nTag);
inline AttachComponentType getAttachComponentType(){return _attachComponent;}
private:

CC_CONSTRUCTOR_ACCESS:
SceneReader(void);
virtual ~SceneReader(void);

private:
std::string getComponentClassName(const std::string& name);

cocos2d::Component* createComponent(const std::string classname);
Expand Down
5 changes: 3 additions & 2 deletions cocos/platform/desktop/CCGLView.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ class CC_DLL GLView : public GLViewProtocol, public Ref
/** Get retina factor */
int getRetinaFactor() const { return _retinaFactor; }

protected:
CC_CONSTRUCTOR_ACCESS:
GLView();
virtual ~GLView();


protected:
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
bool initWithFullScreen(const std::string& viewName);
bool initWithFullscreen(const std::string& viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
Expand Down
2 changes: 1 addition & 1 deletion extensions/assets-manager/CCEventAssetsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EventAssetsManager : public cocos2d::EventCustom

inline float getPercentByFile() const { return _percentByFile; };

protected:
CC_CONSTRUCTOR_ACCESS:
/** Constructor */
EventAssetsManager(const std::string& eventName, cocos2d::extension::AssetsManager *manager, const EventCode &code, float percent = 0, float percentByFile = 0, const std::string& assetId = "", const std::string& message = "", int curle_code = 0, int curlm_code = 0);

Expand Down