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

23 lines
631 B
Plaintext
Raw Normal View History

2024-10-12 15:39:09 -05:00
.{Vec2} := @use("../../../../libraries/stn/src/lib.hb").math
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()
2024-10-12 15:39:09 -05:00
p0 := Vec2(int).(0, 0)
p1 := Vec2(int).(0, height)
2024-09-13 16:41:31 -05:00
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
}