17#ifndef _FGE_C_ANIMATION_HPP_INCLUDED
18#define _FGE_C_ANIMATION_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_rect.hpp"
22#include "FastEngine/manager/C_baseManager.hpp"
23#include "FastEngine/manager/anim_manager.hpp"
34 manager::GlobalDataAccessorManagerInfo<anim::AnimationManager, &anim::gManager>,
35 manager::DataAccessorOptions::BLOCKPOINTER_ONLY>
38 using BaseDataAccessor::operator=;
39 using Index = uint16_t;
62 Animation(std::string_view name, std::string_view group, Index frame = 0);
63 Animation(
char const name[], Index frame = 0);
64 Animation(
char const name[],
char const group[], Index frame = 0);
65 Animation(SharedDataType data, Index frame = 0);
66 Animation(SharedDataType data, std::string_view group, Index frame = 0);
67 Animation(SharedDataType data,
char const group[], Index frame = 0);
229 Index g_groupIndex{0};
230 Index g_frameIndex{0};
233 bool g_reverse{
false};
234 bool g_flipHorizontal{
false};
241FGE_API
void from_json(nlohmann::json
const& j,
fge::Animation& p);
Class that represent/handle an animation.
Definition C_animation.hpp:36
Index getGroupIndex() const
Get the actual group index of the animation.
Animation(std::string_view name, Index frame=0)
Constructor that takes the name of the animation.
Animation(std::string_view name, std::string_view group, Index frame=0)
Constructor that takes the name of the animation and the group name.
void setLoop(bool active)
Set the loop mode of the animation.
anim::AnimationGroup const * getGroup(std::string_view group) const
Get the group of the animation by its name.
bool isHorizontalFlipped() const
Check if the horizontal flip mode is active.
bool isGroupValid() const
Check if the actual group is valid.
bool isReverse() const
Check if the reverse mode is active.
anim::AnimationType getType() const
Get the type of the loaded animation.
bool setGroup(std::string_view group)
Set the group of the animation by its name.
bool isFrameValid() const
Check if the actual frame is valid.
void setHorizontalFlip(bool active)
Set the horizontal flip mode of the animation.
fge::anim::AnimationFrame const * getFrame() const
Get the actual frame of the animation.
void setReverse(bool active)
Set the reverse mode of the animation.
anim::AnimationGroup const * getGroup(Index groupIndex) const
Get the group of the animation by its index.
bool setGroup(Index groupIndex)
Set the group of the animation by its index.
anim::AnimationGroup const * getGroup() const
Get the actual group of the animation.
Index getFrameIndex() const
Get the actual frame index of the animation.
bool isLoop() const
Check if the loop mode is active.
fge::anim::AnimationFrame const * getFrame(Index frameIndex) const
Get the frame of the animation by its index.
std::shared_ptr< fge::TextureType > const & retrieveTexture() const
Retrieve the texture of the actual frame.
void setFrame(Index frame)
Set the frame of the animation.
Index nextFrame()
Go to the next frame of the animation.
fge::RectInt retrieveTextureRect() const
Get the texture rectangle if the type of the animation is fge::anim::ANIM_TYPE_TILESET of the actual ...
void clear() override
Clear the animation.
Definition C_baseManager.hpp:182
Definition C_packet.hpp:70
AnimationType
Enum that represent different way of loading an animation.
Definition anim_manager.hpp:40
Structure that contains the information of a frame of an animation.
Definition anim_manager.hpp:51
Structure that contains the information of a group of frames of an animation.
Definition anim_manager.hpp:65