1
0
Fork 0
forked from AbleOS/ableos
ableos-idl/sysdata/programs/render_example/src/examples/lines.hb
2024-10-25 16:37:38 +01:00

21 lines
681 B
Plaintext

.{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math
render := @use("../../../../libraries/render/src/lib.hb")
/* expected result:
a 3d-looking set of blue lines
created on a blue background */
example := fn(): void {
screen := render.init(true)
render.clear(screen, .(100, 50, 0, 255))
p0 := Vec2(uint).(0, 0)
p1 := Vec2(uint).(0, screen.height)
loop if p0.y >= screen.height break else {
render.put_line(screen, p0, p1, .(255, 180, 100, 255))
render.put_line(screen, .(screen.width, screen.height) - p0, .(screen.width, screen.height) - p1, .(255, 180, 100, 255))
p0.y += screen.height >> 6
p1.x += screen.width >> 6
}
render.sync(screen)
return
}