![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
Class that represent/handle an animation. More...
#include <C_animation.hpp>
Public Types | |
using | Index = uint16_t |
using | SharedDataType |
using | SharedType |
Public Member Functions | |
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. | |
Animation (char const name[], Index frame=0) | |
Animation (char const name[], char const group[], Index frame=0) | |
Animation (SharedDataType data, Index frame=0) | |
Animation (SharedDataType data, std::string_view group, Index frame=0) | |
Animation (SharedDataType data, char const group[], Index frame=0) | |
void | clear () override |
Clear the animation. | |
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 | setGroup (Index groupIndex) |
Set the group of the animation by its index. | |
anim::AnimationGroup const * | getGroup () const |
Get the actual group of the animation. | |
anim::AnimationGroup * | getGroup () |
anim::AnimationGroup const * | getGroup (std::string_view group) const |
Get the group of the animation by its name. | |
anim::AnimationGroup * | getGroup (std::string_view group) |
anim::AnimationGroup const * | getGroup (Index groupIndex) const |
Get the group of the animation by its index. | |
anim::AnimationGroup * | getGroup (Index groupIndex) |
bool | isGroupValid () const |
Check if the actual group is valid. | |
Index | nextFrame () |
Go to the next frame of the animation. | |
void | setFrame (Index frame) |
Set the frame of the animation. | |
Index | getFrameIndex () const |
Get the actual frame index of the animation. | |
Index | getGroupIndex () const |
Get the actual group index of the animation. | |
fge::anim::AnimationFrame const * | getFrame () const |
Get the actual frame of the animation. | |
fge::anim::AnimationFrame * | getFrame () |
fge::anim::AnimationFrame const * | getFrame (Index frameIndex) const |
Get the frame of the animation by its index. | |
fge::anim::AnimationFrame * | getFrame (Index frameIndex) |
bool | isFrameValid () const |
Check if the actual frame is valid. | |
void | setLoop (bool active) |
Set the loop mode of the animation. | |
bool | isLoop () const |
Check if the loop mode is active. | |
void | setReverse (bool active) |
Set the reverse mode of the animation. | |
bool | isReverse () const |
Check if the reverse mode is active. | |
void | setHorizontalFlip (bool active) |
Set the horizontal flip mode of the animation. | |
bool | isHorizontalFlipped () const |
Check if the horizontal flip mode is active. | |
std::shared_ptr< fge::TextureType > const & | retrieveTexture () const |
Retrieve the texture of the actual frame. | |
fge::RectInt | retrieveTextureRect () const |
Get the texture rectangle if the type of the animation is fge::anim::ANIM_TYPE_TILESET of the actual frame. | |
void | reload () |
Reload the cached resource from the same name. | |
bool | valid () const |
Check if the font is valid (not unloaded) | |
SharedDataType const & | getSharedBlock () const |
Get the resource block data. | |
SharedType const & | getSharedData () const |
Get the shared resource data. | |
std::string const & | getName () const |
Get the name of the resource. | |
manager::GlobalDataAccessorManagerInfo< anim::AnimationManager, &anim::gManager >::Manager::DataType * | retrieve () |
Retrieve the raw shared pointer from the current resource. | |
manager::GlobalDataAccessorManagerInfo< anim::AnimationManager, &anim::gManager >::Manager::DataType const * | retrieve () const |
Class that represent/handle an animation.
fge::Animation::Animation | ( | std::string_view | name, |
Index | frame = 0 ) |
Constructor that takes the name of the animation.
This function will get the animation data from the animation manager and load the first group index.
name | The name of the animation |
frame | The beginning frame of the animation |
fge::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.
This function will get the animation data from the animation manager and load the wanted group by its name.
name | The name of the animation |
group | The name of the group |
frame | The beginning frame of the animation |
|
overridevirtual |
Clear the animation.
Reimplemented from fge::manager::BaseDataAccessor< manager::GlobalDataAccessorManagerInfo< anim::AnimationManager, &anim::gManager >, manager::DataAccessorOptions::BLOCKPOINTER_ONLY >.
|
nodiscard |
Get the actual frame of the animation.
|
nodiscard |
Get the frame of the animation by its index.
|
nodiscard |
Get the actual frame index of the animation.
|
nodiscard |
Get the actual group of the animation.
|
nodiscard |
Get the group of the animation by its index.
groupIndex | The index of the group |
|
nodiscard |
Get the group of the animation by its name.
group | The name of the group |
|
nodiscard |
Get the actual group index of the animation.
|
nodiscardinherited |
Get the name of the resource.
|
nodiscardinherited |
Get the resource block data.
|
nodiscardinherited |
Get the shared resource data.
|
nodiscard |
Get the type of the loaded animation.
|
nodiscard |
Check if the actual frame is valid.
|
nodiscard |
Check if the actual group is valid.
|
nodiscard |
Check if the horizontal flip mode is active.
|
nodiscard |
Check if the loop mode is active.
|
nodiscard |
Check if the reverse mode is active.
Index fge::Animation::nextFrame | ( | ) |
Go to the next frame of the animation.
|
inherited |
Reload the cached resource from the same name.
|
nodiscardinherited |
Retrieve the raw shared pointer from the current resource.
|
nodiscard |
Retrieve the texture of the actual frame.
|
nodiscard |
Get the texture rectangle if the type of the animation is fge::anim::ANIM_TYPE_TILESET of the actual frame.
void fge::Animation::setFrame | ( | Index | frame | ) |
Set the frame of the animation.
frame | The new frame index |
bool fge::Animation::setGroup | ( | Index | groupIndex | ) |
Set the group of the animation by its index.
groupIndex | The index of the group |
bool fge::Animation::setGroup | ( | std::string_view | group | ) |
Set the group of the animation by its name.
group | The name of the group |
void fge::Animation::setHorizontalFlip | ( | bool | active | ) |
Set the horizontal flip mode of the animation.
active | true to enable flip, false otherwise |
void fge::Animation::setLoop | ( | bool | active | ) |
Set the loop mode of the animation.
active | true to enable the loop mode, false otherwise |
void fge::Animation::setReverse | ( | bool | active | ) |
Set the reverse mode of the animation.
active | true to enable the reverse mode, false otherwise |
|
nodiscardinherited |
Check if the font is valid (not unloaded)