forked from AbleOS/ableos
Removed triangle drawing stuff
This commit is contained in:
parent
552b613151
commit
376a5213ac
|
@ -45,8 +45,6 @@ put_line := mode.put_line
|
|||
clear := mode.clear
|
||||
put_surface := mode.put_surface
|
||||
put_scaled := mode.put_scaled
|
||||
put_tri := mode.put_tri
|
||||
put_filled_tri := mode.put_filled_tri
|
||||
put_text := mode.put_text
|
||||
// thanks peony for these three!
|
||||
put_trirect := mode.put_trirect
|
||||
|
|
|
@ -350,70 +350,6 @@ put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): vo
|
|||
return
|
||||
}
|
||||
|
||||
put_tri := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), p2: Vec2(uint), color: Color): void {
|
||||
@inline(put_line, surface, p0, p1, color)
|
||||
@inline(put_line, surface, p1, p2, color)
|
||||
@inline(put_line, surface, p2, p0, color)
|
||||
return
|
||||
}
|
||||
|
||||
put_filled_tri := 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
|
||||
}
|
||||
|
||||
primary_dx := @as(int, @bitcast(p2.x - p0.x))
|
||||
primary_dy := @as(int, @bitcast(p2.y - p0.y))
|
||||
primary_x := p0.x
|
||||
primary_step := @as(int, primary_dx) / @as(int, primary_dy)
|
||||
primary_error := @as(int, 2) * primary_dx - primary_dy
|
||||
|
||||
secondary_dx := @as(int, @bitcast(p1.x - p0.x))
|
||||
secondary_dy := @as(int, @bitcast(p1.y - p0.y))
|
||||
secondary_x := p0.x
|
||||
secondary_step := secondary_dx / secondary_dy
|
||||
secondary_error := @as(int, 2) * secondary_dx - secondary_dy
|
||||
|
||||
y := p0.y
|
||||
loop if y > p1.y break else {
|
||||
put_pixel(surface, .(primary_x, y), color)
|
||||
put_pixel(surface, .(secondary_x, y), color)
|
||||
primary_x = @as(uint, @bitcast(@as(int, @bitcast(primary_x)) + primary_step))
|
||||
secondary_x = @as(uint, @bitcast(@as(int, @bitcast(secondary_x)) + secondary_step))
|
||||
y += 1
|
||||
}
|
||||
|
||||
secondary_dx = @as(int, @bitcast(p2.x - p1.x))
|
||||
secondary_dy = @as(int, @bitcast(p2.y - p1.y))
|
||||
secondary_x = p1.x
|
||||
secondary_step = secondary_dx / secondary_dy
|
||||
secondary_error = @as(int, 2) * secondary_dx - secondary_dy
|
||||
|
||||
loop if y > p2.y break else {
|
||||
put_pixel(surface, .(primary_x, y), color)
|
||||
put_pixel(surface, .(secondary_x, y), color)
|
||||
primary_x = @as(uint, @bitcast(@as(int, @bitcast(primary_x)) + primary_step))
|
||||
secondary_x = @as(uint, @bitcast(@as(int, @bitcast(secondary_x)) + secondary_step))
|
||||
y += 1
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
put_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void {
|
||||
x := 0
|
||||
y := radius
|
||||
|
|
|
@ -9,15 +9,3 @@ hblang.version = "1.0.0"
|
|||
|
||||
[build]
|
||||
command = "hblang src/main.hb"
|
||||
|
||||
[package]
|
||||
name = "mouse_driver"
|
||||
authors = [""]
|
||||
|
||||
[dependants.libraries]
|
||||
|
||||
[dependants.binaries]
|
||||
hblang.version = "1.0.0"
|
||||
|
||||
[build]
|
||||
command = "hblang src/main.hb"
|
||||
|
|
|
@ -29,6 +29,9 @@ resolution = "1600x900x24"
|
|||
# [boot.limine.ableos.modules.render_example]
|
||||
# path = "boot:///render_example.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.mouse_driver]
|
||||
path = "boot:///mouse_driver.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.serial_driver]
|
||||
# path = "boot:///serial_driver.hbf"
|
||||
|
||||
|
@ -56,8 +59,5 @@ resolution = "1600x900x24"
|
|||
# [boot.limine.ableos.modules.pumpkin_print]
|
||||
# path = "boot:///pumpkin_print.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.mouse_driver]
|
||||
# path = "boot:///mouse_driver.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.mouse_test]
|
||||
# path = "boot:///mouse_test.hbf"
|
||||
|
|
Loading…
Reference in a new issue