.. index:: pair: class; EE::Graphics::TextureAtlas .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas: class EE::Graphics::TextureAtlas ================================ .. toctree:: :hidden: Overview ~~~~~~~~ The texture atlas class represents a large image containing a collection of sub-images, or "atlas" which contains many smaller sub-images. The texture atlas in eepp can represent more than one texture or image, but the common use should be a image with sub-images. More information about :ref:`Texture ` Atlases: `http://en.wikipedia.org/wiki/Texture_atlas `__. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class TextureAtlas: public :ref:`EE::System::ResourceManager` { public: // construction :ref:`TextureAtlas`(const std::string& name = ""); :target:`~TextureAtlas`(); // methods static TextureAtlas* :target:`New`(const std::string& name = ""); :ref:`TextureRegion`* :ref:`add`(:ref:`TextureRegion`* textureRegion); :ref:`TextureRegion`* :ref:`add`(const :ref:`Uint32`& TexId, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const :ref:`Vector2i`& Offset, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(:ref:`Texture`* tex, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const std::string& Name = ""); :ref:`TextureRegion`* :ref:`add`(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const :ref:`Vector2i`& Offset, const std::string& Name = ""); const std::string& :ref:`getName`() const; void :ref:`setName`(const std::string& name); const std::string& :ref:`getPath`() const; void :ref:`setPath`(const std::string& path); const :ref:`String::HashType`& :ref:`getId`() const; :ref:`Uint32` :ref:`getCount`(); :ref:`Texture`* :ref:`getTexture`(const :ref:`Uint32`& texnum = 0) const; :ref:`Uint32` :ref:`getTexturesCount`(); }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // methods virtual T* :ref:`add`(T* resource); bool :ref:`remove`(T* resource, bool remove = true); bool :ref:`removeById`(const :ref:`String::HashType`& id, bool remove = true); bool :ref:`removeByName`(const std::string& name, bool remove = true); T* :ref:`getByName`(const std::string& name); T* :ref:`getById`(const :ref:`String::HashType`& id); :ref:`Uint32` :ref:`getCount`(); :ref:`Uint32` :ref:`getCount`(const std::string& name); :ref:`Uint32` :ref:`getCount`(const :ref:`String::HashType`& id); bool :ref:`exists`(const std::string& name); bool :ref:`existsId`(const :ref:`String::HashType`& id); void :ref:`destroy`(); void :ref:`printNames`(); :ref:`UnorderedMap`<:ref:`String::HashType`, T*>& :ref:`getResources`(); const bool& :ref:`isDestroying`() const; template void :ref:`each`(Predicate pred) const; template void :ref:`each`(Predicate pred); template T* :ref:`findIf`(Predicate pred) const; template T* :ref:`findIf`(Predicate pred); .. _details-class_e_e_1_1_graphics_1_1_texture_atlas: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ The texture atlas class represents a large image containing a collection of sub-images, or "atlas" which contains many smaller sub-images. The texture atlas in eepp can represent more than one texture or image, but the common use should be a image with sub-images. More information about :ref:`Texture ` Atlases: `http://en.wikipedia.org/wiki/Texture_atlas `__. Construction ------------ .. index:: pair: function; TextureAtlas .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a88fe46436ea38d8bb3125a3b1620eb63: .. ref-code-block:: cpp :class: doxyrest-title-code-block TextureAtlas(const std::string& name = "") Creates a new texture atlas with the given name. Methods ------- .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a32919b0994b06520d688c226818440b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(:ref:`TextureRegion`* textureRegion) Adds a :ref:`TextureRegion ` to the :ref:`Texture ` Atlas .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1aaeea73cea385a985de20a7061508b972: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(const :ref:`Uint32`& TexId, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` from a :ref:`Texture `. It will use the full :ref:`Texture ` as a :ref:`TextureRegion `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The texture id * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a4de35ad5fe3fc87ae759c461939ace74: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The texture id * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a62577b482edec0a7ed294c0aa0ec1b98: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The texture id * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - DestSize - The destination size that the :ref:`TextureRegion ` will have when rendered. * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a9a616715b12aebb17d5b87aaa96a4a1e: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(const :ref:`Uint32`& TexId, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const :ref:`Vector2i`& Offset, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - TexId - The texture id * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - DestSize - The destination size that the :ref:`TextureRegion ` will have when rendered. * - Offset - The offset that will be added to the position passed when any Draw call is used. * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a7851783ccfd9d00bc7e29e35250df30f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(:ref:`Texture`* tex, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` from a :ref:`Texture `. It will use the full :ref:`Texture ` as a :ref:`TextureRegion `. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a4f577bcc9f4c7dd1fca6dd0abbbddc0d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a656c56e3916fdfaae148ad68d3404d44: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - DestSize - The destination size that the :ref:`TextureRegion ` will have when rendered. * - Name - The texture name ( if any ) .. index:: pair: function; add .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a7d5e4b8dab44a5d2eec26b26407af0cb: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* add(:ref:`Texture`* tex, const :ref:`Rect`& SrcRect, const :ref:`Sizef`& DestSize, const :ref:`Vector2i`& Offset, const std::string& Name = "") Creates and add to the texture atlas a :ref:`TextureRegion ` of the indicated part of the texture. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - tex - The texture * - SrcRect - The texture part that will be used as the :ref:`TextureRegion `. * - DestSize - The destination size that the :ref:`TextureRegion ` will have when rendered. * - Offset - The offset that will be added to the position passed when any Draw call is used. * - Name - The texture name ( if any ) .. index:: pair: function; getName .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1af9862c84b8801b656ced6066a4c56fd4: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getName() const .. rubric:: Returns: The texture atlas name. .. index:: pair: function; setName .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1ae2adb5431d6e4e04e7f359fcb2749963: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setName(const std::string& name) Sets the texture atlas name. .. index:: pair: function; getPath .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a4af35bf350bdd6362a74674c23a7f7fc: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getPath() const .. rubric:: Returns: The texture atlas path. .. index:: pair: function; setPath .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a315310768456573932b2d1f0bae3b8fe: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPath(const std::string& path) Sets the texture atlas path. .. index:: pair: function; getId .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a3200a28a56f2e48df9a9b8a4e5a92b97: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`String::HashType`& getId() const .. rubric:: Returns: The texture atlas Id. The Id is the :ref:`String::hash ` of the texture atlas name. .. index:: pair: function; getCount .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1aacc63f21f3d1c212083bb410989f1e71: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getCount() .. rubric:: Returns: The number of TextureRegions inside the texture atlas. .. index:: pair: function; getTexture .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a123b5fdb551752331d12c8cb7e88a54d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Texture`* getTexture(const :ref:`Uint32`& texnum = 0) const .. note:: Some texture atlases could not have any texture, since you can use it as a container of TextureRegions from any texture. The texture atlases loaded from a file always will be linked to a texture. The Global :ref:`Texture ` Atlas for example doesn't have any texture linked to it. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - texnum - The texture index. A texture atlas can use more than one texture, so it can be 0 to :ref:`getTexturesCount() `. Usually a texture atlas corresponds to only one texture, so the texture index is 0. .. rubric:: Returns: The texture that corresponds to the texture atlas. .. index:: pair: function; getTexturesCount .. _doxid-class_e_e_1_1_graphics_1_1_texture_atlas_1a4c6a4ef7bba53a49ec4957246a64031a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getTexturesCount() .. rubric:: Returns: The number of textures linked to the texture atlas.