clear canvas properly

This commit is contained in:
nek0 2024-10-12 03:48:25 +02:00
parent 5a759ea096
commit 0953497a79

View file

@ -55,10 +55,6 @@ pub fn main() {
, end: Position{x: width / 4, y: 3 * height / 4}} , end: Position{x: width / 4, y: 3 * height / 4}}
]}; ]};
canvas.set_draw_color(Color::RGB(0, 0, 0));
canvas.clear();
canvas.present();
'running: loop { 'running: loop {
if i % 255 == 0 { if i % 255 == 0 {
flip = !flip; flip = !flip;
@ -69,7 +65,8 @@ pub fn main() {
i = i + 1; i = i + 1;
} }
//canvas.set_draw_color(Color::RGB(i, 64, 255 - i)); //canvas.set_draw_color(Color::RGB(i, 64, 255 - i));
//canvas.clear(); canvas.set_draw_color(Color::RGB(0, 0, 0));
canvas.clear();
draw_lines(&canvas, Color::RGB(255 - i, 64, i), & base.lines); draw_lines(&canvas, Color::RGB(255 - i, 64, i), & base.lines);
for event in event_pump.poll_iter() { for event in event_pump.poll_iter() {
match event { match event {