anim::Animation
Last updated
Last updated
class should be used to create an animation in sfml.
#include <Animation.hpp>
void
void
void
const sf::RectangleShape &
void
void
const std::size_t &
void
const sf::Vector2f &
void
const sf::Vector2f &
const sf::FloatRect
void
const sf::Color &
Note: It contains a vector of texture that will be updated, depending on a duration time, with the function update. You should define a duration between each frame. You should define a position for the animation. You should define a size for the animation. You should add a texture for the animation.
Warning: A texture is always add at the end of the vector of texture.
It updates the texture used depending on the duration time and the previous index in the vector of texture.
It adds a texture on the vector of texture used for the animation.
Parameters:
texturePath The path to load the texture from.
position The position from which the texture of the loaded image is to be obtained.
size The size to get the texture from in the image loaded.
Exceptions:
AnimationException will be thrown if the image cannot be loaded.
Warning: Be carful, the texture is added at the end of the vector. Please add texture in the correct order.
It adds a texture on the vector of texture used for the animation.
Parameters:
image The image used to create the texture from.
position The position from which the texture of the loaded image is to be obtained.
size The size to get the texture from in the image loaded.
Exceptions:
AnimationException will be thrown if the texture cannot be created.
Warning: Be carful, the texture is added at the end of the vector. Please add texture in the correct order.
It returns the shape of the animation with the correct texture.
Return: const sf::RectangleShape reference of the shape.
Note: Use this function to get the shape to be drawn.
Warning: Keep in mind that you need to update the texture with the update
function.
It move the shape of the animation with the vector2f move.
Note: Use this function to move the shape.
Warning: Keep in mind that you need to draw the shape again.
It sets the duration between each frame of the animation.
Parameters:
duration The duration between each frame of the animation as millisecond.
Note: The animation must be set as millisecond.
It gets the duration between each frame of the animation.
Return: const std::size_t reference of the duration.
It sets the position of the shape used for the animation.
Parameters:
position The position to be set on the shape.
It gets the position of the shape used for the animation.
Return: const sf::Vector2f reference of the position.
It sets the size of the shape used for the animation.
Parameters:
size The size to be set on the shape.
It gets the size of the shape used for the animation.
Return: const sf::Vector2f reference of the size.
It gets the size of the shape used for the animation.
Return: const sf::Vector2f reference of the size.
It sets the color of the shape used for the animation.
Parameters:
color The color to be set on the shape.
It gets the color of the shape used for the animation.
Return: const sf::Color reference of the size.
Updated on 2022-11-13 at 17:21:37 +0100
() Create a new instance of .
() =default Destroy the instance of . It's set to default.
() It updates the texture used depending on the duration time and the previous index in the vector of texture.
(const std::string & texturePath, const sf::Vector2f & position, const sf::Vector2f & size) It adds a texture on the vector of texture used for the animation.
(const sf::Image & image, const sf::Vector2f & position, const sf::Vector2f & size) It adds a texture on the vector of texture used for the animation.
() const It returns the shape of the animation with the correct texture.
(const sf::Vector2f & move) It move the shape of the animation with the vector2f move.
(const std::size_t & duration) It sets the duration between each frame of the animation.
() const It gets the duration between each frame of the animation.
(const sf::Vector2f & position) It sets the position of the shape used for the animation.
() const It gets the position of the shape used for the animation.
(const sf::Vector2f & size) It sets the size of the shape used for the animation.
() const It gets the size of the shape used for the animation.
() It gets the size of the shape used for the animation.
(const sf::Color & color) It sets the color of the shape used for the animation.
() const It gets the color of the shape used for the animation.
class should be used to create an animation in sfml.
Create a new instance of .
Destroy the instance of . It's set to default.