Browse Source

Display mouse_pos in debug output

raster
Bergmann89 4 years ago
parent
commit
48a482b78e
1 changed files with 15 additions and 4 deletions
  1. +15
    -4
      space-crush/src/app/render/debug.rs

+ 15
- 4
space-crush/src/app/render/debug.rs View File

@@ -17,6 +17,7 @@ pub struct Debug {
text: Text,
fps: usize,
resolution: (u32, u32),
mouse_pos: (f32, f32),
}

impl Debug {
@@ -29,10 +30,12 @@ impl Debug {
.color(0.7, 0.7, 0.7, 1.0)
.position(5.0, 5.0)
.text(format!("Space Crush v{}\n", env!("CARGO_PKG_VERSION")))
.text("\nFPS: ")
.text("\nfps: ")
.text("-")
.text("\nResolution: ")
.text("1280 x 720")
.text("\nresolution: ")
.text("1280 | 720")
.text("\nmouse_pos: ")
.text("0.00 | 0.00")
.build()?;

Ok(Self {
@@ -40,6 +43,7 @@ impl Debug {
text,
fps: 0,
resolution: (0, 0),
mouse_pos: (0.0, 0.0),
})
}
}
@@ -61,7 +65,14 @@ impl<'a> System<'a> for Debug {
4,
&mut self.resolution,
&state.resolution,
|(w, h)| format!("{} x {}", w, h),
|(w, h)| format!("{} | {}", w, h),
);
update_text(
&mut self.text,
6,
&mut self.mouse_pos,
&state.mouse_pos,
|(x, y)| format!("{:.2} | {:.2}", x, y),
);
drop(guard);



Loading…
Cancel
Save