random scale
This commit is contained in:
parent
a22f8965c8
commit
858163939a
@ -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();
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user