diff --git a/src/main.zig b/src/main.zig index c5d38fd..ce8e184 100644 --- a/src/main.zig +++ b/src/main.zig @@ -24,6 +24,7 @@ const Particle = struct { acceleration: pr.Vec = .{ .a = .{ .x = 0, .y = 0, .z = 0 } }, lifespan: u8 = 0, show: u8 = 0, + size: f32 = 0, pub fn new(self: Self) void { _ = self; } @@ -48,6 +49,7 @@ const Particle = struct { const xrnr = randMinMaxFloat(-xaccel, xaccel); const yrnr = randMinMaxFloat(-yaccel, yaccel); + self.size = randMinMaxFloat(-2,2); self.lifespan = rand.intRangeAtMost(u8, 75, 255); self.acceleration.a.x = xrnr; self.acceleration.a.y = yrnr; @@ -103,6 +105,7 @@ const Emitter = struct { var posy: i32 = 0; const att: Attractor = .{ .vec = .{ .a = .{ .x = 10, .y = 10, .z = 10 } } }; const att2: Attractor = .{ .vec = .{ .a = .{ .x = -200, .y = -200, .z = 0 } } }; + var vec2 : rl.Vector2=undefined; att.draw(); att2.draw(); @@ -116,7 +119,8 @@ const Emitter = struct { posx = @intFromFloat(screenWidth / 2 + p.position.a.x); posy = @intFromFloat(screenHeight / 2 + p.position.a.y); //rl.drawRectangle(posx,posy,2,2,rl.Color{.r=p.position.a.color.r,.g=p.position.a.color.g,.b=p.position.a.color.b,.a=255}); - rl.drawTexture(texture, posx, posy, rl.Color.white); + vec2 = .{.x = (screenWidth/2+p.position.a.x),.y = (screenHeight/2+p.position.a.y)}; + rl.drawTextureEx(texture, vec2,0.5,p.size, rl.Color.white); } } } @@ -203,13 +207,12 @@ pub fn main() anyerror!void { emitter.emit(@as(u32, @intFromFloat(value)), value2, value3); } - rl.beginBlendMode(rl.BlendMode.blend_additive); - plotStr = try std.fmt.bufPrint(&plotStrBuf,"{d}, {d}, {d}, {d}\n",.{emitter.particles[0].acceleration.a.x,emitter.particles[0].position.a.x,emitter.particles[0].velocity.a.x,emitter.particles[0].show}); try plot.log(file,plotStr); + rl.beginBlendMode(rl.BlendMode.blend_additive); emitter.update(texture); rl.endBlendMode(); } diff --git a/zig-out/bin/raylib-test b/zig-out/bin/raylib-test index 2e848b4..adeb43b 100755 Binary files a/zig-out/bin/raylib-test and b/zig-out/bin/raylib-test differ