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 {
|
2024-10-14 19:24:29 -05:00
|
|
|
screen := render.init(true)
|
|
|
|
render.clear(screen, .(100, 50, 0, 255))
|
2024-10-12 15:39:09 -05:00
|
|
|
p0 := Vec2(int).(0, 0)
|
2024-10-14 19:24:29 -05:00
|
|
|
p1 := Vec2(int).(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
|
2024-09-13 16:41:31 -05:00
|
|
|
}
|
2024-10-14 19:24:29 -05:00
|
|
|
render.sync(screen)
|
2024-09-13 16:41:31 -05:00
|
|
|
return
|
|
|
|
}
|