.. index:: pair: class; EE::Graphics::ScrollParallax .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax: class EE::Graphics::ScrollParallax ================================== .. toctree:: :hidden: Overview ~~~~~~~~ The scroll parallax renders a :ref:`TextureRegion ` to the screen from a position and a size specified. If the size is bigger than the :ref:`TextureRegion `, the :ref:`TextureRegion ` is rendered as a repeated :ref:`TextureRegion ` until it covers all the size of the parallax, adding movement to more than one Scroll Parallax will generate the ilusion of depth. \* More info in wikipedia: `http://en.wikipedia.org/wiki/Parallax_scrolling `__. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ScrollParallax { public: // construction :target:`ScrollParallax`(); :ref:`ScrollParallax`(:ref:`TextureRegion`* textureRegion, const :ref:`Vector2f`& position = :ref:`Vector2f`(), const :ref:`Sizef`& size = :ref:`Sizef`(), const :ref:`Vector2f`& speed = :ref:`Vector2f`(), const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`()); :target:`~ScrollParallax`(); // methods bool :ref:`create`(:ref:`TextureRegion`* textureRegion, const :ref:`Vector2f`& position = :ref:`Vector2f`(), const :ref:`Sizef`& size = :ref:`Sizef`(), const :ref:`Vector2f`& speed = :ref:`Vector2f`(), const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`()); void :ref:`setColor`(const :ref:`Color`& Color); :ref:`Color` :ref:`getColor`() const; void :ref:`setBlendMode`(const :ref:`BlendMode`& Blend); const :ref:`BlendMode`& :ref:`getBlendMode`() const; void :ref:`draw`(); void :ref:`setSize`(const :ref:`Sizef`& size); const :ref:`Sizef`& :ref:`getSize`() const; void :ref:`setPosition`(const :ref:`Vector2f`& Pos); const :ref:`Vector2f`& :ref:`getPosition`() const; :ref:`TextureRegion`* :ref:`getTextureRegion`() const; void :ref:`setTextureRegion`(:ref:`TextureRegion`* textureRegion); void :ref:`setSpeed`(const :ref:`Vector2f`& speed); const :ref:`Vector2f`& :ref:`getSpeed`() const; }; .. _details-class_e_e_1_1_graphics_1_1_scroll_parallax: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ The scroll parallax renders a :ref:`TextureRegion ` to the screen from a position and a size specified. If the size is bigger than the :ref:`TextureRegion `, the :ref:`TextureRegion ` is rendered as a repeated :ref:`TextureRegion ` until it covers all the size of the parallax, adding movement to more than one Scroll Parallax will generate the ilusion of depth. \* More info in wikipedia: `http://en.wikipedia.org/wiki/Parallax_scrolling `__. Construction ------------ .. index:: pair: function; ScrollParallax .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1ae16d24b3e333b898cacd7074f10d6e6d: .. ref-code-block:: cpp :class: doxyrest-title-code-block ScrollParallax(:ref:`TextureRegion`* textureRegion, const :ref:`Vector2f`& position = :ref:`Vector2f`(), const :ref:`Sizef`& size = :ref:`Sizef`(), const :ref:`Vector2f`& speed = :ref:`Vector2f`(), const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`()) Constructor that create's the Scroll Parallax .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - textureRegion - The :ref:`TextureRegion ` to Draw * - position - The position of the parallax * - size - The size of the parallax * - speed - Speed of movement ( in Pixels Per Second ) * - color - The :ref:`Texture ` Color * - Blend - The Blend Mode ( default :ref:`BlendMode::Alpha() `) Methods ------- .. index:: pair: function; create .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a61a0eef48f8e3392ce00d0c4045520de: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool create(:ref:`TextureRegion`* textureRegion, const :ref:`Vector2f`& position = :ref:`Vector2f`(), const :ref:`Sizef`& size = :ref:`Sizef`(), const :ref:`Vector2f`& speed = :ref:`Vector2f`(), const :ref:`Color`& color = Color::White, const :ref:`BlendMode`& Blend = :ref:`BlendMode::Alpha`()) Create's the Scroll Parallax .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - textureRegion - The :ref:`TextureRegion ` to Draw * - position - The position of the parallax * - size - The size of the parallax * - speed - Speed of movement ( in Pixels Per Second ) * - color - The :ref:`Texture ` Color * - Blend - The Blend Mode ( default :ref:`BlendMode::Alpha() `) .. rubric:: Returns: True if success .. index:: pair: function; setColor .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a19ac9e5533b10372b307e3a2beb73203: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setColor(const :ref:`Color`& Color) Set the parallax texture color. .. index:: pair: function; getColor .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a09f61ca9c7b0faa2a7441d7ba915c15b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Color` getColor() const Get the parallax texture color. .. index:: pair: function; setBlendMode .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a617fd44f9d54b3bb93013340b4de43ee: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setBlendMode(const :ref:`BlendMode`& Blend) Set the Blend Mode used. .. index:: pair: function; getBlendMode .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a3660e6d4fa44fd9ceb413dad44c76d4e: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`BlendMode`& getBlendMode() const .. rubric:: Returns: The Blend Mode used for the parallax. .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a5e23bbc60d04f0599fdcbddedce97c04: .. ref-code-block:: cpp :class: doxyrest-title-code-block void draw() Draw the Scroll Parallax. .. index:: pair: function; setSize .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1ae3a5e2be65a1659ae4df70c6c2fb4f24: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSize(const :ref:`Sizef`& size) Change the size of the current parallax .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - size - The new size .. index:: pair: function; getSize .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a4a3ced22eccf118d5ae8b0258034e08c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Sizef`& getSize() const .. rubric:: Returns: Size .. index:: pair: function; setPosition .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1ad4f0ac634a43dc4925deba4a70a83e16: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setPosition(const :ref:`Vector2f`& Pos) Change the Parallax position .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Pos - The new parallax position .. index:: pair: function; getPosition .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a21164468a7a3eb70ec1a176587bb9245: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Vector2f`& getPosition() const .. rubric:: Returns: The parallax position .. index:: pair: function; getTextureRegion .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1aec7bceb780bd84712ea341569ed221fd: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`TextureRegion`* getTextureRegion() const .. rubric:: Returns: The :ref:`TextureRegion ` used for the parallax. .. index:: pair: function; setTextureRegion .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a10cfb7a9bb1c5736911e2d1baa271acc: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTextureRegion(:ref:`TextureRegion`* textureRegion) Set Change the :ref:`TextureRegion ` used for the parallax. .. index:: pair: function; setSpeed .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1acf5397bdb5f29e6aca4373ccc10aa2f4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setSpeed(const :ref:`Vector2f`& speed) Set the parallax speed movement. .. index:: pair: function; getSpeed .. _doxid-class_e_e_1_1_graphics_1_1_scroll_parallax_1a3d1e9ac724f6b8ae4e830c53c340618b: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Vector2f`& getSpeed() const .. rubric:: Returns: The parallax movement speed.