This commit is contained in:
jonathan santis 2024-11-25 11:17:00 +01:00
parent 1e70d8cf96
commit bca4b26dd7
3 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ const Particle = struct {
self.position.a.y = @floatFromInt(rl.getMouseY()-screenHeight/2); self.position.a.y = @floatFromInt(rl.getMouseY()-screenHeight/2);
self.velocity.a.x = 0; self.velocity.a.x = 0;
self.velocity.a.y = -20; self.velocity.a.y = -20;
self.position.a.color.r = rand.intRangeAtMost(u8,0,255); self.position.a.color.r = rand.intRangeAtMost(u8,0,30);
self.position.a.color.g = rand.intRangeAtMost(u8,0,255); self.position.a.color.g = rand.intRangeAtMost(u8,0,255);
self.position.a.color.b = rand.intRangeAtMost(u8,0,255); self.position.a.color.b = rand.intRangeAtMost(u8,0,255);
} }
@ -85,14 +85,14 @@ pub fn main() anyerror!void {
var posx : i32 = 0; var posx : i32 = 0;
var posy : i32 = 0; var posy : i32 = 0;
var p1 : [1000]Particle = undefined; var p1 : [5000]Particle = undefined;
for (&p1) |*p| { for (&p1) |*p| {
xrnr = rand.float(f32); xrnr = rand.float(f32);
yrnr = rand.float(f32); yrnr = rand.float(f32);
p.* = Particle{.velocity = .{.a = .{.x = 1,.y = -3}},.acceleration = .{.a = .{.x=xrnr,.y=yrnr}}}; p.* = Particle{.velocity = .{.a = .{.x = 1,.y = -3}},.acceleration = .{.a = .{.x=xrnr,.y=yrnr}}};
} }
const img : rl.Texture = rl.loadTexture("img.png"); //const img : rl.Texture = rl.loadTexture("img.png");
rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window"); rl.initWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window");
defer rl.closeWindow(); // Close window and OpenGL context defer rl.closeWindow(); // Close window and OpenGL context
@ -138,7 +138,7 @@ pub fn main() anyerror!void {
} else { } else {
posy = 0; posy = 0;
} }
rl.drawCircle(posx,posy,5,rl.Color{.r=p.position.a.color.r,.g=p.position.a.color.g,.b=p.position.a.color.b,.a=255}); rl.drawRectangle(posx,posy,5,5,rl.Color{.r=p.position.a.color.r,.g=p.position.a.color.g,.b=p.position.a.color.b,.a=255});
} }

Binary file not shown.

Binary file not shown.