Move systems into subdirectory, add tree shake animation

This commit is contained in:
2023-12-29 14:46:11 +01:00
parent aa3bfbf823
commit 31a9289770
15 changed files with 352 additions and 105 deletions

View File

@@ -86,7 +86,6 @@ extern ECS_COMPONENT_DECLARE(Path);
typedef struct TextureRegion {
Texture2D texture;
Rectangle rec;
f32 rotation;
bool flipX : 1;
bool flipY : 1;
} TextureRegion;
@@ -109,12 +108,49 @@ typedef struct Animation {
} Animation;
extern ECS_COMPONENT_DECLARE(Animation);
typedef enum EasingType {
EASE_ROTATION,
EASE_POS_X,
EASE_POS_Y,
EASE_SIZE_X,
EASE_SIZE_Y,
} EasingType;
typedef struct Easing {
EasingType type;
BzEaseType easingFunc;
// start + target * (easeStart + (easeTarget * x) + easeOffset) + offset
f32 target;
f32 start;
f32 offset;
f32 easeTarget;
f32 easeStart;
f32 easeOffset;
f32 x;
f32 elapsed;
f32 duration;
//struct Easing *next;
} Easing;
extern ECS_COMPONENT_DECLARE(Easing);
typedef struct EntityArms {
ecs_entity_t left;
ecs_entity_t right;
} EntityArms;
//extern ECS_COMPONENT_DECLARE(EntityArms);
/**********************************************************
* Event components
*********************************************************/
typedef struct HarvestEvent {
i32 amount;
} HarvestEvent;
extern ECS_COMPONENT_DECLARE(HarvestEvent);
/**********************************************************
* Gameplay components
*********************************************************/
@@ -134,7 +170,16 @@ extern ECS_TAG_DECLARE(Unit);
// - Build
// - Work
// - Attack (since it is also a unit)
extern ECS_TAG_DECLARE(Worker);
typedef struct Worker {
// stats
f32 collectSpeed;
f32 depositSpeed;
i32 carry;
i32 carryCapacity;
ResourceType carryRes;
} Worker;
extern ECS_COMPONENT_DECLARE(Worker);
extern ECS_TAG_DECLARE(Harvestable);
extern ECS_TAG_DECLARE(Buildable);