Cocos2d-x  4.0.0
List of all members
BillBoard Class Reference

Inherit from Sprite, achieve BillBoard. More...

Inherits Sprite.

Creators

static BillBoardcreate (Mode mode=Mode::VIEW_POINT_ORIENTED)
 Creates an empty BillBoard without texture.
 
static BillBoardcreate (const std::string &filename, Mode mode=Mode::VIEW_POINT_ORIENTED)
 Creates a BillBoard with an image filename.
 
static BillBoardcreate (const std::string &filename, const Rect &rect, Mode mode=Mode::VIEW_POINT_ORIENTED)
 Creates a BillBoard with an image filename and a rect.
 
static BillBoardcreateWithTexture (Texture2D *texture, Mode mode=Mode::VIEW_POINT_ORIENTED)
 Creates a BillBoard with a Texture2D object.
 
void setMode (Mode mode)
 Set the billboard rotation mode.
 
Mode getMode () const
 Get the billboard rotation mode.
 
virtual void visit (Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override
 update billboard's transform and turn it towards camera
 
virtual void draw (Renderer *renderer, const Mat4 &transform, uint32_t flags) override
 draw BillBoard object.
 
 BillBoard ()
 
virtual ~BillBoard ()
 

Additional Inherited Members

- Public Member Functions inherited from Sprite
virtual bool isFrameDisplayed (SpriteFrame *frame) const
 Returns whether or not a SpriteFrame is being displayed.
 
virtual SpriteFramegetSpriteFrame () const
 Returns the current displayed frame.
 
V3F_C4B_T2F_Quad getQuad () const
 Returns the quad (tex coords, vertex coords and color) information.
 
bool isTextureRectRotated () const
 Returns whether or not the texture rectangle is rotated.
 
unsigned int getAtlasIndex () const
 Returns the index used on the TextureAtlas.
 
void setAtlasIndex (unsigned int atlasIndex)
 Sets the index used on the TextureAtlas.
 
const RectgetTextureRect () const
 Returns the rect of the Sprite in points.
 
TextureAtlasgetTextureAtlas () const
 Gets the weak reference of the TextureAtlas when the sprite is rendered using via SpriteBatchNode.
 
virtual void setProgramState (backend::ProgramState *programState) override
 Set ProgramState.
 
virtual backend::ProgramState * getProgramState () const override
 Get current ProgramState.
 
void setTextureAtlas (TextureAtlas *textureAtlas)
 Sets the weak reference of the TextureAtlas when the sprite is rendered using via SpriteBatchNode.
 
const Vec2getOffsetPosition () const
 Gets the offset position of the sprite.
 
bool isFlippedX () const
 Returns the flag which indicates whether the sprite is flipped horizontally or not.
 
void setFlippedX (bool flippedX)
 Sets whether the sprite should be flipped horizontally or not.
 
bool isFlippedY () const
 Return the flag which indicates whether the sprite is flipped vertically or not.
 
void setFlippedY (bool flippedY)
 Sets whether the sprite should be flipped vertically or not.
 
const PolygonInfogetPolygonInfo () const
 returns a reference of the polygon information associated with this sprite
 
void setPolygonInfo (const PolygonInfo &info)
 set the sprite to use this new PolygonInfo
 
void setStretchEnabled (bool enabled)
 whether or not contentSize stretches the sprite's texture
 
bool isStretchEnabled () const
 returns whether or not contentSize stretches the sprite's texture
 
virtual void updateTransform () override
 Updates the quad according the rotation, position, scale values.
 
virtual SpriteBatchNodegetBatchNode () const
 Returns the batch node object if this sprite is rendered by SpriteBatchNode.
 
virtual void setBatchNode (SpriteBatchNode *spriteBatchNode)
 Sets the batch node to sprite.
 
virtual void setTexture (const std::string &filename)
 Sets a new texture (from a filename) to the sprite.
 
virtual void setTexture (Texture2D *texture) override
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The Texture's rect is not changed.
 
virtual Texture2DgetTexture () const override
 Returns the Texture2D object used by the sprite.
 
virtual void setTextureRect (const Rect &rect)
 Updates the texture rect of the Sprite in points.
 
virtual void setTextureRect (const Rect &rect, bool rotated, const Size &untrimmedSize)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. It will update the texture coordinates and the vertex rectangle.
 
virtual void setVertexRect (const Rect &rect)
 Sets the vertex rect.
 
virtual void setCenterRectNormalized (const Rect &rect)
 setCenterRectNormalized
 
virtual Rect getCenterRectNormalized () const
 getCenterRectNormalized
 
virtual void setCenterRect (const Rect &rect)
 
virtual Rect getCenterRect () const
 Returns the Cap Insets rect.
 
virtual void setSpriteFrame (const std::string &spriteFrameName)
 
virtual void setSpriteFrame (SpriteFrame *newFrame)
 
virtual void setDisplayFrameWithAnimationName (const std::string &animationName, unsigned int frameIndex)
 Changes the display frame with animation name and index.
 
virtual bool isDirty () const
 Whether or not the Sprite needs to be updated in the Atlas.
 
virtual void setDirty (bool dirty)
 Makes the Sprite to be updated in the Atlas.
 
virtual std::string getDescription () const override
 NA
 
virtual void setScaleX (float scaleX) override
 Sets the scale (x) of the node.
 
virtual void setScaleY (float scaleY) override
 Sets the scale (y) of the node.
 
virtual void setScale (float scaleX, float scaleY) override
 Sets the scale (x,y) of the node.
 
virtual void setPosition (const Vec2 &pos) override
 NA NA
 
virtual void setPosition (float x, float y) override
 Sets the position (x,y) of the node in its parent's coordinate system.
 
virtual void setRotation (float rotation) override
 Sets the rotation (angle) of the node in degrees.
 
virtual void setRotationSkewX (float rotationX) override
 Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
 
virtual void setRotationSkewY (float rotationY) override
 Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
 
virtual void setSkewX (float sx) override
 Changes the X skew angle of the node in degrees.
 
virtual void setSkewY (float sy) override
 Changes the Y skew angle of the node in degrees.
 
virtual void removeChild (Node *child, bool cleanup) override
 Removes a child from the container.
 
virtual void removeAllChildrenWithCleanup (bool cleanup) override
 Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
 
virtual void reorderChild (Node *child, int zOrder) override
 Reorders a child according to a new z value.
 
virtual void addChild (Node *child, int zOrder, int tag) override
 Adds a child to the container with z order and tag.
 
virtual void addChild (Node *child, int zOrder, const std::string &name) override
 Adds a child to the container with z order and tag.
 
virtual void sortAllChildren () override
 Sorts the children array once before drawing, instead of every time when a child is added or reordered.
 
virtual void setScale (float scale) override
 Sets the scale (x,y,z) of the node.
 
virtual void setPositionZ (float positionZ) override
 Sets the 'z' coordinate in the position.
 
virtual void setAnchorPoint (const Vec2 &anchor) override
 Sets the anchor point in percent.
 
virtual void setContentSize (const Size &size) override
 Sets the untransformed size of the node.
 
virtual void setIgnoreAnchorPointForPosition (bool value) override
 Sets whether the anchor point will be (0,0) when you position this node.
 
virtual void setVisible (bool bVisible) override
 Sets whether the node is visible.
 
virtual void setOpacityModifyRGB (bool modify) override
 If you want the opacity affect the color property, then set to true.
 
virtual bool isOpacityModifyRGB () const override
 If node opacity will modify the RGB color value, then you should override this method and return true.
 
void setBlendFunc (const BlendFunc &blendFunc) override
 
const BlendFuncgetBlendFunc () const override
 NA NA
 
static Spritecreate ()
 Creates an empty sprite without texture.
 
- Static Public Member Functions inherited from Sprite
static Spritecreate (const std::string &filename)
 Creates a sprite with an image filename.
 
static Spritecreate (const PolygonInfo &info)
 Creates a polygon sprite with a polygon info.
 
static Spritecreate (const std::string &filename, const Rect &rect)
 Creates a sprite with an image filename and a rect.
 
static SpritecreateWithTexture (Texture2D *texture)
 Creates a sprite with a Texture2D object.
 
static SpritecreateWithTexture (Texture2D *texture, const Rect &rect, bool rotated=false)
 Creates a sprite with a texture and a rect.
 
static SpritecreateWithSpriteFrame (SpriteFrame *spriteFrame)
 Creates a sprite with an sprite frame.
 
static SpritecreateWithSpriteFrameName (const std::string &spriteFrameName)
 Creates a sprite with an sprite frame name.
 
- Static Public Member Functions inherited from Node
static Nodecreate ()
 Allocates and initializes a node.
 
static int getAttachedNodeCount ()
 Gets count of nodes those are attached to scene graph.
 
template<typename _T >
static void sortNodes (cocos2d::Vector< _T * > &nodes)
 Sorts helper function.
 
- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
- Static Public Attributes inherited from Sprite
static const int INDEX_NOT_INITIALIZED = -1
 Sprite invalid index on the SpriteBatchNode.
 
- Protected Member Functions inherited from Sprite
 Sprite ()
 ctor
 
virtual bool initWithTexture (Texture2D *texture)
 Initializes a sprite with a texture.
 
virtual bool initWithPolygon (const PolygonInfo &info)
 Initializes a sprite with a PolygonInfo.
 
virtual bool initWithTexture (Texture2D *texture, const Rect &rect)
 Initializes a sprite with a texture and a rect.
 
virtual bool initWithTexture (Texture2D *texture, const Rect &rect, bool rotated)
 Initializes a sprite with a texture and a rect in points, optionally rotated.
 
virtual bool initWithSpriteFrame (SpriteFrame *spriteFrame)
 Initializes a sprite with an SpriteFrame.
 
virtual bool initWithSpriteFrameName (const std::string &spriteFrameName)
 Initializes a sprite with an sprite frame name.
 
virtual bool initWithFile (const std::string &filename)
 Initializes a sprite with an image filename.
 
virtual bool initWithFile (const std::string &filename, const Rect &rect)
 Initializes a sprite with an image filename, and a rect.
 

Detailed Description

Inherit from Sprite, achieve BillBoard.

Member Function Documentation

static BillBoard* create ( Mode  mode = Mode::VIEW_POINT_ORIENTED)
static

Creates an empty BillBoard without texture.

You can call setTexture method subsequently.

Returns
An autoreleased BillBoard object.
static BillBoard* create ( const std::string &  filename,
Mode  mode = Mode::VIEW_POINT_ORIENTED 
)
static

Creates a BillBoard with an image filename.

After creation, the rect of BillBoard will be the size of the image, and the offset will be (0,0).

Parameters
filenameA path to image file, e.g., "scene1/monster.png"
Returns
An autoreleased BillBoard object.
static BillBoard* create ( const std::string &  filename,
const Rect rect,
Mode  mode = Mode::VIEW_POINT_ORIENTED 
)
static

Creates a BillBoard with an image filename and a rect.

Parameters
filenameA path to image file, e.g., "scene1/monster.png"
rectA subrect of the image file
Returns
An autoreleased BillBoard object
static BillBoard* createWithTexture ( Texture2D texture,
Mode  mode = Mode::VIEW_POINT_ORIENTED 
)
static

Creates a BillBoard with a Texture2D object.

After creation, the rect will be the size of the texture, and the offset will be (0,0).

Parameters
textureA pointer to a Texture2D object.
Returns
An autoreleased BillBoard object
void setMode ( Mode  mode)

Set the billboard rotation mode.

Mode getMode ( ) const

Get the billboard rotation mode.

virtual void draw ( Renderer *  renderer,
const Mat4 transform,
uint32_t  flags 
)
overridevirtual

draw BillBoard object.

NA

Reimplemented from Sprite.


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