Move ggez example to tour
This commit is contained in:
parent
3440ba3cb4
commit
ced3ffc225
11 changed files with 0 additions and 0 deletions
30
examples/tour/renderer/debugger.rs
Normal file
30
examples/tour/renderer/debugger.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use super::Renderer;
|
||||
use ggez::graphics::{Color, DrawMode, MeshBuilder, Rect};
|
||||
|
||||
impl iced::renderer::Debugger for Renderer<'_> {
|
||||
type Color = Color;
|
||||
|
||||
fn explain(&mut self, layout: &iced::Layout<'_>, color: Color) {
|
||||
let bounds = layout.bounds();
|
||||
|
||||
let mut debug_mesh =
|
||||
self.debug_mesh.take().unwrap_or(MeshBuilder::new());
|
||||
|
||||
debug_mesh.rectangle(
|
||||
DrawMode::stroke(1.0),
|
||||
Rect {
|
||||
x: bounds.x,
|
||||
y: bounds.y,
|
||||
w: bounds.width,
|
||||
h: bounds.height,
|
||||
},
|
||||
color,
|
||||
);
|
||||
|
||||
self.debug_mesh = Some(debug_mesh);
|
||||
|
||||
for child in layout.children() {
|
||||
self.explain(&child, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue