2025-08-13 15:04:49 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "pxl8_types.h"
|
|
|
|
|
#include "pxl8_gfx.h"
|
|
|
|
|
|
|
|
|
|
typedef struct pxl8_copper_bar {
|
|
|
|
|
f32 base_y;
|
|
|
|
|
f32 amplitude;
|
|
|
|
|
i32 height;
|
|
|
|
|
f32 speed;
|
|
|
|
|
f32 phase;
|
|
|
|
|
u32 color;
|
|
|
|
|
u32 fade_color;
|
|
|
|
|
} pxl8_copper_bar;
|
|
|
|
|
|
|
|
|
|
typedef struct pxl8_particle {
|
|
|
|
|
f32 x, y, z;
|
|
|
|
|
f32 vx, vy, vz;
|
|
|
|
|
f32 ax, ay, az;
|
|
|
|
|
f32 life;
|
|
|
|
|
f32 max_life;
|
|
|
|
|
u32 color;
|
|
|
|
|
u32 start_color;
|
|
|
|
|
u32 end_color;
|
|
|
|
|
f32 size;
|
|
|
|
|
f32 angle;
|
|
|
|
|
f32 spin;
|
|
|
|
|
u8 flags;
|
|
|
|
|
} pxl8_particle;
|
|
|
|
|
|
|
|
|
|
typedef struct pxl8_particle_system {
|
|
|
|
|
pxl8_particle* particles;
|
|
|
|
|
u32 count;
|
|
|
|
|
u32 max_count;
|
|
|
|
|
u32 alive_count;
|
|
|
|
|
f32 spawn_rate;
|
|
|
|
|
f32 spawn_timer;
|
|
|
|
|
f32 x, y;
|
|
|
|
|
f32 spread_x, spread_y;
|
|
|
|
|
f32 gravity_x, gravity_y;
|
|
|
|
|
f32 drag;
|
|
|
|
|
f32 turbulence;
|
|
|
|
|
void (*spawn_fn)(pxl8_particle* p, void* userdata);
|
|
|
|
|
void (*update_fn)(pxl8_particle* p, f32 dt, void* userdata);
|
|
|
|
|
void (*render_fn)(pxl8_gfx_ctx* ctx, pxl8_particle* p, void* userdata);
|
|
|
|
|
void* userdata;
|
|
|
|
|
} pxl8_particle_system;
|
|
|
|
|
|
|
|
|
|
void pxl8_vfx_copper_bars(pxl8_gfx_ctx* ctx, pxl8_copper_bar* bars, u32 bar_count, f32 time);
|
|
|
|
|
void pxl8_vfx_plasma(pxl8_gfx_ctx* ctx, f32 time, f32 scale1, f32 scale2, u8 palette_offset);
|
|
|
|
|
void pxl8_vfx_rotozoom(pxl8_gfx_ctx* ctx, f32 angle, f32 zoom, i32 cx, i32 cy);
|
|
|
|
|
void pxl8_vfx_tunnel(pxl8_gfx_ctx* ctx, f32 time, f32 speed, f32 twist);
|
|
|
|
|
void pxl8_vfx_water_ripple(pxl8_gfx_ctx* ctx, f32* height_map, i32 drop_x, i32 drop_y, f32 damping);
|
|
|
|
|
|
|
|
|
|
void pxl8_vfx_particles_clear(pxl8_particle_system* sys);
|
|
|
|
|
void pxl8_vfx_particles_destroy(pxl8_particle_system* sys);
|
|
|
|
|
void pxl8_vfx_particles_emit(pxl8_particle_system* sys, u32 count);
|
|
|
|
|
void pxl8_vfx_particles_init(pxl8_particle_system* sys, u32 max_count);
|
|
|
|
|
void pxl8_vfx_particles_render(pxl8_particle_system* sys, pxl8_gfx_ctx* ctx);
|
|
|
|
|
void pxl8_vfx_particles_update(pxl8_particle_system* sys, f32 dt);
|
|
|
|
|
|
|
|
|
|
void pxl8_vfx_explosion(pxl8_particle_system* sys, i32 x, i32 y, u32 color, f32 force);
|
|
|
|
|
void pxl8_vfx_fire(pxl8_particle_system* sys, i32 x, i32 y, i32 width, u8 palette_start);
|
|
|
|
|
void pxl8_vfx_rain(pxl8_particle_system* sys, i32 width, f32 wind);
|
|
|
|
|
void pxl8_vfx_smoke(pxl8_particle_system* sys, i32 x, i32 y, u8 color);
|
|
|
|
|
void pxl8_vfx_snow(pxl8_particle_system* sys, i32 width, f32 wind);
|
|
|
|
|
void pxl8_vfx_sparks(pxl8_particle_system* sys, i32 x, i32 y, u32 color);
|
2025-09-27 11:03:36 -05:00
|
|
|
void pxl8_vfx_starfield(pxl8_particle_system* sys, f32 speed, f32 spread);
|