Classes¶
UI/Sprite
Brief descriptions¶
Classes |
|
Provides functionality for sprite managing, i.e. an image container with standard GUI element behavior. |
Detailed information¶
ui::Sprite¶
engine/core/modules/ui/include/nau/ui/elements/sprite.h
-
class Sprite : public nau::ui::Node, protected cocos2d::Sprite¶
Provides functionality for sprite managing, i.e. an image container with standard GUI element behavior.
Public Functions
-
bool initWithSpriteFrameContainer(const SpriteFrameHandler &container)¶
Initializes the sprite from a sprite frame handler.
- Parameters:
Sprite – frame handler.
-
bool initWithTexture2dContainer(const Texture2DHandler &container)¶
Initializes the sprite from a texture handler.
- Parameters:
container – [in] Texture handle.
-
virtual void addChild(Node *child) override¶
Attaches a child GUI object to the sprite.
See cocos2d::Node::addChild.
- Parameters:
child – [in] A pointer to the object to attach.
-
virtual void reorderChild(Node *child, int zOrder) override¶
Changes z-order of a sprite child.
- Parameters:
child – [in] A pointer to the object to reorder.
zOrder – [in] z-order value to set.
-
virtual void removeChild(Node *child, bool cleanup)¶
Detaches the GUI element from the sprite.
- Parameters:
child – [in] A pointer to the object to detach.
cleanup – [in] Indicates whether all running actions and callbacks on the detached object should be cleaned up.
-
virtual bool initWithFile(const eastl::string &filename)¶
Initializes the sprite with the image file.
- Parameters:
filename – [in] Path to the image file.
- Returns:
true
on success,false
otherwise.
-
virtual bool initWithFile(const eastl::string &filename, const cocos2d::Rect &rect)¶
Initializes the sprite with the image file.
- Parameters:
filename – [in] Path to the image file.
rect – [in] Image area rectangle.
- Returns:
true
on success,false
otherwise.
-
virtual void setScaleX(float scaleX) override¶
Changes sprite scale along X-axis.
- Parameters:
scaleX – [in] Value to assign.
-
virtual void setScaleY(float scaleY) override¶
Changes sprite scale along Y-axis.
- Parameters:
scaleY – [in] Value to assign.
-
virtual void setScale(float scale) override¶
Changes sprite scale uniformly.
- Parameters:
scale – [in] Value to assign.
-
virtual void setScale(float scaleX, float scaleY) override¶
Changes sprite scale.
- Parameters:
scaleX, scaleY – [in] New sprite scales along the axes.
-
virtual void setPosition(const nau::math::vec2 &pos) override¶
Changes sprite position.
- Parameters:
pos – [in] Value to assign.
-
virtual void setRotation(float rotation) override¶
Changes sprite rotation.
- Parameters:
rotation – [in] Value to assign.
-
virtual void setRotationSkewX(float fRotationX) override¶
Changes sprite skew along X-axis with rotation.
@[aram [in] fRotationX Value to set.
-
virtual void setRotationSkewY(float fRotationY) override¶
Changes sprite skew along Y-axis with rotation.
@[aram [in] fRotationY Value to set.
-
virtual void setSkewX(float sx) override¶
Changes sprite skew along X-axis.
@[aram [in] fRotationX Value to set.
-
virtual void setSkewY(float sy) override¶
Changes sprite skew along Y-axis.
@[aram [in] fRotationY Value to set.
-
virtual void setPositionZ(float fVertexZ) override¶
Changes z-value (depth) of the sprite.
- Parameters:
fVertexZ – [in] Value to set.
-
virtual void setAnchorPoint(const math::vec2 &anchorPoint) override¶
Changes sprite anchor point position.
An anchor point of a GUI element is a point all element transfomations happen about.
- Parameters:
anchorPoint – [in] New position of the anchor point.
-
virtual void setContentSize(const math::vec2 &size) override¶
Changes the ‘base’ (unscaled) size of the sprite.
- Parameters:
size – [in] Value to assign.
-
virtual void setVisible(bool bVisible) override¶
Changes sprite visibility.
- Parameters:
bVisible – [in] Indicates whether the sprite should be visible or not.
-
virtual void setOpacityModifyRGB(bool modify) override¶
Change whether the opacity should impact sprite color.
- Parameters:
modify – [in] Indicates whether the opacity should impact sprite color.
Public Static Functions
-
static Sprite *create()¶
Creates an empty sprite.
- Returns:
A pointer to the constructed sprite object.
-
bool initWithSpriteFrameContainer(const SpriteFrameHandler &container)¶