|
MochiEngine
|
This class contains all the necessary data to show textures on screen. More...
#include <SpriteBase.h>
Public Member Functions | |
| SpriteBase (AbstractTextureFactory *factory, const std::string &path) | |
| Constructor that internally calls LoadTexture(AbstractTextureFactory *textureFactory, const std::string &filename). | |
| SpriteBase () | |
| This constructor only initializes a minimal part of the sprite. LoadTexture(AbstractTextureFactory *textureFactory, const std::string &filename) needs to be called for the sprite to be valid. | |
| void | LoadTexture (AbstractTextureFactory *textureFactory, const std::string &path) |
| Loads the texture and caches its size for future rendering. | |
| virtual std::vector< RenderCommand > | GetRenderData () const |
| Gets the list of render commands that represent this sprite in a format compatible with the renderer. | |
| virtual void | Update (const float &dt) |
| Overridable api to work with animated sprites. | |
| void | SetZIndex (const uint16_t &zIndex) |
| uint16_t | GetZIndex () const |
| bool | IsVisible () const |
| void | SetVisible (const bool &visible) |
| uint8_t | GetAlpha () const |
| void | SetAlpha (const uint8_t &alpha) |
| std::shared_ptr< Transform > | GetTransform () const |
| void | SetTransform (std::shared_ptr< Transform > tr) |
| void | SetSrcRect (const Rectf &src) |
Protected Attributes | |
| std::shared_ptr< ITexture > | mTexture |
| Rectf | mSrcRect |
| uint16_t | mZindex |
| bool | mVisible |
| uint8_t | mAlpha |
| Vector2f | mSize |
| std::shared_ptr< Transform > | mTransform |
This class contains all the necessary data to show textures on screen.
Ownership:
Guarantees:
Not responsible:
| Mochi::Graphics::SpriteBase::SpriteBase | ( | AbstractTextureFactory * | factory, |
| const std::string & | path ) |
Constructor that internally calls LoadTexture(AbstractTextureFactory *textureFactory, const std::string &filename).
| factory | The texture factory from which to get the texture. |
| path | The path or unique identifier of the file in the file system. |
|
virtual |
Gets the list of render commands that represent this sprite in a format compatible with the renderer.
| void Mochi::Graphics::SpriteBase::LoadTexture | ( | AbstractTextureFactory * | textureFactory, |
| const std::string & | path ) |
Loads the texture and caches its size for future rendering.
| textureFactory | The texture factory from which to get the texture. |
| path | The path or unique identifier of the file in the file system. |
|
virtual |
Overridable api to work with animated sprites.
| dt | The delta time |
Reimplemented in Mochi::Graphics::AnimatedSprite, and Mochi::Graphics::OneshotAnimation.