cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DisplayManager Class Reference

! DisplayManager manages Bone's display More...

#include <CCDisplayManager.h>

Inheritance diagram for DisplayManager:
Ref

Public Member Functions

 DisplayManager ()
 ~DisplayManager ()
bool init (Bone *bone)
virtual void initDisplayList (BoneData *boneData)
 Use BoneData to init the display list. More...
 
void addDisplay (DisplayData *displayData, int index)
 Add display and use _DisplayData init the display. More...
 
void addDisplay (cocos2d::Node *display, int index)
void removeDisplay (int index)
const cocos2d::Vector
< DecorativeDisplay * > & 
getDecorativeDisplayList () const
void changeDisplayByIndex (int index, bool force)
void changeDisplayByName (const std::string &name, bool force)
void changeDisplayWithIndex (int index, bool force)
 Change display by index. More...
 
void changeDisplayWithName (const std::string &name, bool force)
cocos2d::NodegetDisplayRenderNode () const
DisplayType getDisplayRenderNodeType () const
int getCurrentDisplayIndex () const
virtual void setCurrentDecorativeDisplay (DecorativeDisplay *decoDisplay)
virtual DecorativeDisplaygetCurrentDecorativeDisplay () const
virtual DecorativeDisplaygetDecorativeDisplayByIndex (int index) const
virtual void setVisible (bool visible)
 Sets whether the display is visible The default value is true, a node is default to visible. More...
 
virtual bool isVisible () const
 Determines if the display is visible. More...
 
cocos2d::Size getContentSize () const
cocos2d::Rect getBoundingBox () const
cocos2d::Vec2 getAnchorPoint () const
cocos2d::Vec2 getAnchorPointInPoints () const
virtual bool containPoint (cocos2d::Vec2 &_point)
 Check if the position is inside the bone. More...
 
virtual bool containPoint (float x, float y)
 Check if the position is inside the bone. More...
 
virtual void setForceChangeDisplay (bool force)
virtual bool isForceChangeDisplay () const
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Static Public Member Functions

static DisplayManagercreate (Bone *bone)

Protected Attributes

cocos2d::Vector
< DecorativeDisplay * > 
_decoDisplayList
cocos2d::Node_displayRenderNode
 Display render node. More...
 
DisplayType _displayType
 Display render node type. More...
 
DecorativeDisplay_currentDecoDisplay
 Include current display information, like contour sprite, etc. More...
 
int _displayIndex
 Current display index. More...
 
bool _forceChangeDisplay
bool _visible
 Whether of not the bone is visible. Default is true. More...
 
Bone_bone
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 
local _referenceCount
 count of references More...
 

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Detailed Description

! DisplayManager manages Bone's display

Constructor & Destructor Documentation

Member Function Documentation

void addDisplay ( DisplayData displayData,
int  index 
)

Add display and use _DisplayData init the display.

If index already have a display, then replace it. If index is current display index, then also change display to _index

Parameters
displayDatait include the display information, like DisplayType. If you want to create a sprite display, then create a SpriteDisplayData param
indexthe index of the display you want to replace or add to -1 : append display from back
void addDisplay ( cocos2d::Node display,
int  index 
)
void changeDisplayByIndex ( int  index,
bool  force 
)
void changeDisplayByName ( const std::string &  name,
bool  force 
)
void changeDisplayWithIndex ( int  index,
bool  force 
)

Change display by index.

You can just use this method to change display in the display list. The display list is just used for this bone, and it is the displays you may use in every frame.

Note : if index is the same with prev index, the method will not effect

Parameters
indexThe index of the display you want to change
forceIf true, then force change display to specified display, or current display will set to display index edit in the flash every key frame.
void changeDisplayWithName ( const std::string &  name,
bool  force 
)
virtual bool containPoint ( cocos2d::Vec2 &  _point)
virtual

Check if the position is inside the bone.

virtual bool containPoint ( float  x,
float  y 
)
virtual

Check if the position is inside the bone.

static DisplayManager* create ( Bone bone)
static
cocos2d::Vec2 getAnchorPoint ( ) const
cocos2d::Vec2
getAnchorPointInPoints
( ) const
cocos2d::Rect getBoundingBox ( ) const
cocos2d::Size getContentSize ( ) const
virtual DecorativeDisplay*
getCurrentDecorativeDisplay
( ) const
virtual
int getCurrentDisplayIndex ( ) const
virtual DecorativeDisplay*
getDecorativeDisplayByIndex
( int  index) const
virtual
const cocos2d::Vector
<DecorativeDisplay*>
& getDecorativeDisplayList
( ) const
cocos2d::Node* getDisplayRenderNode ( ) const
DisplayType
getDisplayRenderNodeType
( ) const
bool init ( Bone bone)
virtual void initDisplayList ( BoneData boneData)
virtual

Use BoneData to init the display list.

If display is a sprite, and it have texture info in the TexutreData, then use TexutreData to init the display's anchor point If the display is a Armature, then create a new Armature

virtual bool isForceChangeDisplay ( ) const
inlinevirtual
virtual bool isVisible ( ) const
virtual

Determines if the display is visible.

See also
setVisible(bool)
Returns
true if the node is visible, false if the node is hidden.
void removeDisplay ( int  index)
virtual void
setCurrentDecorativeDisplay
( DecorativeDisplay decoDisplay)
virtual
virtual void setForceChangeDisplay ( bool  force)
inlinevirtual
virtual void setVisible ( bool  visible)
virtual

Sets whether the display is visible The default value is true, a node is default to visible.

Parameters
visibletrue if the node is visible, false if the node is hidden.

Member Data Documentation

Bone* _bone
protected
DecorativeDisplay*
_currentDecoDisplay
protected

Include current display information, like contour sprite, etc.

cocos2d::Vector
<DecorativeDisplay*>
_decoDisplayList
protected
int _displayIndex
protected

Current display index.

cocos2d::Node* _displayRenderNode
protected

Display render node.

DisplayType _displayType
protected

Display render node type.

bool _forceChangeDisplay
protected
bool _visible
protected

Whether of not the bone is visible. Default is true.


The documentation for this class was generated from the following file: