Add particles!
This commit is contained in:
@@ -37,7 +37,69 @@ typedef struct Owner {
|
||||
} Owner;
|
||||
extern ECS_COMPONENT_DECLARE(Owner);
|
||||
|
||||
/**********************************************************
|
||||
* Particle components
|
||||
*********************************************************/
|
||||
|
||||
typedef struct EmitterAttachment {
|
||||
ecs_entity_t baseEntity;
|
||||
Vector2 offset;
|
||||
} EmitterAttachment;
|
||||
extern ECS_COMPONENT_DECLARE(EmitterAttachment);
|
||||
typedef struct ParticleEmitter {
|
||||
f32 emitterElapsed;
|
||||
f32 emitterLifetime;
|
||||
Vector2 pos;
|
||||
|
||||
struct ParticleEmitterData {
|
||||
// offset
|
||||
Vector2 minOffset, maxOffset;
|
||||
// startVel
|
||||
Vector2 minStartVel, maxStartVel;
|
||||
// endVel
|
||||
Vector2 minEndVel, maxEndVel;
|
||||
// startSize
|
||||
f32 minStartSize, maxStartSize;
|
||||
// endSize
|
||||
f32 minEndSize, maxEndSize;
|
||||
// startRotSpeed
|
||||
f32 minStartRotSpeed, maxStartRotSpeed;
|
||||
// endRotSpeed
|
||||
f32 minEndRotSpeed, maxEndRotSpeed;
|
||||
// startColor
|
||||
Color minStartColor, maxStartColor;
|
||||
// endColor
|
||||
Color minEndColor, maxEndColor;
|
||||
// lifetime
|
||||
f32 minLifetime, maxLifetime;
|
||||
|
||||
BlendMode blend;
|
||||
BzTileID tileID;
|
||||
} data;
|
||||
|
||||
ecs_entity_t targetParticles; // ParticleLayer0 / ParticleLayer1
|
||||
} ParticleEmitter;
|
||||
extern ECS_COMPONENT_DECLARE(ParticleEmitter);
|
||||
|
||||
typedef struct Particle {
|
||||
Vector2 pos;
|
||||
f32 rotation;
|
||||
const Vector2 startVel, endVel;
|
||||
const f32 startSize, endSize;
|
||||
const f32 startRotSpeed, endRotSpeed;
|
||||
const Color startColor, endColor;
|
||||
const BlendMode blend: 8;
|
||||
const BzTileID tileID: 24;
|
||||
const f32 lifetime;
|
||||
f32 elapsed;
|
||||
} Particle;
|
||||
static_assert(sizeof(Particle) == 64, "");
|
||||
|
||||
// 2 Separate components (Before entity, After entity), so we don't need to sort
|
||||
typedef Particle ParticleLayer0, ParticleLayer1;
|
||||
|
||||
extern ECS_COMPONENT_DECLARE(ParticleLayer0);
|
||||
extern ECS_COMPONENT_DECLARE(ParticleLayer1);
|
||||
|
||||
/**********************************************************
|
||||
* Movement components
|
||||
|
||||
Reference in New Issue
Block a user