11#include <initializer_list>
12#include <unordered_map>
13#include "../ECS/Components/AnimationSet.hpp"
26 bool loop =
true,
const std::string &nextClip =
"") {
27 return ecs::AnimationClip(std::vector<ecs::Rectangle>(frames), duration, loop, nextClip);
39 animSet.
addClip(
"player_idle",
makeClip({{1, 69, 33, 14}}, 0.15f,
true));
45 {{1, 69, 33, 14}, {34, 69, 33, 14}, {67, 69, 33, 14}, {100, 69, 33, 14}, {133, 69, 33, 14}},
117 makeClip({{0, 0, 33, 34}, {33, 0, 33, 34}, {66, 0, 33, 34}}, 0.15f,
true));
121 makeClip({{100, 0, 33, 34}, {133, 0, 33, 34}, {166, 0, 33, 34}}, 0.15f,
true));
125 makeClip({{0, 34, 33, 34}, {33, 34, 33, 34}, {66, 34, 33, 34}}, 0.1f,
true));
129 makeClip({{100, 34, 33, 34}, {133, 34, 33, 34}, {166, 34, 33, 34}}, 0.1f,
true));
146 animSet.
addClip(
"hurt",
makeClip({{128, 0, 128, 128}, {256, 0, 128, 128}}, 0.08f,
false,
"idle"));
149 animSet.
addClip(
"attack",
makeClip({{0, 128, 128, 128}, {128, 128, 128, 128}, {256, 128, 128, 128}},
150 0.12f,
false,
"idle"));
168 makeClip({{0, 0, 64, 64}, {64, 0, 64, 64}, {128, 0, 64, 64}}, 0.15f,
false,
"idle"));
181 animSet.
addClip(
"projectile_fly",
182 makeClip({{267, 84, 17, 13}, {284, 84, 17, 13}, {301, 84, 17, 13}}, 0.2F,
true));
202 animSet.
addClip(
"fly",
makeClip({{0, 48, 8, 8}, {8, 48, 8, 8}}, 0.1f,
true));
217 inline const std::unordered_map<std::string, AnimationFactory>
FACTORIES = {
Component containing all available animations for an entity.
void addClip(const std::string &clipName, const AnimationClip &clip)
Add an animation clip.
const std::unordered_map< std::string, AnimationFactory > FACTORIES
Map of entity types to their animation factory functions.
ecs::AnimationSet createPlayerAnimations()
Create player ship animations.
ecs::AnimationSet createEnemyWalkingAnimations()
Create walking enemy animations.
ecs::AnimationClip makeClip(std::initializer_list< ecs::Rectangle > frames, float duration=0.1f, bool loop=true, const std::string &nextClip="")
Helper to create animation clips easily.
ecs::AnimationSet createOrbitalModuleAnimations()
Create drone (orbital module) animations.
ecs::AnimationSet createEnemyBasicAnimations()
Create basic enemy animations.
ecs::AnimationSet createPlayerBulletAnimations()
Create player bullet animations.
ecs::AnimationSet createEnemyBulletAnimations()
Create enemy bullet animations.
ecs::AnimationSet createBossArmAnimations()
Create boss arm animations.
ecs::AnimationSet createBossBodyAnimations()
Create boss body animations.
ecs::AnimationSet getAnimationSet(const std::string &entityType)
Get an AnimationSet by entity type.
std::function< ecs::AnimationSet()> AnimationFactory
Factory function type for animation set creation.
Defines a sequence of frames for an animation.