.. index:: pair: class; EE::Graphics::Sprite .. _doxid-class_e_e_1_1_graphics_1_1_sprite: class EE::Graphics::Sprite ========================== .. toctree:: :hidden: enum_EE_Graphics_Sprite_SpriteEvents.rst class_EE_Graphics_Sprite_Frame.rst Overview ~~~~~~~~ A :ref:`Sprite ` controller class, can hold and control sprites animations. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Sprite: public :ref:`EE::Graphics::Drawable` { public: // typedefs typedef std::function`, Sprite*, void*)> :ref:`SpriteCallback`; // enums enum :ref:`SpriteEvents`; // classes class :ref:`Frame`; // construction :ref:`Sprite`(); :ref:`Sprite`(const std::string& name, const std::string& extension = "", :ref:`TextureAtlas`* SearchInTextureAtlas = NULL); :ref:`Sprite`(:ref:`TextureRegion`* TextureRegion); :ref:`Sprite`(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); virtual :target:`~Sprite`(); // methods static Sprite* :target:`New`(); static Sprite* :target:`New`(const std::string& name, const std::string& extension = "", :ref:`TextureAtlas`* SearchInTextureAtlas = NULL); static Sprite* :target:`New`(:ref:`TextureRegion`* TextureRegion); static Sprite* :target:`New`(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); Sprite& :target:`operator=`(const Sprite& Other); void :ref:`setRotation`(const :ref:`Float`& rotation); :ref:`Float` :ref:`getRotation`() const; void :ref:`rotate`(const :ref:`Float`& angle); void :ref:`setScale`(const :ref:`Float`& scale); void :ref:`setScale`(const :ref:`Vector2f`& scale); const :ref:`Vector2f`& :ref:`getScale`() const; void :ref:`setOrigin`(const :ref:`OriginPoint`& origin); const :ref:`OriginPoint`& :ref:`getOrigin`() const; void :ref:`setSize`(const :ref:`Sizef`& size, const unsigned int& FrameNum, const unsigned int& SubFrame); void :ref:`setSize`(const :ref:`Sizef`& size); :ref:`Sizef` :ref:`setSize`(const unsigned int& FrameNum, const unsigned int& SubFrame); virtual :ref:`Sizef` :ref:`getSize`(); virtual :ref:`Sizef` :target:`getPixelsSize`(); void :ref:`setAnimationSpeed`(const :ref:`Float`& animSpeed); :ref:`Float` :ref:`getAnimationSpeed`() const; bool :ref:`isAnimationPaused`() const; void :ref:`setAnimationPaused`(const bool& Pause); void :ref:`setCurrentFrame`(unsigned int CurFrame); const unsigned int& :ref:`getCurrentFrame`() const; const :ref:`Float`& :ref:`getExactCurrentFrame`() const; void :ref:`setExactCurrentFrame`(const :ref:`Float`& currentFrame); void :ref:`setCurrentSubFrame`(const unsigned int& CurSubFrame); const unsigned int& :ref:`getCurrentSubFrame`() const; void :ref:`setRenderMode`(const :ref:`RenderMode`& Effect); const :ref:`RenderMode`& :ref:`getRenderMode`() const; void :ref:`setBlendMode`(const :ref:`BlendMode`& Blend); const :ref:`BlendMode`& :ref:`getBlendMode`() const; void :ref:`reset`(); :ref:`Rectf` :ref:`getAABB`(); void :ref:`updateVertexColors`(const :ref:`Color`& Color0, const :ref:`Color`& Color1, const :ref:`Color`& Color2, const :ref:`Color`& Color3); void :ref:`disableVertexColors`(); bool :ref:`createStatic`(:ref:`TextureRegion`* TextureRegion); bool :ref:`createStatic`(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); bool :ref:`createStatic`(:ref:`Texture`* tex, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); void :ref:`createAnimation`(const unsigned int& SubFramesNum = 1); unsigned int :ref:`addFrame`(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); unsigned int :ref:`addFrame`(:ref:`Texture`* tex, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); unsigned int :ref:`addFrame`(:ref:`TextureRegion`* TextureRegion); bool :ref:`addFrames`(const std::vector<:ref:`TextureRegion`*> TextureRegions); bool :ref:`addFramesByPattern`(const std::string& name, const std::string& extension = "", :ref:`TextureAtlas`* SearchInTextureAtlas = NULL); bool :target:`addFramesByPatternId`(const :ref:`Uint32`& TextureRegionId, const std::string& extension, :ref:`TextureAtlas`* SearchInTextureAtlas); bool :ref:`addSubFrame`(:ref:`Texture`* tex, const unsigned int& NumFrame, const unsigned int& NumSubFrame, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); bool :ref:`addSubFrame`(const :ref:`Uint32`& TexId, const unsigned int& NumFrame, const unsigned int& NumSubFrame, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)); bool :ref:`addSubFrame`(:ref:`TextureRegion`* TextureRegion, const unsigned int& NumFrame, const unsigned int& NumSubFrame); virtual void :ref:`draw`(); void :ref:`draw`(const :ref:`BlendMode`& Blend, const :ref:`RenderMode`& Effect); virtual void :target:`draw`(const :ref:`Vector2f`& position); virtual void :target:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size); virtual bool :target:`isStateful`(); void :ref:`setRepetitions`(const int& Repeations); void :ref:`setAutoAnimate`(const bool& Autoanim); bool :ref:`getAutoAnimate`() const; :ref:`Quad2f` :ref:`getQuad`(); :ref:`Vector2i` :ref:`getOffset`(); void :ref:`setOffset`(const :ref:`Vector2i`& offset); void :ref:`setReverseAnimation`(const bool& Reverse); bool :ref:`getReverseAnimation`() const; unsigned int :ref:`getEndFrame`(); :ref:`Uint32` :ref:`getNumFrames`(); void :ref:`setReverseFromStart`(); :ref:`TextureRegion`* :ref:`getCurrentTextureRegion`(); :ref:`TextureRegion`* :ref:`getTextureRegion`(const unsigned int& frame); :ref:`TextureRegion`* :ref:`getTextureRegion`(const unsigned int& frame, const unsigned int& SubFrame); void :ref:`goToAndPlay`(:ref:`Uint32` GoTo); void :ref:`goToAndStop`(:ref:`Uint32` GoTo); void :ref:`animToFrameAndStop`(:ref:`Uint32` GoTo); void :ref:`setEventsCallback`(const :ref:`SpriteCallback`& Cb, void* UserData = NULL); void :ref:`clearCallback`(); Sprite :ref:`clone`(); void :ref:`update`(const :ref:`Time`& ElapsedTime); void :ref:`update`(); void :ref:`fireEvent`(const :ref:`Uint32`& Event); }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // enums enum :ref:`Type`; // methods virtual :ref:`Sizef` :ref:`getSize`() = 0; virtual :ref:`Sizef` :ref:`getPixelsSize`() = 0; virtual void :ref:`draw`() = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position) = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size) = 0; virtual bool :ref:`isStateful`() = 0; void :ref:`setAlpha`(:ref:`Uint8` alpha); const :ref:`Uint8`& :ref:`getAlpha`(); void :ref:`setColor`(const :ref:`Color`& color); const :ref:`Color`& :ref:`getColor`() const; void :ref:`setColorFilter`(const :ref:`Color`& color); :ref:`RGB` :ref:`getColorFilter`(); void :ref:`clearColor`(); void :ref:`clearColorFilter`(); void :ref:`resetAlpha`(); :ref:`Type` :ref:`getDrawableType`() const; const :ref:`Vector2f`& :ref:`getPosition`() const; void :ref:`setPosition`(const :ref:`Vector2f`& position); virtual bool :ref:`isDrawableResource`() const; .. _details-class_e_e_1_1_graphics_1_1_sprite: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A :ref:`Sprite ` controller class, can hold and control sprites animations. Typedefs -------- .. index:: pair: typedef; SpriteCallback .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a5428ca071bb2756eb013aadaa989a8b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function`, Sprite*, void*)> SpriteCallback Event ID - :ref:`Sprite ` - User Data. Construction ------------ .. index:: pair: function; Sprite .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a7ea3e9fc183e4da51b1c943f738d1ef8: .. ref-code-block:: cpp :class: doxyrest-title-code-block Sprite() Instanciate an empty sprite .. index:: pair: function; Sprite .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a7b31c366c64de5b6253d78b4d5abe625: .. ref-code-block:: cpp :class: doxyrest-title-code-block Sprite(const std::string& name, const std::string& extension = "", :ref:`TextureAtlas`* SearchInTextureAtlas = NULL) Creates an animated :ref:`Sprite ` from a animation name. It will search for a pattern name. For example search for name "car" with extensions "png", i will try to find car00.png car01.png car02.png, and so on, it will continue if find something, otherwise it will stop ( it will always search at least for car00.png and car01.png ). .. note:: :ref:`Texture ` atlases saves the TextureRegions names without extension by default. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - name - First part of the sub texture name * - extension - Extension of the sub texture name ( if have one, otherwise is empty ) * - SearchInTextureAtlas - If you want only to search in a especific atlas ( NULL if you want to search in all atlases ) .. rubric:: See also: TextureAtlasManager::GetTextureRegionsByPattern .. index:: pair: function; Sprite .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a96cfcc5c87b54595ff2affe6e32edaa5: .. ref-code-block:: cpp :class: doxyrest-title-code-block Sprite(:ref:`TextureRegion`* TextureRegion) Creates a :ref:`Sprite ` from a :ref:`TextureRegion ` .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - :ref:`TextureRegion ` - The :ref:`TextureRegion ` to use .. index:: pair: function; Sprite .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a01d78299d23d7d241df6ab340a3c38c6: .. ref-code-block:: cpp :class: doxyrest-title-code-block Sprite(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Creates a :ref:`Sprite ` instance that holds a new :ref:`TextureRegion ` from a texture already loaded. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The texture Id used to create the :ref:`TextureRegion ` * - DestSize - The destination size of the :ref:`TextureRegion ` created * - offset - The offset added to the position of the frame ( the :ref:`TextureRegion `) * - TexSector - The sector of the texture used by the :ref:`TextureRegion ` to be rendered Methods ------- .. index:: pair: function; setRotation .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1adb79fbabe8eb63471f7d1bdaa01ac6b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRotation(const :ref:`Float`& rotation) Set the Angle for the rendered sprite .. index:: pair: function; getRotation .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a0a5996e19a2cee61cfe7f3fff55258a7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getRotation() const .. rubric:: Returns: The Angle for the rendered sprite .. index:: pair: function; rotate .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a21cd280729e1390775cde34843796110: .. ref-code-block:: cpp :class: doxyrest-title-code-block void rotate(const :ref:`Float`& angle) Rotates the sprite. Adds the new angle to the current rotation. Same as: .. ref-code-block:: cpp sprite.Angle( sprite.Angle() + angle ); .. index:: pair: function; setScale .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ae95e9abeed99a74be39a89299eccb457: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setScale(const :ref:`Float`& scale) Set the Scale for the rendered sprite .. index:: pair: function; setScale .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a43baed97d6463a8dd598bf2164f7bf84: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setScale(const :ref:`Vector2f`& scale) Set the Scale for the rendered sprite .. index:: pair: function; getScale .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a06b62ebc25da7ec93dfbef3ee69720bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Vector2f`& getScale() const .. rubric:: Returns: The Scale for the rendered sprite .. index:: pair: function; setOrigin .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a86cb809bbcff6682491a36c8b0837fea: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setOrigin(const :ref:`OriginPoint`& origin) Set the local origin of the sprite The origin of an object defines the center point for all transformations (scale, rotation). The coordinates of this point must be relative to the top-left corner of the sprite. The default origin point is the center of the sprite. .. index:: pair: function; getOrigin .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a32884eff9ef6a508ad963424daf665a8: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`OriginPoint`& getOrigin() const .. rubric:: Returns: The local origin of the sprite .. index:: pair: function; setSize .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a19cded9332ec1e7eb270ce76740dd2c4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSize(const :ref:`Sizef`& size, const unsigned int& FrameNum, const unsigned int& SubFrame) Set the :ref:`Frame ` Number :ref:`Sprite ` Size .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - size - The new size * - FrameNum - If the :ref:`Frame ` Number is 0 it will use the Current :ref:`Frame ` Number * - SubFrame - If the Sub :ref:`Frame ` Number is 0 it will use the Current Sub :ref:`Frame ` Number .. index:: pair: function; setSize .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a83e894906ae27331ab3e5b356d61a38e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSize(const :ref:`Sizef`& size) Set the current :ref:`TextureRegion ` Size ( destination size ) .. index:: pair: function; setSize .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ac66ee0be9c51e14e685b1287526825ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Sizef` setSize(const unsigned int& FrameNum, const unsigned int& SubFrame) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - FrameNum - If the :ref:`Frame ` Number is 0 it will use the Current :ref:`Frame ` Number * - SubFrame - If the Sub :ref:`Frame ` Number is 0 it will use the Current Sub :ref:`Frame ` Number .. rubric:: Returns: the :ref:`Frame ` Number :ref:`Sprite ` Size .. index:: pair: function; getSize .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a6f5501e683cb54c2e78217c87ac5a43d: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual :ref:`Sizef` getSize() .. rubric:: Returns: The current :ref:`Frame ` Size .. index:: pair: function; setAnimationSpeed .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a57e4a4e2053b63e63bbfab3af1e6465b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAnimationSpeed(const :ref:`Float`& animSpeed) Set the sprite animation speed ( AnimSpeed equals to Animation Frames per Second ) .. index:: pair: function; getAnimationSpeed .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a905e7f2c8dd9859713bb5c669885cce1: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getAnimationSpeed() const .. rubric:: Returns: The sprite animation speed ( AnimSpeed equals to Animation Frames per Second ) .. index:: pair: function; isAnimationPaused .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aa7c38a94c59b90d33edc1bcd7a815dde: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isAnimationPaused() const .. rubric:: Returns: If the animation is paused .. index:: pair: function; setAnimationPaused .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a76a688f5f561bb52431ea3d630f0d3d5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAnimationPaused(const bool& Pause) Set the animation paused or not .. index:: pair: function; setCurrentFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aacde1e56edfec48e0cdff920b554c811: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setCurrentFrame(unsigned int CurFrame) Set the Current :ref:`Frame ` .. index:: pair: function; getCurrentFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1af58d55e5596771ff5faba2834623d29d: .. ref-code-block:: cpp :class: doxyrest-title-code-block const unsigned int& getCurrentFrame() const .. rubric:: Returns: The Current :ref:`Frame ` .. index:: pair: function; getExactCurrentFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ac0367affe30ed5864579291a550d7c7c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Float`& getExactCurrentFrame() const .. rubric:: Returns: The Exact Current FrameData The Float fpoint of the current frame, the exact position of the interpolation. .. index:: pair: function; setExactCurrentFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1afbf4afc56dd26a1064e9666d6d16acaa: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setExactCurrentFrame(const :ref:`Float`& currentFrame) Set the exact current FrameData .. index:: pair: function; setCurrentSubFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a6c1ed935bb2f24fc26a92d58ee0291bf: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setCurrentSubFrame(const unsigned int& CurSubFrame) Set the Current Sub :ref:`Frame ` .. index:: pair: function; getCurrentSubFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ae07fc984d421ff99180ed798dba0304b: .. ref-code-block:: cpp :class: doxyrest-title-code-block const unsigned int& getCurrentSubFrame() const .. rubric:: Returns: The Current Sub :ref:`Frame ` .. index:: pair: function; setRenderMode .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ab0ab2dcbf6f5d7d0d41790b08dde170e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRenderMode(const :ref:`RenderMode`& Effect) Set the Render Type .. index:: pair: function; getRenderMode .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a230770c9af673d087cb0b7fa928d0080: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`RenderMode`& getRenderMode() const .. rubric:: Returns: The Render Type .. index:: pair: function; setBlendMode .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a8d501d38f1e7f739613209bbc031dc87: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setBlendMode(const :ref:`BlendMode`& Blend) Set the Blend Mode .. index:: pair: function; getBlendMode .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a957a2f476b9d07619bde212b9e60b001: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`BlendMode`& getBlendMode() const .. rubric:: Returns: The Blend Mode .. index:: pair: function; reset .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a3696552e8b56fbfc965c0bd05ee90cc6: .. ref-code-block:: cpp :class: doxyrest-title-code-block void reset() Reset the sprite as a new one. .. index:: pair: function; getAABB .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ad065b196e93dd6a37db53622e8e33425: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Rectf` getAABB() .. rubric:: Returns: The AABB (axis-aligned bounding box) .. index:: pair: function; updateVertexColors .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ae97e4d683b10467acb91a9c72d750a8b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void updateVertexColors(const :ref:`Color`& Color0, const :ref:`Color`& Color1, const :ref:`Color`& Color2, const :ref:`Color`& Color3) Update the colors of every vertex rendered of the sprite ( this will override the default color ) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Color0 - The Left - Top vertex color * - Color1 - The Left - Bottom vertex color * - Color2 - The Right - Bottom vertex color * - Color3 - The Right - Top vertex color .. index:: pair: function; disableVertexColors .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a994765ecc0bea37088f42dd7a4951421: .. ref-code-block:: cpp :class: doxyrest-title-code-block void disableVertexColors() This will disable the vertex colors .. index:: pair: function; createStatic .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a3c4731ed03489f17945e75f0f236a99b: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool createStatic(:ref:`TextureRegion`* TextureRegion) Creates an static sprite (no animation) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - :ref:`TextureRegion ` - The sprite :ref:`TextureRegion ` .. rubric:: Returns: True if success .. index:: pair: function; createStatic .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a79036c0b040fd09b4be88a8e22f7d73f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool createStatic(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Creates an static sprite (no animation). It creates a new :ref:`TextureRegion `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The internal :ref:`Texture ` Id * - DestSize - The destination size of the :ref:`TextureRegion ` created * - offset - The offset added to the position of the frame ( the :ref:`TextureRegion `) * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: True if success .. index:: pair: function; createStatic .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a5f0d808341642644000778a543a620f1: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool createStatic(:ref:`Texture`* tex, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Creates an static sprite (no animation). It creates a new :ref:`TextureRegion `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - DestSize - The destination size of the :ref:`TextureRegion ` created * - offset - The offset added to the position of the frame ( the :ref:`TextureRegion `) * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: True if success .. index:: pair: function; createAnimation .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a8fb36ef6b61e3ad3c7152d8ab847730b: .. ref-code-block:: cpp :class: doxyrest-title-code-block void createAnimation(const unsigned int& SubFramesNum = 1) Creates an animated sprite .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - SubFramesNum - The number of subframes of the sprite .. index:: pair: function; addFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a53fe46d93fecb98f74d5d7936e5ca6ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int addFrame(const :ref:`Uint32`& TexId, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Add a frame to the sprite (on the current sub frame) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The internal :ref:`Texture ` Id * - DestSize - The destination size of the frame * - offset - The offset added to the position of the frame * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: The frame position or 0 if fails .. index:: pair: function; addFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a2b00b644131541876fac9d059ee503a9: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int addFrame(:ref:`Texture`* tex, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Add a frame to the sprite (on the current sub frame) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - DestSize - The destination size of the frame * - offset - The offset added to the position of the frame * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: The frame position or 0 if fails .. index:: pair: function; addFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a6a2919d042b806334ea52106f7c58d45: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int addFrame(:ref:`TextureRegion`* TextureRegion) Add a frame to the sprite (on the current sub frame) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - :ref:`TextureRegion ` - The :ref:`TextureRegion ` used in the frame .. rubric:: Returns: The frame position or 0 if fails .. index:: pair: function; addFrames .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a939f6f7787be644c9a6ca233e1346989: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addFrames(const std::vector<:ref:`TextureRegion`*> TextureRegions) Add a vector of :ref:`TextureRegion ` as an animation. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TextureRegions - The Frames .. index:: pair: function; addFramesByPattern .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ac4bd0e3cdb8a018fa73607f0067093aa: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addFramesByPattern(const std::string& name, const std::string& extension = "", :ref:`TextureAtlas`* SearchInTextureAtlas = NULL) .. rubric:: See also: TextureAtlasManager::GetTextureRegionsByPattern .. index:: pair: function; addSubFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aebb42f2f5df17b3e96376ff66757b987: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addSubFrame(:ref:`Texture`* tex, const unsigned int& NumFrame, const unsigned int& NumSubFrame, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Add a frame on an specific subframe to the sprite .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - NumFrame - The :ref:`Frame ` Number * - NumSubFrame - The Sub :ref:`Frame ` Number * - DestSize - The destination size of the frame * - offset - The offset added to the x position of the frame * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: True if success .. index:: pair: function; addSubFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a40325c8a7e77532e14ab702c668c91e6: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addSubFrame(const :ref:`Uint32`& TexId, const unsigned int& NumFrame, const unsigned int& NumSubFrame, const :ref:`Sizef`& DestSize = :ref:`Sizef`(0, 0), const :ref:`Vector2i`& offset = :ref:`Vector2i`(0, 0), const :ref:`Rect`& TexSector = :ref:`Rect`(0, 0, 0, 0)) Add a frame on an specific subframe to the sprite .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The internal :ref:`Texture ` Id * - NumFrame - The :ref:`Frame ` Number * - NumSubFrame - The Sub :ref:`Frame ` Number * - DestSize - The destination size of the frame * - offset - The offset added to the x position of the frame * - TexSector - The texture sector to be rendered ( default all the texture ) .. rubric:: Returns: True if success .. index:: pair: function; addSubFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1af95096fe2a228764cab13550d480002e: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool addSubFrame(:ref:`TextureRegion`* TextureRegion, const unsigned int& NumFrame, const unsigned int& NumSubFrame) Add a frame on an specific subframe to the sprite .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - :ref:`TextureRegion ` - The :ref:`TextureRegion ` used in the frame * - NumFrame - The :ref:`Frame ` Number * - NumSubFrame - The Sub :ref:`Frame ` Number .. rubric:: Returns: True if success .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a66df1b4bda7ebfdf1b9f1f299eafb9d9: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void draw() Draw the sprite to the screen .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aa3a63cac03d6ce06a4253899c11ed6fa: .. ref-code-block:: cpp :class: doxyrest-title-code-block void draw(const :ref:`BlendMode`& Blend, const :ref:`RenderMode`& Effect) Draw the sprite to the screen forcing the Blend Mode and the Render Type .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Blend - The Blend Mode * - Effect - The Render Type .. index:: pair: function; setRepetitions .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ab0979bbf2bb8a25903b0e539384fb4ab: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setRepetitions(const int& Repeations) Set the number of repetitions of the animation. Any number below 0 the animation will loop. .. index:: pair: function; setAutoAnimate .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a2e88f352272d40731581c4a4575c4461: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAutoAnimate(const bool& Autoanim) Set if the class auto-animate the sprite ( default it's active ) .. index:: pair: function; getAutoAnimate .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ac3e07a57f90e2bfe44702f844be5ca3c: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getAutoAnimate() const .. rubric:: Returns: If the class is auto-animated .. index:: pair: function; getQuad .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a2ae4862e0e41c10a2ef9a6802b610f8d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Quad2f` getQuad() .. rubric:: Returns: The four vertex position of the :ref:`Sprite ` .. index:: pair: function; getOffset .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a00764b5e7b4ba27dd3b25db7f76b0113: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Vector2i` getOffset() .. rubric:: Returns: The Offset of the current frame .. index:: pair: function; setOffset .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a13bfb288639ccb6300870ce7f2d8280e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setOffset(const :ref:`Vector2i`& offset) Set the Offset of the current frame .. index:: pair: function; setReverseAnimation .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a81cdfc811473e3930dee45c5b6fbbf61: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setReverseAnimation(const bool& Reverse) Reverse the animation from last frame to first frame. .. index:: pair: function; getReverseAnimation .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aae8cb006084fdc6d1a6861a3b4bc3f99: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getReverseAnimation() const .. rubric:: Returns: If the animation is reversed .. index:: pair: function; getEndFrame .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1abfa7215c23812c8ca6b89ba55cdb0571: .. ref-code-block:: cpp :class: doxyrest-title-code-block unsigned int getEndFrame() .. rubric:: Returns: The current last frame .. index:: pair: function; getNumFrames .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a0476edf4620307e029c010f650393ff4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getNumFrames() .. rubric:: Returns: The number of frames .. index:: pair: function; setReverseFromStart .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a04d350c84facb451135b0aeb2d20df5c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setReverseFromStart() Will set Reverse active and set the first frame as the last frame .. index:: pair: function; getCurrentTextureRegion .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a7e02d312e7cf5095a8583554a8ba36f9: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* getCurrentTextureRegion() .. rubric:: Returns: The Current :ref:`TextureRegion ` .. index:: pair: function; getTextureRegion .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a0be7627f441a67de00419e29e086e15c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* getTextureRegion(const unsigned int& frame) .. rubric:: Returns: The :ref:`TextureRegion ` :ref:`Frame ` from the current sub frame .. index:: pair: function; getTextureRegion .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a3fe38e0857b3582058ef475f7e5a0662: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* getTextureRegion(const unsigned int& frame, const unsigned int& SubFrame) .. rubric:: Returns: The :ref:`TextureRegion ` :ref:`Frame ` from the SubFrame .. index:: pair: function; goToAndPlay .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1ae9d3641aa4d6a364db6afcba3f74c42e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void goToAndPlay(:ref:`Uint32` GoTo) Start playing from .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - GoTo - :ref:`Frame ` that goes from 1 to Number of Frames .. index:: pair: function; goToAndStop .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a0820d434c1e3c014c30ab30e2f063a93: .. ref-code-block:: cpp :class: doxyrest-title-code-block void goToAndStop(:ref:`Uint32` GoTo) Go to a frame and stop .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - GoTo - :ref:`Frame ` that goes from 1 to Number of Frames .. index:: pair: function; animToFrameAndStop .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a918c3d30a098f2c762e6c34a67cf66c1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void animToFrameAndStop(:ref:`Uint32` GoTo) Animate to frame and when reach the frame stops .. index:: pair: function; setEventsCallback .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1af979e9a244fa635bc2137611ab3e4db2: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setEventsCallback(const :ref:`SpriteCallback`& Cb, void* UserData = NULL) Set the sprite events callback .. index:: pair: function; clearCallback .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1acff079e5989d2e6e9e110c365eb0595c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clearCallback() Removes the current callback .. index:: pair: function; clone .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a2956fbf7c9e9e1d744aadc201403c027: .. ref-code-block:: cpp :class: doxyrest-title-code-block Sprite clone() Creates a copy of the current sprite and returns it .. index:: pair: function; update .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aea1806a73034d7133f7a51df7f2b1db1: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update(const :ref:`Time`& ElapsedTime) Update the sprite animation .. index:: pair: function; update .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1a33898f61c9584400eb977f3341854fcc: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update() Update the sprite animation using the current elapsed time provided by Engine .. index:: pair: function; fireEvent .. _doxid-class_e_e_1_1_graphics_1_1_sprite_1aad488f74c12778c1ed92e99a2262c3e3: .. ref-code-block:: cpp :class: doxyrest-title-code-block void fireEvent(const :ref:`Uint32`& Event) Fire a User Event in the sprite