From 7cf299503d8bce8f355e41fced19da1e0d6a0af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Korg=C3=B3l?= Date: Tue, 2 Jul 2019 21:54:38 +0200 Subject: [PATCH] Add crosshair --- assets/voxygen/element/misc_bg/crosshair.vox | 4 ++-- voxygen/src/hud/img_ids.rs | 6 +++--- voxygen/src/hud/mod.rs | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/assets/voxygen/element/misc_bg/crosshair.vox b/assets/voxygen/element/misc_bg/crosshair.vox index 37f0d80d5b..6031040ab2 100644 --- a/assets/voxygen/element/misc_bg/crosshair.vox +++ b/assets/voxygen/element/misc_bg/crosshair.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ebf4d14b5deaf1e4a5645ebe143024522d66991026328400245f7d4f3e07580 -size 5352 +oid sha256:0776f8ad7b9a0f252335c5b75fe08b75a7f39ca5a30571a52bff934e7b83d366 +size 55912 diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index e67a8140c6..1262a16c86 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -49,9 +49,6 @@ image_ids! { chat_arrow_mo: "voxygen/element/buttons/arrow_down_hover.vox", chat_arrow_press: "voxygen/element/buttons/arrow_down_press.vox", - // Crosshair - crosshair: "voxygen/element/misc_bg/crosshair.vox", - //////////////////////////////////////////////////////////////////////// @@ -122,6 +119,9 @@ image_ids! { button_hover: "voxygen/element/buttons/button_hover.vox", button_press: "voxygen/element/buttons/button_press.vox", + // Other + crosshair: "voxygen/element/misc_bg/crosshair.vox", + ////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index a096c61b3d..cc5a55dcef 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -48,6 +48,9 @@ const MANA_COLOR: Color = Color::Rgba(0.42, 0.41, 0.66, 1.0); widget_ids! { struct Ids { + // Crosshair + crosshair, + // Character Names name_tags[], // Health Bars @@ -330,6 +333,13 @@ impl Hud { let mut health_id_walker = self.ids.health_bars.walk(); let mut health_back_id_walker = self.ids.health_bar_backs.walk(); + // Crosshair + Image::new(self.imgs.crosshair) + .w_h(21.0 * 2.0, 21.0 * 2.0) + .middle_of(ui_widgets.window) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 1.0))) + .set(self.ids.crosshair, ui_widgets); + // Render Name Tags for (pos, name) in (&entities, &pos, &stats, player.maybe()) .join()