1
0
Fork 0
forked from AbleOS/ableos
ableos/sysdata/programs/render_example/src/examples/lines.hb

22 lines
576 B
Plaintext
Raw Normal View History

2024-09-13 16:41:31 -05:00
render := @use("../../../../libraries/render/src/lib.hb")
/* expected result:
a 3d-looking set of blue lines
created on a blue background */
example := fn(): void {
render.init()
render.clear(.(100, 50, 0, 255))
width := render.width()
height := render.height()
p0 := render.IVec2.(0, 0)
p1 := render.IVec2.(0, height)
loop if p0.y >= height break else {
render.put_line(p0, p1, .(255, 180, 100, 255))
render.put_line(.(width, height) - p0, .(width, height) - p1, .(255, 180, 100, 255))
p0.y += height >> 6
p1.x += width >> 6
}
render.sync()
return
}