mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'debug-coordinates' into 'master'
Add player coordinates to debug window Closes #129 See merge request veloren/veloren!193 Former-commit-id: 51cfaee7dcff37ccf83f2386441e0e1364134ad7
This commit is contained in:
commit
f5d42cba21
@ -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<f32>,
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -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::<Pos>()
|
||||
.get(self.client.borrow().entity())
|
||||
.unwrap()
|
||||
.0,
|
||||
},
|
||||
&self.scene.camera(),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user