ableos/sysdata/programs/render_example/src/examples/random.hb

16 lines
462 B
Plaintext
Raw Normal View History

2024-09-13 16:41:31 -05:00
.{random} := @use("../../../../libraries/stn/src/lib.hb")
render := @use("../../../../libraries/render/src/lib.hb")
example := fn(): void {
2024-10-14 19:24:29 -05:00
screen := render.init(false)
render.clear(screen, render.black)
2024-09-13 16:41:31 -05:00
loop {
2024-10-25 10:37:38 -05:00
x := random.range(uint, 0, screen.width)
y := random.range(uint, 0, screen.height)
r := random.range(u8, 0, 255)
g := random.range(u8, 0, 75)
b := random.range(u8, 0, 155)
2024-10-14 19:24:29 -05:00
render.put_pixel(screen, .(x, y), .(b, g, r, 255))
2024-09-13 16:41:31 -05:00
}
return
}