diff --git a/game/components.h b/game/components.h index 279aadb..dfe86d3 100644 --- a/game/components.h +++ b/game/components.h @@ -66,10 +66,8 @@ typedef struct ParticleEmitter { f32 minStartRotSpeed, maxStartRotSpeed; // endRotSpeed f32 minEndRotSpeed, maxEndRotSpeed; - // startColor - Color minStartColor, maxStartColor; - // endColor - Color minEndColor, maxEndColor; + + Color startColor, endColor; // lifetime f32 minLifetime, maxLifetime; diff --git a/game/main.c b/game/main.c index 2df095f..1a947f1 100644 --- a/game/main.c +++ b/game/main.c @@ -546,7 +546,6 @@ static void renderGame(Game *game, float dt) { while (ecs_iter_next(&it)) { Particle *particle = ecs_field(&it, Particle, 1); for (i32 i = 0; i < it.count; i++) { - DrawCircleV(particle[i].pos, 2.0f, RED); if (updateParticle(tex, &particle[i], dt)) ecs_delete(ECS, it.entities[i]); } @@ -773,17 +772,15 @@ void imguiRender(float dt, void *userData) { } while (0) - igColor("minStartColor", data->minStartColor); - igColor("maxStartColor", data->maxStartColor); - igColor("minEndColor", data->minEndColor); - igColor("maxEndColor", data->maxEndColor); + igColor("startColor", data->startColor); + igColor("endColor", data->endColor); #undef igColor igSliderFloat("minLifetime", &data->minLifetime, 0.0f, 6.0f, "%.2f", 0); igSliderFloat("maxLifetime", &data->maxLifetime, 0.0f, 6.0f, "%.2f", 0); Particle particle = spawnParticle(&emitter); - ecs_entity_t e = entityCreateEmpty(); - ecs_set_ptr(ECS, e, ParticleLayer1, &particle); + //ecs_entity_t e = entityCreateEmpty(); + //ecs_set_ptr(ECS, e, ParticleLayer1, &particle); } if (igCollapsingHeader_TreeNodeFlags("Selection", 0)) { switch (input->state) { diff --git a/game/systems/s_animation.c b/game/systems/s_animation.c index 6b07b2a..eb61a75 100644 --- a/game/systems/s_animation.c +++ b/game/systems/s_animation.c @@ -49,7 +49,7 @@ bool updateParticle(const Texture2D tex, Particle *particle, f32 dt) { .a = lerpInt(startC.a, endC.a, alpha) }; - //BeginBlendMode(particle->blend); + BeginBlendMode(particle->blend); f32 hSize = size * 0.5f; Vector2 center = particle->pos; Rectangle src = getTextureRect(particle->tileID); @@ -62,7 +62,7 @@ bool updateParticle(const Texture2D tex, Particle *particle, f32 dt) { center.y, size, size }, (Vector2) {hSize, hSize}, rot, color); - //EndBlendMode(); + EndBlendMode(); particle->pos = Vector2Add(particle->pos, Vector2Scale(vel, dt)); particle->elapsed += dt; @@ -98,8 +98,8 @@ Particle spawnParticle(const ParticleEmitter *emitter) { .endSize = randFloatRange(data->minEndSize, data->maxEndSize), .startRotSpeed = randFloatRange(data->minStartRotSpeed, data->maxStartRotSpeed), .endRotSpeed = randFloatRange(data->minEndRotSpeed, data->maxEndRotSpeed), - .startColor = randColorRange(data->minStartColor, data->maxStartColor), - .endColor = randColorRange(data->minEndColor, data->maxEndColor), + .startColor = data->startColor, + .endColor = data->endColor, .blend = data->blend, .tileID = data->tileID, .elapsed = 0.0f,