Add idle animation

This commit is contained in:
2023-12-05 11:25:56 +01:00
parent abc8cf2b48
commit 0d137ffb25
14 changed files with 344 additions and 30 deletions

View File

@@ -5,6 +5,7 @@
#include <flecs.h>
#include "utils/building_types.h"
#include "utils/entity_types.h"
extern ECS_TAG_DECLARE(TextureTerrain);
extern ECS_TAG_DECLARE(TextureBuildings);
@@ -67,22 +68,19 @@ typedef struct TextureRegion {
} TextureRegion;
extern ECS_COMPONENT_DECLARE(TextureRegion);
typedef enum AnimationType {
ANIMATION_IDLE,
ANIMATION_WALK,
} AnimationType;
extern ECS_COMPONENT_DECLARE(AnimationType);
typedef struct Animation {
TextureRegion firstFrame;
AnimationType currAnimation;
i32 currFrame;
i32 frameCount;
EntityType entityType;
AnimationType animType;
AnimationSequence sequence;
BzTileset *tileset;
i32 curFrame;
f32 frameDuration;
f32 elapsed;
} Animation;
extern ECS_COMPONENT_DECLARE(Animation);
extern ECS_COMPONENT_DECLARE(AnimationType);
#define PATH_DATA_SIZE 8
typedef struct PathData {
Position waypoints[PATH_DATA_SIZE];