diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 4efbdaf41a..fded2beb82 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -60,6 +60,7 @@ widget_ids! { debug_bg, fps_counter, ping, + coordinates, // Game Version version, @@ -103,6 +104,7 @@ font_ids! { pub struct DebugInfo { pub tps: f64, pub ping_ms: f64, + pub coordinates: Vec3, } pub enum Event { @@ -391,6 +393,12 @@ impl Hud { .font_id(self.fonts.opensans) .font_size(14) .set(self.ids.ping, ui_widgets); + Text::new(&format!("Coordinates: {:.1}", debug_info.coordinates)) + .color(TEXT_COLOR) + .down_from(self.ids.ping, 5.0) + .font_id(self.fonts.opensans) + .font_size(14) + .set(self.ids.coordinates, ui_widgets); } // Add Bag-Space Button. diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 1b51b9d4f0..12c79c80c9 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -8,7 +8,7 @@ use crate::{ Direction, Error, GlobalState, PlayState, PlayStateResult, }; use client::{self, Client}; -use common::{clock::Clock, comp, msg::ClientState}; +use common::{clock::Clock, comp, comp::phys::Pos, msg::ClientState}; use glutin::MouseButton; use std::{cell::RefCell, mem, rc::Rc, time::Duration}; use vek::*; @@ -163,6 +163,15 @@ impl PlayState for SessionState { DebugInfo { tps: clock.get_tps(), ping_ms: self.client.borrow().get_ping_ms(), + coordinates: self + .client + .borrow() + .state() + .ecs() + .read_storage::() + .get(self.client.borrow().entity()) + .unwrap() + .0, }, &self.scene.camera(), );