From: Brendan Hansen Date: Mon, 26 Apr 2021 15:25:36 +0000 (-0500) Subject: starting work on particle system simulation X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=02c6802f86149a3e67482979b7008f4d9921737e;p=sand-toy.git starting work on particle system simulation --- diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/site/sand_toy.wasm b/site/sand_toy.wasm index 9685ec0..1a9832b 100644 Binary files a/site/sand_toy.wasm and b/site/sand_toy.wasm differ diff --git a/src/simulation.onyx b/src/simulation.onyx index 577b047..89ddba6 100644 --- a/src/simulation.onyx +++ b/src/simulation.onyx @@ -1,4 +1,14 @@ +Vec2 :: struct { + zero :: Vec2.{ 0, 0 }; + + x, y: f32; +} + +ParticleBoard :: struct { + particles: [] Particle; + width, height: u32; +} Particle :: struct { Type :: enum { @@ -7,4 +17,11 @@ Particle :: struct { } type: Type = .Empty; + velocity: Vec2 = .zero; +} + +init_particles :: (particles: [] Particle) { + for ^particle: particles { + *particle = .{ .Sand }; + } }