forked from AbleOS/ableos
more stubs
This commit is contained in:
parent
223a1c15ad
commit
f65f04460b
|
@ -42,6 +42,7 @@ clear := mode.clear
|
||||||
put_surface := mode.put_surface
|
put_surface := mode.put_surface
|
||||||
put_scaled := mode.put_scaled
|
put_scaled := mode.put_scaled
|
||||||
put_tri_wireframe := mode.put_tri_wireframe
|
put_tri_wireframe := mode.put_tri_wireframe
|
||||||
|
put_tri_filled := mode.put_tri_filled
|
||||||
// thanks peony for these three!
|
// thanks peony for these three!
|
||||||
put_trirect := mode.put_trirect
|
put_trirect := mode.put_trirect
|
||||||
put_vline := mode.put_vline
|
put_vline := mode.put_vline
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.{math, memory, dt} := @use("../../stn/src/lib.hb");
|
.{math, memory, dt, log} := @use("../../stn/src/lib.hb");
|
||||||
.{Color} := @use("lib.hb");
|
.{Color} := @use("lib.hb");
|
||||||
.{Vec2} := math
|
.{Vec2} := math
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ indexptr := fn(surface: Surface, x: int, y: int): ^Color {
|
||||||
return surface.buf + @inline(index, surface, x, y)
|
return surface.buf + @inline(index, surface, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
put_pixel := fn(surface: Surface, pos: Vec2(int), color: Color): void {
|
put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void {
|
||||||
*@inline(indexptr, surface, pos.x, pos.y) = color
|
*@inline(indexptr, surface, @intcast(pos.x), @intcast(pos.y)) = color
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,9 +329,36 @@ put_hline := fn(surface: Surface, y: int, x0: int, x1: int, color: Color): void
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
put_tri_wireframe := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), p2: Vec2(uint), color: Color): void {
|
put_tri_wireframe := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), p2: Vec2(int), color: Color): void {
|
||||||
put_line(surface, p0, p1, color)
|
put_line(surface, p0, p1, color)
|
||||||
put_line(surface, p1, p2, color)
|
put_line(surface, p1, p2, color)
|
||||||
put_line(surface, p2, p0, color)
|
put_line(surface, p2, p0, color)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
put_tri_filled := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), p2: Vec2(uint), color: Color): void {
|
||||||
|
if p2.y < p0.y {
|
||||||
|
tmp := p0
|
||||||
|
p0 = p2
|
||||||
|
p2 = tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
if p1.y < p0.y {
|
||||||
|
tmp := p0
|
||||||
|
p0 = p1
|
||||||
|
p1 = tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
if p2.y < p1.y {
|
||||||
|
tmp := p1
|
||||||
|
p1 = p2
|
||||||
|
p2 = tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
y := p0.y
|
||||||
|
loop if y > p2.y break else {
|
||||||
|
y += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
|
@ -4,7 +4,8 @@ render := @use("../../../../libraries/render/src/lib.hb")
|
||||||
example := fn(): void {
|
example := fn(): void {
|
||||||
screen := render.init(true)
|
screen := render.init(true)
|
||||||
loop {
|
loop {
|
||||||
render.put_tri_wireframe(screen, .(10, 10), .(128, 256), .(512, 512), .(255, 255, 255, 255))
|
render.clear(screen, render.black)
|
||||||
|
render.put_tri_filled(screen, .(128, 256), .(512, 512), .(10, 10), .(255, 255, 255, 255))
|
||||||
render.sync(screen)
|
render.sync(screen)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue