RTYPE TECHNICAL DOCUMENTATION
  • Introduction
  • Classes
    • utils::InputMap
    • utils::Window
    • utils::constant::ButtonValue
    • network::Client
    • network::LockedQueue
    • network::Server
    • ecs::EnemyFactory
    • ecs::Engine
    • ecs::Entity
    • ecs::Event
    • ecs::Registry
    • ecs::SparseArray
    • ecs::World
    • ecs::WorldManager
    • ecs::component::Activable
    • ecs::component::Animated
    • ecs::component::Animated::AnimFrame
    • ecs::component::AttackAI
    • ecs::component::AttackAI::Action
    • ecs::component::AttackAI::AI
    • ecs::component::AttackAI::AI::Pattern
    • ecs::component::Controllable
    • ecs::component::Direction
    • ecs::component::Drawable
    • ecs::component::EntityType
    • ecs::component::Faction
    • ecs::component::FollowEntity
    • ecs::component::Health
    • ecs::component::Hitbox
    • ecs::component::MovementAI
    • ecs::component::MovementAI::AI
    • ecs::component::NetworkId
    • ecs::component::Parallax
    • ecs::component::Position
    • ecs::component::Projectile
    • ecs::component::Score
    • ecs::component::Shootable
    • ecs::component::Size
    • ecs::component::Text
    • ecs::component::textColor
    • ecs::component::Velocity
    • ecs::component::Weapon
    • audio::AudioManager
    • asset::AssetLoader
    • anim::Animation
  • Namespaces
    • utils
    • utils::constant
    • network
    • ecs
    • ecs::component
    • ecs::systems
    • audio
    • asset
    • anim
  • Modules
    • Input
  • Files
    • src
    • src/client
    • Animation.cpp
    • Animation.hpp
    • AssetLoader.cpp
    • AssetLoader.hpp
    • AudioManager.cpp
    • AudioManager.hpp
    • entrypoint.cpp
    • GetWorld.cpp
    • GetWorld.hpp
    • NetworkClient.cpp
    • NetworkClient.hpp
    • src/ecs
    • src/ecs/components
    • src/ecs/components/client
    • Activable.hpp
    • Animated.hpp
    • Controllable.hpp
    • Drawable.hpp
    • Hitbox.hpp
    • Parallax.hpp
    • Shootable.hpp
    • Text.hpp
    • src/ecs/components/server
    • AttackAI.cpp
    • AttackAI.hpp
    • FollowEntity.hpp
    • Projectile.hpp
    • Direction.hpp
    • EntityType.hpp
    • Faction.hpp
    • Health.hpp
    • MovementAI.cpp
    • MovementAI.hpp
    • NetworkId.hpp
    • Position.hpp
    • Score.hpp
    • Size.hpp
    • Velocity.hpp
    • Weapon.hpp
    • src/ecs/systems
    • src/ecs/systems/client
    • Animate.hpp
    • Draw.hpp
    • ExecuteOnce.hpp
    • HandleIncomingMessages.hpp
    • HandleParallaxBounds.hpp
    • HandleSFMLEvents.hpp
    • HandleSFMLKeys.hpp
    • HealthBar.hpp
    • MenuSelect.hpp
    • ScoreUpdate.hpp
    • SendDirection.hpp
    • src/ecs/systems/server
    • DeathUpdate.hpp
    • FollowEntitySystem.hpp
    • HandleIncomingMessage.hpp
    • PlayerHealthUpdate.hpp
    • PositionUpdate.hpp
    • ProjectileCollision.hpp
    • RunAttackAI.hpp
    • Waves.hpp
    • ManageClientEvents.hpp
    • Movement.hpp
    • PositionLogger.hpp
    • RunMovementAI.hpp
    • EnemyFactory.cpp
    • EnemyFactory.hpp
    • Engine.hpp
    • Entity.hpp
    • Event.hpp
    • LockedQueue.hpp
    • Registry.hpp
    • SparseArray.hpp
    • World.hpp
    • WorldManager.cpp
    • WorldManager.hpp
    • src/server
    • entrypoint.cpp
    • Server.cpp
    • Server.hpp
    • src/utils
    • Constant.hpp
    • InputMap.cpp
    • InputMap.hpp
    • Window.cpp
    • README.md
  • Pages
    • deprecated
  • GitHub
Powered by GitBook
On this page
  • Public Functions
  • Detailed Description
  • Public Functions Documentation
  • function Animation
  • function ~Animation
  • function update
  • function addTexture
  • function addTexture
  • function getShape
  • function moveShape
  • function setDuration
  • function getDuration
  • function setPosition
  • function getPosition
  • function setSize
  • function getSize
  • function getGlobalBounds
  • function setColor
  • function getColor
  1. Classes

anim::Animation

Previousasset::AssetLoaderNextNamespaces

Last updated 2 years ago

class should be used to create an animation in sfml.

#include <Animation.hpp>

Public Functions

Name

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 &

Detailed Description

class anim::Animation;

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.

Public Functions Documentation

function Animation

Animation()

function ~Animation

~Animation() =default

function update

void update()

It updates the texture used depending on the duration time and the previous index in the vector of texture.

function addTexture

void addTexture(
    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.

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.

function addTexture

void addTexture(
    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.

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.

function getShape

const sf::RectangleShape & getShape() const

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.

function moveShape

void moveShape(
    const sf::Vector2f & move
)

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.

function setDuration

void setDuration(
    const std::size_t & duration
)

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.

function getDuration

const std::size_t & getDuration() const

It gets the duration between each frame of the animation.

Return: const std::size_t reference of the duration.

function setPosition

void setPosition(
    const sf::Vector2f & position
)

It sets the position of the shape used for the animation.

Parameters:

  • position The position to be set on the shape.

function getPosition

const sf::Vector2f & getPosition() const

It gets the position of the shape used for the animation.

Return: const sf::Vector2f reference of the position.

function setSize

void setSize(
    const sf::Vector2f & size
)

It sets the size of the shape used for the animation.

Parameters:

  • size The size to be set on the shape.

function getSize

const sf::Vector2f & getSize() const

It gets the size of the shape used for the animation.

Return: const sf::Vector2f reference of the size.

function getGlobalBounds

const sf::FloatRect getGlobalBounds()

It gets the size of the shape used for the animation.

Return: const sf::Vector2f reference of the size.

function setColor

void setColor(
    const sf::Color & color
)

It sets the color of the shape used for the animation.

Parameters:

  • color The color to be set on the shape.

function getColor

const sf::Color & getColor() const

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.

Animation
Animation
Animation
Animation
More...
Animation
Animation
~Animation
Animation
update
addTexture
addTexture
getShape
moveShape
setDuration
getDuration
setPosition
getPosition
setSize
getSize
getGlobalBounds
setColor
getColor