Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
@ -32,8 +32,8 @@ impl AglApi for GraphicsRenderer {
|
||||||
let x2 = coords_end.x;
|
let x2 = coords_end.x;
|
||||||
let y2 = coords_end.y;
|
let y2 = coords_end.y;
|
||||||
|
|
||||||
let dx = x2.wrapping_sub(x1);
|
let dx = x2 - x1;
|
||||||
let dy = y2.wrapping_sub(y1);
|
let dy = y2 - y1;
|
||||||
|
|
||||||
for x in x1..x2 {
|
for x in x1..x2 {
|
||||||
let y = y1 + dy * (x - x1) / dx;
|
let y = y1 + dy * (x - x1) / dx;
|
||||||
|
@ -63,9 +63,7 @@ impl AglApi for GraphicsRenderer {
|
||||||
thickness: u32,
|
thickness: u32,
|
||||||
color: RGBA,
|
color: RGBA,
|
||||||
) {
|
) {
|
||||||
self.put_line(coords_1, coords_2, thickness, color);
|
todo!();
|
||||||
self.put_line(coords_2, coords_3, thickness, color);
|
|
||||||
self.put_line(coords_3, coords_1, thickness, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn paint_cursor(&mut self, coords: Point) {
|
fn paint_cursor(&mut self, coords: Point) {
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -83,20 +83,6 @@ fn main() {
|
||||||
},
|
},
|
||||||
"Hello".to_string(),
|
"Hello".to_string(),
|
||||||
);
|
);
|
||||||
|
|
||||||
xyz.put_triangle(
|
|
||||||
Point { x: 10, y: 40 },
|
|
||||||
Point { x: 30, y: 100 },
|
|
||||||
Point { x: 10, y: 90 },
|
|
||||||
8,
|
|
||||||
RGBA {
|
|
||||||
r: 8,
|
|
||||||
g: 7,
|
|
||||||
b: 7,
|
|
||||||
a: 255,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// update pixels
|
// update pixels
|
||||||
for x in 0..600 * 400 {
|
for x in 0..600 * 400 {
|
||||||
buffer[x] = [xyz.buff[x].r, xyz.buff[x].g, xyz.buff[x].b, xyz.buff[x].a]
|
buffer[x] = [xyz.buff[x].r, xyz.buff[x].g, xyz.buff[x].b, xyz.buff[x].a]
|
||||||
|
|
Reference in a new issue