Blood particles
This commit is contained in:
51
game/main.c
51
game/main.c
@@ -464,6 +464,7 @@ static void drawOverScreen(Color c) {
|
||||
|
||||
DrawRectangle(0, 0, width, height, c);
|
||||
}
|
||||
static ParticleEmitter editedEmitter;
|
||||
static void renderGame(Game *game, float dt) {
|
||||
ClearBackground(RAYWHITE);
|
||||
BeginMode2D(game->camera);
|
||||
@@ -568,9 +569,15 @@ static void renderGame(Game *game, float dt) {
|
||||
|
||||
EndMode2D();
|
||||
|
||||
static bool firstRun = true;
|
||||
if (firstRun) {
|
||||
editedEmitter = GET_BLOOD_EMITTER();
|
||||
firstRun = false;
|
||||
}
|
||||
|
||||
InputState *input = ecs_singleton_get_mut(ECS, InputState);
|
||||
if (IsKeyReleased(KEY_SPACE)) {
|
||||
ParticleEmitter emitter = GET_FIREBALL_EMITTER();
|
||||
ParticleEmitter emitter = editedEmitter;
|
||||
emitter.pos = input->mouseWorld;
|
||||
emitter.targetParticles = ecs_id(ParticleLayer1);
|
||||
ecs_entity_t e = entityCreateEmpty();
|
||||
@@ -715,11 +722,14 @@ void imguiRender(float dt, void *userData) {
|
||||
}
|
||||
igText("Input state: %s", inputState);
|
||||
if (igCollapsingHeader_TreeNodeFlags("ParticleEditor", 0)) {
|
||||
static ParticleEmitter emitter = {0.0f};
|
||||
emitter.data.tileID = getParticleTypeTile(PARTICLE_CIRCLE);
|
||||
emitter.data.blend = BLEND_ADDITIVE;
|
||||
struct ParticleEmitterData *data = &emitter.data;
|
||||
igSliderFloat2("Pos", &emitter.pos.x, 0.0f, 1000.0f, "%.2f", 0);
|
||||
struct ParticleEmitterData *data = &editedEmitter.data;
|
||||
igSliderFloat("EmitterLifetime", &editedEmitter.emitterLifetime, 0.0f, 10.0f, "%.2f", 0);
|
||||
igSliderFloat2("Pos", &editedEmitter.pos.x, 0.0f, 1000.0f, "%.2f", 0);
|
||||
|
||||
igSliderFloat("emmitRate", &data->emmitRate, 0.0f, 10.0f, "%.2f", 0);
|
||||
igSliderFloat("emmitVarianceScl", &data->emmitVariance, 0.0f, 10.0f, "%.2f", 0);
|
||||
igSliderFloat2("emmitVariance", &data->emmitVarianceMin, -10.0f, 10.0f, "%.2f", 0);
|
||||
|
||||
igSliderFloat2("minOffset", &data->minOffset.x, -50.0f, 50.0f, "%.2f", 0);
|
||||
igSliderFloat2("maxOffset", &data->maxOffset.x, -50.0f, 50.0f, "%.2f", 0);
|
||||
|
||||
@@ -760,10 +770,31 @@ void imguiRender(float dt, void *userData) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#define NUM_BLEND_MODES 6
|
||||
const char *blendModeNames[NUM_BLEND_MODES] = {
|
||||
"Alpha",
|
||||
"Additive",
|
||||
"Multiplied",
|
||||
"AddColors",
|
||||
"SubtractColors",
|
||||
"AlphaPremultiply"
|
||||
};
|
||||
int blendMode = data->blend;
|
||||
igCombo_Str_arr("BlendMode", &blendMode, blendModeNames, NUM_BLEND_MODES, 0);
|
||||
data->blend = blendMode;
|
||||
#undef NUM_BLEND_MODES
|
||||
#define NUM_SHAPES 3
|
||||
const char *typeNames[NUM_SHAPES] = {
|
||||
"Circle",
|
||||
"SmallSquare",
|
||||
"Square",
|
||||
};
|
||||
int type = getParticleType(data->tileID);
|
||||
igCombo_Str_arr("ParticleType", &type, typeNames, NUM_SHAPES, 0);
|
||||
data->tileID = getParticleTypeTile(type);
|
||||
#undef NUM_SHAPES
|
||||
};
|
||||
if (igCollapsingHeader_TreeNodeFlags("Selection", 0)) {
|
||||
switch (input->state) {
|
||||
case INPUT_SELECTED_UNITS:
|
||||
|
||||
Reference in New Issue
Block a user