| @@ -17,6 +17,7 @@ pub struct Debug { | |||||
| text: Text, | text: Text, | ||||
| fps: usize, | fps: usize, | ||||
| resolution: (u32, u32), | resolution: (u32, u32), | ||||
| mouse_pos: (f32, f32), | |||||
| } | } | ||||
| impl Debug { | impl Debug { | ||||
| @@ -29,10 +30,12 @@ impl Debug { | |||||
| .color(0.7, 0.7, 0.7, 1.0) | .color(0.7, 0.7, 0.7, 1.0) | ||||
| .position(5.0, 5.0) | .position(5.0, 5.0) | ||||
| .text(format!("Space Crush v{}\n", env!("CARGO_PKG_VERSION"))) | .text(format!("Space Crush v{}\n", env!("CARGO_PKG_VERSION"))) | ||||
| .text("\nFPS: ") | |||||
| .text("\nfps: ") | |||||
| .text("-") | .text("-") | ||||
| .text("\nResolution: ") | |||||
| .text("1280 x 720") | |||||
| .text("\nresolution: ") | |||||
| .text("1280 | 720") | |||||
| .text("\nmouse_pos: ") | |||||
| .text("0.00 | 0.00") | |||||
| .build()?; | .build()?; | ||||
| Ok(Self { | Ok(Self { | ||||
| @@ -40,6 +43,7 @@ impl Debug { | |||||
| text, | text, | ||||
| fps: 0, | fps: 0, | ||||
| resolution: (0, 0), | resolution: (0, 0), | ||||
| mouse_pos: (0.0, 0.0), | |||||
| }) | }) | ||||
| } | } | ||||
| } | } | ||||
| @@ -61,7 +65,14 @@ impl<'a> System<'a> for Debug { | |||||
| 4, | 4, | ||||
| &mut self.resolution, | &mut self.resolution, | ||||
| &state.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); | drop(guard); | ||||