Fix stroke
This commit is contained in:
parent
e105053e81
commit
fac481c0a5
@ -1,4 +1,4 @@
|
|||||||
use iced::widget::canvas::{self, Path};
|
use iced::widget::canvas::{self, Path, Stroke};
|
||||||
use iced::{
|
use iced::{
|
||||||
executor, keyboard, time, Application, Color, Command, Element, Length, Point, Rectangle,
|
executor, keyboard, time, Application, Color, Command, Element, Length, Point, Rectangle,
|
||||||
Settings, Size, Subscription,
|
Settings, Size, Subscription,
|
||||||
@ -129,8 +129,20 @@ impl<'a> canvas::Program<Message> for Tetris {
|
|||||||
);
|
);
|
||||||
let block = Path::rectangle(point, block_size);
|
let block = Path::rectangle(point, block_size);
|
||||||
let color = tetronimo.color();
|
let color = tetronimo.color();
|
||||||
let color = Color::from_rgb8(color.0, color.1, color.2);
|
let fill_color = Color::from_rgb8(color.0, color.1, color.2);
|
||||||
frame.fill(&block, color);
|
frame.fill(&block, fill_color);
|
||||||
|
|
||||||
|
let stroke_color = Color::from_rgb8(
|
||||||
|
color.0.checked_sub(20).unwrap_or(0),
|
||||||
|
color.1.checked_sub(20).unwrap_or(0),
|
||||||
|
color.2.checked_sub(20).unwrap_or(0),
|
||||||
|
);
|
||||||
|
let stroke = Stroke {
|
||||||
|
width: 3.0,
|
||||||
|
color: stroke_color,
|
||||||
|
..Stroke::default()
|
||||||
|
};
|
||||||
|
frame.stroke(&block, stroke);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec![background, frame.into_geometry()]
|
vec![background, frame.into_geometry()]
|
||||||
|
Loading…
Reference in New Issue
Block a user