sadf
This commit is contained in:
parent
c3cd0f5aa9
commit
81a039a049
@ -79,11 +79,11 @@ const Emitter = struct {
|
||||
pub fn init(self: *Emitter) !void {
|
||||
var xrnr = randMinMaxFloat(-1, 1);
|
||||
var yrnr = randMinMaxFloat(-0.5, 0.5);
|
||||
self.particles = try allocator.alloc(Particle, 500000);
|
||||
self.particles = try allocator.alloc(Particle, 10000);
|
||||
for (self.particles) |*p| {
|
||||
xrnr = randMinMaxFloat(0, 2);
|
||||
yrnr = randMinMaxFloat(0, 2);
|
||||
p.* = Particle{ .velocity = .{ .a = .{ .x = 1, .y = -3 } }, .acceleration = .{ .a = .{ .x = xrnr, .y = yrnr } } };
|
||||
p.* = Particle{ .velocity = .{ .a = .{ .x = 0, .y = 0 } }, .acceleration = .{ .a = .{ .x = xrnr, .y = yrnr } } };
|
||||
}
|
||||
}
|
||||
pub fn emit(self: *Emitter, count: u32, xaccel: f32, yaccel: f32) void {
|
||||
@ -180,10 +180,9 @@ pub fn main() anyerror!void {
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
||||
const file = try plot.open("plot.dat");
|
||||
try plot.log(file,"test\ntest2\n");
|
||||
|
||||
var plotStr : []u8 = undefined;
|
||||
var plotStrBuf : [128]u8 = undefined;
|
||||
try plot.log(file,"acceleration, position, velocity, show\n");
|
||||
|
||||
while (!rl.windowShouldClose()) { // Detect window close button or ESC key
|
||||
rl.beginDrawing();
|
||||
@ -208,7 +207,7 @@ pub fn main() anyerror!void {
|
||||
|
||||
rl.endBlendMode();
|
||||
|
||||
plotStr = try std.fmt.bufPrint(&plotStrBuf,"{}, {}, {}\n",.{emitter.particles[0].acceleration.a.x,emitter.particles[0].position.a.x,emitter.particles[0].velocity.a.x});
|
||||
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);
|
||||
|
||||
emitter.update(texture);
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user