starting work on particle system simulation
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 26 Apr 2021 15:25:36 +0000 (10:25 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 26 Apr 2021 15:25:36 +0000 (10:25 -0500)
build.sh [changed mode: 0644->0755]
site/sand_toy.wasm
src/simulation.onyx

old mode 100644 (file)
new mode 100755 (executable)
index 9685ec09da5258d7459bd1638284a98f16447000..1a9832b22846f2c382d38df1cf028e066532250e 100644 (file)
Binary files a/site/sand_toy.wasm and b/site/sand_toy.wasm differ
index 577b0478947470826ebaf627a82b7685174d5dcf..89ddba6d4ef03e7d2ff893152a51da73fe3cc0af 100644 (file)
@@ -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 };
+    }
 }