From 12e7d749eccbe6d60ac1e5c7fdd722cc61f45124 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 02:11:53 +0200 Subject: [PATCH 01/27] added active inventory slots --- voxygen/src/hud/bag.rs | 28 ++++++++++++++++++++-------- voxygen/src/hud/mod.rs | 4 ++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index de3d7a535f..459b9a3959 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -15,12 +15,13 @@ widget_ids! { inv_scrollbar, inv_slot_0, map_title, + inv_slot[], } } #[derive(WidgetCommon)] pub struct Bag<'a> { - inventory_space: u32, + inventory_space: usize, imgs: &'a Imgs, _fonts: &'a Fonts, @@ -29,7 +30,7 @@ pub struct Bag<'a> { } impl<'a> Bag<'a> { - pub fn new(inventory_space: u32, imgs: &'a Imgs, _fonts: &'a Fonts) -> Self { + pub fn new(inventory_space: usize, imgs: &'a Imgs, fonts: &'a Fonts) -> Self { Self { inventory_space, imgs, @@ -91,13 +92,24 @@ impl<'a> Widget for Bag<'a> { .rgba(0.33, 0.33, 0.33, 1.0) .set(state.ids.inv_scrollbar, ui); - if self.inventory_space > 0 { - // First Slot + // Create available inventory slot widgets + + + + dbg!(self.inventory_space); + if state.ids.inv_slot.len() < self.inventory_space { + state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} + for i in 0..self.inventory_space { + let x = i % 5; + let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0, 4.0) - .w_h(10.0 * 4.0, 10.0 * 4.0) - .set(state.ids.inv_slot_0, ui); - } + .top_left_with_margins_on(state.ids.inv_alignment, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .w_h(40.0, 40.0) + .set(state.ids.inv_slot[i], ui); + } + + + // X-button if Button::image(self.imgs.close_button) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index cdc65ea362..e9ecfd80e4 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -256,7 +256,7 @@ pub struct Hud { imgs: Imgs, fonts: Fonts, new_messages: VecDeque, - inventory_space: u32, + inventory_space: usize, show: Show, to_focus: Option>, force_ungrab: bool, @@ -486,7 +486,7 @@ impl Hud { .set(self.ids.bag_space_add, ui_widgets) .was_clicked() { - self.inventory_space += 1; + if self.inventory_space < 91 {self.inventory_space += 10;} else {} }; } From 626978213f7bce32051080de2405e30bfe2865b7 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 02:37:33 +0200 Subject: [PATCH 02/27] fixed scaling of the slots --- voxygen/src/hud/bag.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 459b9a3959..8b8cde8d89 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -91,11 +91,7 @@ impl<'a> Widget for Bag<'a> { .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) .set(state.ids.inv_scrollbar, ui); - - // Create available inventory slot widgets - - - + // Create available inventory slot widgets dbg!(self.inventory_space); if state.ids.inv_slot.len() < self.inventory_space { state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} @@ -103,14 +99,10 @@ impl<'a> Widget for Bag<'a> { let x = i % 5; let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_alignment, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); - } - - - - + } // X-button if Button::image(self.imgs.close_button) .w_h(28.0, 28.0) From f4499e26afffae179b152fbed1e0e3ffe5d966a4 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 03:47:38 +0200 Subject: [PATCH 03/27] added visual test item --- assets/voxygen/element/buttons/grid_inv.vox | 3 +++ assets/voxygen/voxel/object/potion_red.vox | 3 +++ voxygen/src/hud/bag.rs | 28 ++++++++++++++++++--- voxygen/src/hud/img_ids.rs | 5 +++- voxygen/src/hud/mod.rs | 11 ++++---- 5 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 assets/voxygen/element/buttons/grid_inv.vox create mode 100644 assets/voxygen/voxel/object/potion_red.vox diff --git a/assets/voxygen/element/buttons/grid_inv.vox b/assets/voxygen/element/buttons/grid_inv.vox new file mode 100644 index 0000000000..5f079abee8 --- /dev/null +++ b/assets/voxygen/element/buttons/grid_inv.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99d8145adc57abf88b2f14547c70f19c1271783e18c92151f7964e4014ca5ad +size 51813 diff --git a/assets/voxygen/voxel/object/potion_red.vox b/assets/voxygen/voxel/object/potion_red.vox new file mode 100644 index 0000000000..64c36f780c --- /dev/null +++ b/assets/voxygen/voxel/object/potion_red.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d086bb0aada484ba6236f7f767768136ac4ef014cc7081445bc3a19442b6a03e +size 55768 diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 8b8cde8d89..ca74892ff0 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -1,8 +1,9 @@ -use super::{img_ids::Imgs, Fonts}; +use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; use conrod_core::{ color, + position::Relative, widget::{self, Button, Image, Rectangle, Scrollbar}, - widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon, + widget_ids, Labelable, Colorable, Positionable, Sizeable, Widget, WidgetCommon, }; widget_ids! { @@ -16,6 +17,7 @@ widget_ids! { inv_slot_0, map_title, inv_slot[], + item1, } } @@ -99,10 +101,28 @@ impl<'a> Widget for Bag<'a> { let x = i % 5; let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .parent(state.ids.inv_grid_2) .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); - } + } + + // Test Item + + if self.inventory_space > 0 { + Button::image(self.imgs.potion_red) + .w_h(4.0*3.5, 7.0*3.5) + .middle_of(state.ids.inv_slot[0]) + .label("5x") + .label_font_id(self.fonts.opensans) + .label_font_size(12) + .label_x(Relative::Scalar(10.0)) + .label_y(Relative::Scalar(-10.0)) + .label_color(TEXT_COLOR) + .set(state.ids.item1, ui); + + } + // X-button if Button::image(self.imgs.close_button) .w_h(28.0, 28.0) diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index fd335641ea..b46fd96a04 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -8,13 +8,14 @@ image_ids! { bag_contents: "voxygen/element/frames/bag.vox", inv_grid: "voxygen/element/frames/inv_grid.vox", inv_slot: "voxygen/element/buttons/inv_slot.vox", + grid_inv: "voxygen/element/buttons/grid_inv.vox", // Window Parts window_3: "voxygen/element/frames/window_3.vox", tab_bg: "voxygen/element/frames/tab_bg.vox", tab_small_open: "voxygen/element/frames/tab_small_open.vox", tab_small_closed: "voxygen/element/frames/tab_small_closed.vox", - + // MiniMap mmap_frame: "voxygen/element/frames/mmap.vox", mmap_frame_closed: "voxygen/element/frames/mmap_closed.vox", @@ -121,6 +122,8 @@ image_ids! { // Crosshair crosshair: "voxygen/element/misc_bg/crosshair.vox", + // Items + potion_red: "voxygen/voxel/object/potion_red.vox", ////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index e9ecfd80e4..eea9596bc5 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -291,7 +291,7 @@ impl Hud { open_windows: Windows::None, map: false, ui: true, - inventory_test_button: false, + inventory_test_button: true, mini_map: false, settings_tab: SettingsTab::Interface, want_grab: true, @@ -476,13 +476,14 @@ impl Hud { // Add Bag-Space Button. if self.show.inventory_test_button { - if Button::image(self.imgs.grid_button) + if Button::image(self.imgs.button) .w_h(100.0, 100.0) .middle_of(ui_widgets.window) - .label("1 Up!") + .label("Add 10 Spaces") .label_font_size(20) - .hover_image(self.imgs.grid_button_hover) - .press_image(self.imgs.grid_button_press) + .label_color(TEXT_COLOR) + .hover_image(self.imgs.button_hover) + .press_image(self.imgs.button_press) .set(self.ids.bag_space_add, ui_widgets) .was_clicked() { From be64662b1423211fd8d33aa52d96199f77b424e8 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 02:11:53 +0200 Subject: [PATCH 04/27] added active inventory slots --- voxygen/src/hud/bag.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index ca74892ff0..e1e88a02e6 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -109,19 +109,24 @@ impl<'a> Widget for Bag<'a> { // Test Item - if self.inventory_space > 0 { - Button::image(self.imgs.potion_red) - .w_h(4.0*3.5, 7.0*3.5) - .middle_of(state.ids.inv_slot[0]) - .label("5x") - .label_font_id(self.fonts.opensans) - .label_font_size(12) - .label_x(Relative::Scalar(10.0)) - .label_y(Relative::Scalar(-10.0)) - .label_color(TEXT_COLOR) - .set(state.ids.item1, ui); + // Create available inventory slot widgets + + + + dbg!(self.inventory_space); + if state.ids.inv_slot.len() < self.inventory_space { + state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} + for i in 0..self.inventory_space { + let x = i % 5; + let y = i / 5; + Button::image(self.imgs.inv_slot) + .top_left_with_margins_on(state.ids.inv_alignment, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .w_h(40.0, 40.0) + .set(state.ids.inv_slot[i], ui); + } + + - } // X-button if Button::image(self.imgs.close_button) From ff7fb032a4e63ed856503b5a44f49e90b9eb6d75 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 02:37:33 +0200 Subject: [PATCH 05/27] fixed scaling of the slots --- voxygen/src/hud/bag.rs | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index e1e88a02e6..5b29fb5435 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -101,33 +101,10 @@ impl<'a> Widget for Bag<'a> { let x = i % 5; let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) - .parent(state.ids.inv_grid_2) + .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); - } - - // Test Item - - // Create available inventory slot widgets - - - - dbg!(self.inventory_space); - if state.ids.inv_slot.len() < self.inventory_space { - state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} - for i in 0..self.inventory_space { - let x = i % 5; - let y = i / 5; - Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_alignment, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) - .w_h(40.0, 40.0) - .set(state.ids.inv_slot[i], ui); - } - - - - + } // X-button if Button::image(self.imgs.close_button) .w_h(28.0, 28.0) From 3ab01bd86b5966c7dfb67952d91aa4da061a52c3 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 29 Jun 2019 03:47:38 +0200 Subject: [PATCH 06/27] added visual test item --- voxygen/src/hud/bag.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 5b29fb5435..ca74892ff0 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -101,10 +101,28 @@ impl<'a> Widget for Bag<'a> { let x = i % 5; let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) + .parent(state.ids.inv_grid_2) .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); - } + } + + // Test Item + + if self.inventory_space > 0 { + Button::image(self.imgs.potion_red) + .w_h(4.0*3.5, 7.0*3.5) + .middle_of(state.ids.inv_slot[0]) + .label("5x") + .label_font_id(self.fonts.opensans) + .label_font_size(12) + .label_x(Relative::Scalar(10.0)) + .label_y(Relative::Scalar(-10.0)) + .label_color(TEXT_COLOR) + .set(state.ids.item1, ui); + + } + // X-button if Button::image(self.imgs.close_button) .w_h(28.0, 28.0) From 03894cb2ab002d424aa692be387eff02e1ce81b9 Mon Sep 17 00:00:00 2001 From: Pfauenauge Date: Sat, 29 Jun 2019 15:02:27 +0200 Subject: [PATCH 07/27] Comments on example item, removed printing of available inventory space No. --- voxygen/src/hud/bag.rs | 25 +++++++++++-------------- voxygen/src/hud/img_ids.rs | 2 +- voxygen/src/hud/mod.rs | 7 +++++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index ca74892ff0..eff8a8cc89 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -3,7 +3,7 @@ use conrod_core::{ color, position::Relative, widget::{self, Button, Image, Rectangle, Scrollbar}, - widget_ids, Labelable, Colorable, Positionable, Sizeable, Widget, WidgetCommon, + widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; widget_ids! { @@ -93,36 +93,33 @@ impl<'a> Widget for Bag<'a> { .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) .set(state.ids.inv_scrollbar, ui); - // Create available inventory slot widgets - dbg!(self.inventory_space); - if state.ids.inv_slot.len() < self.inventory_space { + // Create available inventory slot widgets + if state.ids.inv_slot.len() < self.inventory_space { state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} + // "Allowed" max. inventory space should be handled serverside and thus isn't limited in the UI for i in 0..self.inventory_space { let x = i % 5; let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) - .parent(state.ids.inv_grid_2) + .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) // conrod uses a (y,x) format for placing... + .parent(state.ids.inv_grid_2) // Avoids the background overlapping available slots .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); } - // Test Item - if self.inventory_space > 0 { - Button::image(self.imgs.potion_red) - .w_h(4.0*3.5, 7.0*3.5) - .middle_of(state.ids.inv_slot[0]) - .label("5x") + Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot + .w_h(4.0*3.5, 7.0*3.5) // TODO: height value has to be constant(but not the same as the slot widget), while width depends on the image displayed to avoid stretching + .middle_of(state.ids.inv_slot[0]) // TODO: Items need to be assigned to a certain slot and then placed like in this example + .label("5x") // TODO: Quantity goes here... .label_font_id(self.fonts.opensans) .label_font_size(12) .label_x(Relative::Scalar(10.0)) .label_y(Relative::Scalar(-10.0)) .label_color(TEXT_COLOR) - .set(state.ids.item1, ui); + .set(state.ids.item1, ui); // TODO: Add widget_id generator for displayed items } - // X-button if Button::image(self.imgs.close_button) .w_h(28.0, 28.0) diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index b46fd96a04..4d58be0e1c 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -15,7 +15,7 @@ image_ids! { tab_bg: "voxygen/element/frames/tab_bg.vox", tab_small_open: "voxygen/element/frames/tab_small_open.vox", tab_small_closed: "voxygen/element/frames/tab_small_closed.vox", - + // MiniMap mmap_frame: "voxygen/element/frames/mmap.vox", mmap_frame_closed: "voxygen/element/frames/mmap_closed.vox", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index eea9596bc5..d861545173 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -481,13 +481,16 @@ impl Hud { .middle_of(ui_widgets.window) .label("Add 10 Spaces") .label_font_size(20) - .label_color(TEXT_COLOR) + .label_color(TEXT_COLOR) .hover_image(self.imgs.button_hover) .press_image(self.imgs.button_press) .set(self.ids.bag_space_add, ui_widgets) .was_clicked() { - if self.inventory_space < 91 {self.inventory_space += 10;} else {} + if self.inventory_space < 91 { + self.inventory_space += 10; + } else { + } }; } From 991e4b15e5f2fcdf7cefcd60e24ed9b7696054bc Mon Sep 17 00:00:00 2001 From: Pfauenauge Date: Sat, 29 Jun 2019 15:03:48 +0200 Subject: [PATCH 08/27] fmt --- voxygen/src/hud/bag.rs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index eff8a8cc89..488e1abd5f 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -93,32 +93,40 @@ impl<'a> Widget for Bag<'a> { .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) .set(state.ids.inv_scrollbar, ui); - // Create available inventory slot widgets + // Create available inventory slot widgets if state.ids.inv_slot.len() < self.inventory_space { - state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});} + state.update(|s| { + s.ids + .inv_slot + .resize(self.inventory_space, &mut ui.widget_id_generator()); + }); + } // "Allowed" max. inventory space should be handled serverside and thus isn't limited in the UI for i in 0..self.inventory_space { let x = i % 5; - let y = i / 5; + let y = i / 5; Button::image(self.imgs.inv_slot) - .top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) // conrod uses a (y,x) format for placing... + .top_left_with_margins_on( + state.ids.inv_grid_1, + 4.0 + y as f64 * (40.0 + 4.0), + 4.0 + x as f64 * (40.0 + 4.0), + ) // conrod uses a (y,x) format for placing... .parent(state.ids.inv_grid_2) // Avoids the background overlapping available slots - .w_h(40.0, 40.0) + .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); - } + } // Test Item if self.inventory_space > 0 { - Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot - .w_h(4.0*3.5, 7.0*3.5) // TODO: height value has to be constant(but not the same as the slot widget), while width depends on the image displayed to avoid stretching + Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot + .w_h(4.0 * 3.5, 7.0 * 3.5) // TODO: height value has to be constant(but not the same as the slot widget), while width depends on the image displayed to avoid stretching .middle_of(state.ids.inv_slot[0]) // TODO: Items need to be assigned to a certain slot and then placed like in this example .label("5x") // TODO: Quantity goes here... .label_font_id(self.fonts.opensans) .label_font_size(12) - .label_x(Relative::Scalar(10.0)) + .label_x(Relative::Scalar(10.0)) .label_y(Relative::Scalar(-10.0)) - .label_color(TEXT_COLOR) + .label_color(TEXT_COLOR) .set(state.ids.item1, ui); // TODO: Add widget_id generator for displayed items - } // X-button if Button::image(self.imgs.close_button) From e66419b39688d9b1422f83da874e964009792b0a Mon Sep 17 00:00:00 2001 From: Pfauenauge Date: Sat, 29 Jun 2019 19:30:06 +0200 Subject: [PATCH 09/27] smaller border for available slots, item image size changed --- assets/voxygen/element/buttons/inv_slot.vox | 4 ++-- voxygen/src/hud/bag.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/voxygen/element/buttons/inv_slot.vox b/assets/voxygen/element/buttons/inv_slot.vox index c04bbb1aa5..0ba79c16d2 100644 --- a/assets/voxygen/element/buttons/inv_slot.vox +++ b/assets/voxygen/element/buttons/inv_slot.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:617ccb0eb3fa50ec8359687720c86757bccaecd635e7af2cfad7ebea3b6ecc5f -size 44715 +oid sha256:69d4eb3b262de7ce2280d6a648ddb0e461e513b6c4e74bbff8bc8ede51e73532 +size 46011 diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 488e1abd5f..8918ba7cf5 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -118,7 +118,7 @@ impl<'a> Widget for Bag<'a> { // Test Item if self.inventory_space > 0 { Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot - .w_h(4.0 * 3.5, 7.0 * 3.5) // TODO: height value has to be constant(but not the same as the slot widget), while width depends on the image displayed to avoid stretching + .w_h(4.0 * 4.5, 7.0*4.5) // TODO: Fix height and scale width correctly to that to avoid a stretched item image .middle_of(state.ids.inv_slot[0]) // TODO: Items need to be assigned to a certain slot and then placed like in this example .label("5x") // TODO: Quantity goes here... .label_font_id(self.fonts.opensans) From 381b9cabd123f72102fab569bc975f6493eb9707 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 30 Jun 2019 11:12:14 +0200 Subject: [PATCH 10/27] fmt --- voxygen/src/hud/bag.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 8918ba7cf5..33053eef95 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -118,7 +118,7 @@ impl<'a> Widget for Bag<'a> { // Test Item if self.inventory_space > 0 { Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot - .w_h(4.0 * 4.5, 7.0*4.5) // TODO: Fix height and scale width correctly to that to avoid a stretched item image + .w_h(4.0 * 4.5, 7.0 * 4.5) // TODO: Fix height and scale width correctly to that to avoid a stretched item image .middle_of(state.ids.inv_slot[0]) // TODO: Items need to be assigned to a certain slot and then placed like in this example .label("5x") // TODO: Quantity goes here... .label_font_id(self.fonts.opensans) From b99bd4a20a14c68b01d94a824a8353a4ff41b40c Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 30 Jun 2019 16:04:10 +0200 Subject: [PATCH 11/27] Bag window expands with available space --- assets/voxygen/element/bag/bot.vox | 3 ++ assets/voxygen/element/bag/mid.vox | 3 ++ assets/voxygen/element/bag/slot.vox | 3 ++ assets/voxygen/element/bag/top.vox | 3 ++ assets/voxygen/element/frames/bag.vox | 4 +-- voxygen/src/hud/bag.rs | 52 +++++++++++++++++---------- voxygen/src/hud/img_ids.rs | 3 ++ voxygen/src/hud/mod.rs | 10 +++--- 8 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 assets/voxygen/element/bag/bot.vox create mode 100644 assets/voxygen/element/bag/mid.vox create mode 100644 assets/voxygen/element/bag/slot.vox create mode 100644 assets/voxygen/element/bag/top.vox diff --git a/assets/voxygen/element/bag/bot.vox b/assets/voxygen/element/bag/bot.vox new file mode 100644 index 0000000000..248f64cc5e --- /dev/null +++ b/assets/voxygen/element/bag/bot.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4da5d98046938e91d1815dbf259cb731d8cd4624c640f8b5924f6ce66f3c8628 +size 45431 diff --git a/assets/voxygen/element/bag/mid.vox b/assets/voxygen/element/bag/mid.vox new file mode 100644 index 0000000000..1af84e92dc --- /dev/null +++ b/assets/voxygen/element/bag/mid.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1615848364014e02460eab55c0a8ae722eee7eef8bea50f1b5247560a3d72d6 +size 44440 diff --git a/assets/voxygen/element/bag/slot.vox b/assets/voxygen/element/bag/slot.vox new file mode 100644 index 0000000000..0ba79c16d2 --- /dev/null +++ b/assets/voxygen/element/bag/slot.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69d4eb3b262de7ce2280d6a648ddb0e461e513b6c4e74bbff8bc8ede51e73532 +size 46011 diff --git a/assets/voxygen/element/bag/top.vox b/assets/voxygen/element/bag/top.vox new file mode 100644 index 0000000000..d705fe1edb --- /dev/null +++ b/assets/voxygen/element/bag/top.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cac63f9ad0530286bd4ec3b748cad6106c6e1f3d5748e86cf4f0699f38bb84a4 +size 47687 diff --git a/assets/voxygen/element/frames/bag.vox b/assets/voxygen/element/frames/bag.vox index 6ef0a91209..524db58df9 100644 --- a/assets/voxygen/element/frames/bag.vox +++ b/assets/voxygen/element/frames/bag.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f19f876fdee1708407c7d39e213cc5e4c8db5817607149a6e4756c1f00f9539 -size 42344 +oid sha256:9976b08c1b352ceae1770b37bf58c9b803420311839b0fa3b8077f9bc4351afb +size 103536 diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 33053eef95..d5f14adcdb 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -3,13 +3,15 @@ use conrod_core::{ color, position::Relative, widget::{self, Button, Image, Rectangle, Scrollbar}, - widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, + widget_ids, Colorable, Color, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; widget_ids! { struct Ids { bag_close, - bag_contents, + bag_top, + bag_mid, + bag_bot, inv_alignment, inv_grid_1, inv_grid_2, @@ -34,7 +36,7 @@ pub struct Bag<'a> { impl<'a> Bag<'a> { pub fn new(inventory_space: usize, imgs: &'a Imgs, fonts: &'a Fonts) -> Self { Self { - inventory_space, + inventory_space, imgs, _fonts, common: widget::CommonBuilder::default(), @@ -46,6 +48,8 @@ pub struct State { ids: Ids, } +const BAG_SCALE: f64 = 4.0; + pub enum Event { Close, } @@ -68,31 +72,43 @@ impl<'a> Widget for Bag<'a> { fn update(self, args: widget::UpdateArgs) -> Self::Event { let widget::UpdateArgs { state, ui, .. } = args; - // Contents - Image::new(self.imgs.bag_contents) - .w_h(68.0 * 4.0, 123.0 * 4.0) + // Bag parts + Image::new(self.imgs.bag_bot) + .w_h(61.0 * BAG_SCALE, 9.0 * BAG_SCALE) .bottom_right_with_margins_on(ui.window, 60.0, 5.0) - .set(state.ids.bag_contents, ui); + .set(state.ids.bag_bot, ui); + Image::new(self.imgs.bag_mid) + .w_h(61.0 * BAG_SCALE, ((self.inventory_space + 4) / 5) as f64 * 44.0) + .up_from(state.ids.bag_bot, 0.0) + .set(state.ids.bag_mid, ui); + Image::new(self.imgs.bag_top) + .w_h(61.0 * BAG_SCALE, 9.0 * BAG_SCALE) + .up_from(state.ids.bag_mid, 0.0) + .set(state.ids.bag_top, ui); // Alignment for Grid - Rectangle::fill_with([58.0 * 4.0 - 5.0, 100.0 * 4.0], color::TRANSPARENT) - .top_left_with_margins_on(state.ids.bag_contents, 11.0 * 4.0, 5.0 * 4.0) + Rectangle::fill_with([54.0 * BAG_SCALE, ((self.inventory_space + 4) / 5) as f64 * 44.0], color::TRANSPARENT) + .top_left_with_margins_on(state.ids.bag_top, 9.0 * BAG_SCALE, 3.0 * BAG_SCALE) .scroll_kids() .scroll_kids_vertically() .set(state.ids.inv_alignment, ui); + + // Grid - Image::new(self.imgs.inv_grid) - .w_h(58.0 * 4.0, 111.0 * 4.0) + /*Image::new(self.imgs.inv_grid) + .w_h(61.0 * BAG_SCALE, 111.0 * BAG_SCALE) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.5))) .mid_top_with_margin_on(state.ids.inv_alignment, 0.0) .set(state.ids.inv_grid_1, ui); Image::new(self.imgs.inv_grid) - .w_h(58.0 * 4.0, 111.0 * 4.0) - .mid_top_with_margin_on(state.ids.inv_alignment, 110.0 * 4.0) + .w_h(61.0 * BAG_SCALE, 111.0 * BAG_SCALE) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.5))) + .mid_top_with_margin_on(state.ids.inv_alignment, 110.0 * BAG_SCALE) .set(state.ids.inv_grid_2, ui); Scrollbar::y_axis(state.ids.inv_alignment) .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) - .set(state.ids.inv_scrollbar, ui); + .set(state.ids.inv_scrollbar, ui);*/ // Create available inventory slot widgets if state.ids.inv_slot.len() < self.inventory_space { state.update(|s| { @@ -107,18 +123,18 @@ impl<'a> Widget for Bag<'a> { let y = i / 5; Button::image(self.imgs.inv_slot) .top_left_with_margins_on( - state.ids.inv_grid_1, + state.ids.inv_alignment, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0), ) // conrod uses a (y,x) format for placing... - .parent(state.ids.inv_grid_2) // Avoids the background overlapping available slots + .parent(state.ids.bag_mid) // Avoids the background overlapping available slots .w_h(40.0, 40.0) .set(state.ids.inv_slot[i], ui); } // Test Item if self.inventory_space > 0 { Button::image(self.imgs.potion_red) // TODO: Insert variable image depending on the item displayed in that slot - .w_h(4.0 * 4.5, 7.0 * 4.5) // TODO: Fix height and scale width correctly to that to avoid a stretched item image + .w_h(4.0 * 4.4, 7.0 * 4.4) // TODO: Fix height and scale width correctly to that to avoid a stretched item image .middle_of(state.ids.inv_slot[0]) // TODO: Items need to be assigned to a certain slot and then placed like in this example .label("5x") // TODO: Quantity goes here... .label_font_id(self.fonts.opensans) @@ -133,7 +149,7 @@ impl<'a> Widget for Bag<'a> { .w_h(28.0, 28.0) .hover_image(self.imgs.close_button_hover) .press_image(self.imgs.close_button_press) - .top_right_with_margins_on(state.ids.bag_contents, 0.0, 0.0) + .top_right_with_margins_on(state.ids.bag_top, 0.0, 0.0) .set(state.ids.bag_close, ui) .was_clicked() { diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 4d58be0e1c..8e5550a922 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -9,6 +9,9 @@ image_ids! { inv_grid: "voxygen/element/frames/inv_grid.vox", inv_slot: "voxygen/element/buttons/inv_slot.vox", grid_inv: "voxygen/element/buttons/grid_inv.vox", + bag_top: "voxygen/element/bag/top.vox", + bag_mid: "voxygen/element/bag/mid.vox", + bag_bot: "voxygen/element/bag/bot.vox", // Window Parts window_3: "voxygen/element/frames/window_3.vox", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index d861545173..241c2e666f 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -256,7 +256,7 @@ pub struct Hud { imgs: Imgs, fonts: Fonts, new_messages: VecDeque, - inventory_space: usize, + inventory_space: usize, show: Show, to_focus: Option>, force_ungrab: bool, @@ -282,7 +282,7 @@ impl Hud { fonts, ids, new_messages: VecDeque::new(), - inventory_space: 0, + inventory_space: 8, show: Show { help: false, debug: true, @@ -479,7 +479,7 @@ impl Hud { if Button::image(self.imgs.button) .w_h(100.0, 100.0) .middle_of(ui_widgets.window) - .label("Add 10 Spaces") + .label("Add 1 Space") .label_font_size(20) .label_color(TEXT_COLOR) .hover_image(self.imgs.button_hover) @@ -487,8 +487,8 @@ impl Hud { .set(self.ids.bag_space_add, ui_widgets) .was_clicked() { - if self.inventory_space < 91 { - self.inventory_space += 10; + if self.inventory_space < 100 { + self.inventory_space += 1; } else { } }; From 50e15333cdcf07588941a405f5c38cf28398c305 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 30 Jun 2019 20:12:53 +0200 Subject: [PATCH 12/27] set the inventory space test button to false by default and increased the starting inventory size to 10 --- voxygen/src/hud/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 241c2e666f..30b366bee5 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -282,7 +282,7 @@ impl Hud { fonts, ids, new_messages: VecDeque::new(), - inventory_space: 8, + inventory_space: 10, show: Show { help: false, debug: true, @@ -291,7 +291,7 @@ impl Hud { open_windows: Windows::None, map: false, ui: true, - inventory_test_button: true, + inventory_test_button: false, mini_map: false, settings_tab: SettingsTab::Interface, want_grab: true, From 89cadf27be93a0a3bc1d3e5cf393a7b031d918c0 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Thu, 4 Jul 2019 22:55:23 +0200 Subject: [PATCH 13/27] fix fonts --- voxygen/src/hud/bag.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index d5f14adcdb..06b759ed8e 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -28,7 +28,7 @@ pub struct Bag<'a> { inventory_space: usize, imgs: &'a Imgs, - _fonts: &'a Fonts, + fonts: &'a Fonts, #[conrod(common_builder)] common: widget::CommonBuilder, } @@ -38,7 +38,7 @@ impl<'a> Bag<'a> { Self { inventory_space, imgs, - _fonts, + fonts, common: widget::CommonBuilder::default(), } } From 74551551986b140b63a8b33360f29f76aa93108c Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Fri, 5 Jul 2019 00:01:20 +0200 Subject: [PATCH 14/27] more test items --- assets/voxygen/voxel/object/key.vox | 3 +++ assets/voxygen/voxel/object/key_gold.vox | 3 +++ assets/voxygen/voxel/object/potion_blue.vox | 3 +++ assets/voxygen/voxel/object/potion_green.vox | 3 +++ voxygen/src/hud/img_ids.rs | 5 ++++- 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 assets/voxygen/voxel/object/key.vox create mode 100644 assets/voxygen/voxel/object/key_gold.vox create mode 100644 assets/voxygen/voxel/object/potion_blue.vox create mode 100644 assets/voxygen/voxel/object/potion_green.vox diff --git a/assets/voxygen/voxel/object/key.vox b/assets/voxygen/voxel/object/key.vox new file mode 100644 index 0000000000..3f34358f32 --- /dev/null +++ b/assets/voxygen/voxel/object/key.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4592865022662696d7698c7c40d991eb18cb97660dcd36a291f57be1bb28828 +size 45239 diff --git a/assets/voxygen/voxel/object/key_gold.vox b/assets/voxygen/voxel/object/key_gold.vox new file mode 100644 index 0000000000..ec96f40a16 --- /dev/null +++ b/assets/voxygen/voxel/object/key_gold.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1990da07d4666119dc68e7e9ef690a776fd06352db2803710416a928de2e048c +size 45239 diff --git a/assets/voxygen/voxel/object/potion_blue.vox b/assets/voxygen/voxel/object/potion_blue.vox new file mode 100644 index 0000000000..0d896db3f6 --- /dev/null +++ b/assets/voxygen/voxel/object/potion_blue.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5153dcd60bf16898964759a7344728dc1e4a07f437a2b5b76c6ddcb366119fbd +size 44447 diff --git a/assets/voxygen/voxel/object/potion_green.vox b/assets/voxygen/voxel/object/potion_green.vox new file mode 100644 index 0000000000..4fe10a451b --- /dev/null +++ b/assets/voxygen/voxel/object/potion_green.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2925a582f0ce3d2bfdd26f5591cf4d652aac0b558ee16067d9272a6710e2bf78 +size 44447 diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 8e5550a922..82b6222b52 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -127,7 +127,10 @@ image_ids! { crosshair: "voxygen/element/misc_bg/crosshair.vox", // Items potion_red: "voxygen/voxel/object/potion_red.vox", - + potion_green: "voxygen/voxel/object/potion_green.vox", + potion_blue: "voxygen/voxel/object/potion_blue.vox", + key: "voxygen/voxel/object/key.vox", + key_gold: "voxygen/voxel/object/key_gold.vox", ////////////////////////////////////////////////////////////////////////////////////////////////////// From d186c4031eb37aaa0b36215421f87a9b4571eb66 Mon Sep 17 00:00:00 2001 From: Pfauenauge Date: Fri, 5 Jul 2019 15:39:28 +0200 Subject: [PATCH 15/27] Sharp crosshair (no multisampling) --- voxygen/src/hud/img_ids.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 82b6222b52..3beaca6409 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -53,6 +53,9 @@ 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", + //////////////////////////////////////////////////////////////////////// @@ -123,8 +126,6 @@ image_ids! { button_hover: "voxygen/element/buttons/button_hover.vox", button_press: "voxygen/element/buttons/button_press.vox", - // Crosshair - crosshair: "voxygen/element/misc_bg/crosshair.vox", // Items potion_red: "voxygen/voxel/object/potion_red.vox", potion_green: "voxygen/voxel/object/potion_green.vox", From bd94baa12506f1cb271c014d608614ea6e8b467b Mon Sep 17 00:00:00 2001 From: Pfauenauge Date: Fri, 5 Jul 2019 17:08:43 +0200 Subject: [PATCH 16/27] Added crosshair TODO --- voxygen/src/hud/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 30b366bee5..563568b99a 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -344,6 +344,10 @@ impl Hud { .middle_of(ui_widgets.window) .color(Some(Color::Rgba(1.0, 1.0, 1.0, 1.0))) .set(self.ids.crosshair, ui_widgets); + /* TODO: + 95% translucency outside of combat + When having a distance weapon as your active weapon/being in build mode -> adjust the camera to an over the shoulder (overhead?!) perspective to avoid the character blocking the view + Crosshair should be completely invisible when the player doesn't have a ranged weapon (equipped as the primary weapon in the char window) or is in build mode*/ // Render Name Tags for (pos, name) in (&entities, &pos, &stats, player.maybe()) From d4a6f0c202a6ca9faeae926c13626f347b234e56 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 6 Jul 2019 19:00:05 +0200 Subject: [PATCH 17/27] camera changes and nametag colour --- voxygen/src/hud/mod.rs | 12 ++++-------- voxygen/src/scene/mod.rs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 563568b99a..9ce0f7e798 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -256,7 +256,7 @@ pub struct Hud { imgs: Imgs, fonts: Fonts, new_messages: VecDeque, - inventory_space: usize, + inventory_space: usize, show: Show, to_focus: Option>, force_ungrab: bool, @@ -282,7 +282,7 @@ impl Hud { fonts, ids, new_messages: VecDeque::new(), - inventory_space: 10, + inventory_space: 8, show: Show { help: false, debug: true, @@ -342,12 +342,8 @@ impl Hud { 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))) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1))) .set(self.ids.crosshair, ui_widgets); - /* TODO: - 95% translucency outside of combat - When having a distance weapon as your active weapon/being in build mode -> adjust the camera to an over the shoulder (overhead?!) perspective to avoid the character blocking the view - Crosshair should be completely invisible when the player doesn't have a ranged weapon (equipped as the primary weapon in the char window) or is in build mode*/ // Render Name Tags for (pos, name) in (&entities, &pos, &stats, player.maybe()) @@ -377,7 +373,7 @@ impl Hud { ); Text::new(&name) .font_size(20) - .color(Color::Rgba(1.0, 1.0, 1.0, 1.0)) + .color(Color::Rgba(0.33, 0.69, 0.65, 1.0)) .x_y(0.0, 0.0) .position_ingame(pos + Vec3::new(0.0, 0.0, 3.0)) .resolution(100.0) diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index 548bdc5804..d45f8a5aa1 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -118,7 +118,7 @@ impl Scene { let tilt = self.camera.get_orientation().y; let dist = self.camera.get_distance(); self.camera - .set_focus_pos(player_pos + Vec3::unit_z() * (1.95 - tilt.min(0.0) * dist * 0.75)); + .set_focus_pos(player_pos + Vec3::unit_z() * (2.3 - tilt.min(0.0) * dist * 0.75)); // Tick camera for interpolation. self.camera.update(client.state().get_time()); From de1cf1371cc63c3058bfe941aae52df7d332212e Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sat, 6 Jul 2019 19:29:44 +0200 Subject: [PATCH 18/27] colour and camera corrections --- voxygen/src/hud/mod.rs | 2 +- voxygen/src/scene/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 9ce0f7e798..6ca538e98f 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -373,7 +373,7 @@ impl Hud { ); Text::new(&name) .font_size(20) - .color(Color::Rgba(0.33, 0.69, 0.65, 1.0)) + .color(Color::Rgba(0.61, 0.61, 0.89, 1.0)) .x_y(0.0, 0.0) .position_ingame(pos + Vec3::new(0.0, 0.0, 3.0)) .resolution(100.0) diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index d45f8a5aa1..04c1d1cc25 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -118,7 +118,7 @@ impl Scene { let tilt = self.camera.get_orientation().y; let dist = self.camera.get_distance(); self.camera - .set_focus_pos(player_pos + Vec3::unit_z() * (2.3 - tilt.min(0.0) * dist * 0.75)); + .set_focus_pos(player_pos + Vec3::unit_z() * (3.0 - tilt.min(0.0) * dist * 0.75)); // Tick camera for interpolation. self.camera.update(client.state().get_time()); From 3be29510291516a70665e2bf1ab6e70446f241e9 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 01:04:30 +0200 Subject: [PATCH 19/27] crosshair correction --- .../voxygen/element/misc_bg/crosshair_inner.vox | 3 +++ .../voxygen/element/misc_bg/crosshair_outer.vox | 3 +++ voxygen/src/hud/img_ids.rs | 4 ++++ voxygen/src/hud/mod.rs | 16 +++++++++++----- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 assets/voxygen/element/misc_bg/crosshair_inner.vox create mode 100644 assets/voxygen/element/misc_bg/crosshair_outer.vox diff --git a/assets/voxygen/element/misc_bg/crosshair_inner.vox b/assets/voxygen/element/misc_bg/crosshair_inner.vox new file mode 100644 index 0000000000..e7910ebdc1 --- /dev/null +++ b/assets/voxygen/element/misc_bg/crosshair_inner.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebd152f729ba3dd3eb971482a78b9527c4c8ed32888ad64d469021bafa4780a5 +size 1116 diff --git a/assets/voxygen/element/misc_bg/crosshair_outer.vox b/assets/voxygen/element/misc_bg/crosshair_outer.vox new file mode 100644 index 0000000000..8bf3d60dc2 --- /dev/null +++ b/assets/voxygen/element/misc_bg/crosshair_outer.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5151fb769cfac65218cc64f3a366b65016a7894270753dc58b12fe2a2981dda +size 1464 diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 3beaca6409..14abc02cae 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -55,10 +55,14 @@ image_ids! { // Crosshair crosshair: "voxygen/element/misc_bg/crosshair.vox", + //crosshair_outer: "voxygen/element/misc_bg/crosshair_outer.vox", + crosshair_inner: "voxygen/element/misc_bg/crosshair_inner.vox", //////////////////////////////////////////////////////////////////////// + crosshair_outer: "voxygen/element/misc_bg/crosshair_outer.vox", + // Buttons mmap_closed: "voxygen/element/buttons/button_mmap_closed.vox", mmap_closed_hover: "voxygen/element/buttons/button_mmap_closed_hover.vox", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 6ca538e98f..d5c784ddc6 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -50,7 +50,8 @@ const MANA_COLOR: Color = Color::Rgba(0.42, 0.41, 0.66, 1.0); widget_ids! { struct Ids { // Crosshair - crosshair, + crosshair_inner, + crosshair_outer, // Character Names name_tags[], @@ -339,11 +340,16 @@ impl Hud { 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) + Image::new(self.imgs.crosshair_outer) + .w_h(21.0 * 1.5, 21.0 * 1.5) .middle_of(ui_widgets.window) - .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1))) - .set(self.ids.crosshair, ui_widgets); + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.2))) + .set(self.ids.crosshair_outer, ui_widgets); + Image::new(self.imgs.crosshair_inner) + .w_h(21.0 * 2.0, 21.0 * 2.0) + .middle_of(self.ids.crosshair_outer) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.6))) + .set(self.ids.crosshair_inner, ui_widgets); // Render Name Tags for (pos, name) in (&entities, &pos, &stats, player.maybe()) From 94acd0f43748091d44a7a1d08c8f2d2393d5acb0 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 02:15:22 +0200 Subject: [PATCH 20/27] Crosshair transp slider --- voxygen/src/hud/mod.rs | 10 +++++++- voxygen/src/hud/settings_window.rs | 38 ++++++++++++++++++++++++++++++ voxygen/src/session.rs | 7 ++++++ voxygen/src/settings.rs | 2 ++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index d5c784ddc6..2ddf3aebb4 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -10,6 +10,7 @@ mod settings_window; mod skillbar; mod small_window; +use crate::hud::Event::CrosshairTransp; use bag::Bag; use buttons::Buttons; use character_window::CharacterWindow; @@ -122,6 +123,7 @@ pub enum Event { AdjustVolume(f32), ChangeAudioDevice(String), ChangeMaxFPS(u32), + CrosshairTransp(f32), CharacterSelection, Logout, Quit, @@ -258,6 +260,7 @@ pub struct Hud { fonts: Fonts, new_messages: VecDeque, inventory_space: usize, + crosshair_transp: f32, show: Show, to_focus: Option>, force_ungrab: bool, @@ -284,6 +287,7 @@ impl Hud { ids, new_messages: VecDeque::new(), inventory_space: 8, + crosshair_transp: 0.6, show: Show { help: false, debug: true, @@ -340,10 +344,11 @@ impl Hud { let mut health_back_id_walker = self.ids.health_bar_backs.walk(); // Crosshair + let crosshair_transp = self.crosshair_transp; Image::new(self.imgs.crosshair_outer) .w_h(21.0 * 1.5, 21.0 * 1.5) .middle_of(ui_widgets.window) - .color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.2))) + .color(Some(Color::Rgba(1.0, 1.0, 1.0, self.crosshair_transp))) .set(self.ids.crosshair_outer, ui_widgets); Image::new(self.imgs.crosshair_inner) .w_h(21.0 * 2.0, 21.0 * 2.0) @@ -624,6 +629,9 @@ impl Hud { settings_window::Event::AdjustViewDistance(view_distance) => { events.push(Event::AdjustViewDistance(view_distance)); } + settings_window::Event::CrosshairTransp(crosshair_transp) => { + events.push(Event::CrosshairTransp(crosshair_transp)); + } settings_window::Event::AdjustVolume(volume) => { events.push(Event::AdjustVolume(volume)); } diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 47a5ae0dfd..236f740616 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -42,6 +42,10 @@ widget_ids! { mouse_zoom_slider, mouse_zoom_label, mouse_zoom_value, + ch_transp_slider, + ch_transp_label, + ch_transp_value, + ch_transp_text, settings_bg, sound, test, @@ -113,6 +117,7 @@ pub enum Event { AdjustVolume(f32), ChangeAudioDevice(String), MaximumFPS(u32), + CrosshairTransp(f32), } impl<'a> Widget for SettingsWindow<'a> { @@ -305,6 +310,7 @@ impl<'a> Widget for SettingsWindow<'a> { if let SettingsTab::Gameplay = self.show.settings_tab { let display_pan = self.global_state.settings.gameplay.pan_sensitivity; let display_zoom = self.global_state.settings.gameplay.zoom_sensitivity; + let crosshair_transp = self.global_state.settings.gameplay.crosshair_transp; // Mouse Pan Sensitivity Text::new("Pan Sensitivity") @@ -369,6 +375,38 @@ impl<'a> Widget for SettingsWindow<'a> { .font_id(self.fonts.opensans) .color(TEXT_COLOR) .set(state.ids.mouse_zoom_value, ui); + + // Crosshair Translucency + Text::new("Crosshair Transparency") + .down_from(state.ids.mouse_zoom_slider, 10.0) + .font_size(14) + .font_id(self.fonts.opensans) + .color(TEXT_COLOR) + .set(state.ids.ch_transp_text, ui); + + if let Some(new_val) = ImageSlider::continuous( + crosshair_transp, + 0.0, + 1.0, + self.imgs.slider_indicator, + self.imgs.slider, + ) + .w_h(104.0, 22.0) + .down_from(state.ids.ch_transp_text, 8.0) + .track_breadth(12.0) + .slider_length(10.0) + .pad_track((5.0, 5.0)) + .set(state.ids.ch_transp_slider, ui) + { + events.push(Event::CrosshairTransp(new_val)); + } + + Text::new(&format!("{}", crosshair_transp,)) + .right_from(state.ids.ch_transp_slider, 8.0) + .font_size(14) + .font_id(self.fonts.opensans) + .color(TEXT_COLOR) + .set(state.ids.ch_transp_value, ui); } // 3) Controls Tab -------------------------------- diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index a0b756cd2d..660463fa12 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -282,6 +282,13 @@ impl PlayState for SessionState { warn!("Failed to save settings: {:?}", err); } } + HudEvent::CrosshairTransp(crosshair_transp) => { + global_state.settings.gameplay.crosshair_transp = crosshair_transp; + global_state.settings.gameplay.crosshair_transp = crosshair_transp; + if let Err(err) = global_state.settings.save_to_file() { + warn!("Failed to save settings: {:?}", err); + } + } HudEvent::AdjustVolume(volume) => { global_state.audio.model.player.set_volume(volume); diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index a37864efef..3b5e5fdd85 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -75,6 +75,7 @@ impl Default for ControlSettings { pub struct GameplaySettings { pub pan_sensitivity: u32, pub zoom_sensitivity: u32, + pub crosshair_transp: f32, } impl Default for GameplaySettings { @@ -82,6 +83,7 @@ impl Default for GameplaySettings { Self { pan_sensitivity: 100, zoom_sensitivity: 100, + crosshair_transp: 0.6, } } } From ff6d7206a359055f64082ccee169572314b7c401 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 02:27:38 +0200 Subject: [PATCH 21/27] fix --- voxygen/src/hud/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 2ddf3aebb4..3002281939 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -260,7 +260,6 @@ pub struct Hud { fonts: Fonts, new_messages: VecDeque, inventory_space: usize, - crosshair_transp: f32, show: Show, to_focus: Option>, force_ungrab: bool, @@ -287,7 +286,6 @@ impl Hud { ids, new_messages: VecDeque::new(), inventory_space: 8, - crosshair_transp: 0.6, show: Show { help: false, debug: true, @@ -344,11 +342,15 @@ impl Hud { let mut health_back_id_walker = self.ids.health_bar_backs.walk(); // Crosshair - let crosshair_transp = self.crosshair_transp; Image::new(self.imgs.crosshair_outer) .w_h(21.0 * 1.5, 21.0 * 1.5) .middle_of(ui_widgets.window) - .color(Some(Color::Rgba(1.0, 1.0, 1.0, self.crosshair_transp))) + .color(Some(Color::Rgba( + 1.0, + 1.0, + 1.0, + global_state.settings.gameplay.crosshair_transp, + ))) .set(self.ids.crosshair_outer, ui_widgets); Image::new(self.imgs.crosshair_inner) .w_h(21.0 * 2.0, 21.0 * 2.0) From c27d55db6ca971a8a6562e13aa16b798f28c9803 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 02:34:17 +0200 Subject: [PATCH 22/27] less numbers for the indicator text --- voxygen/src/hud/settings_window.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 236f740616..cd622cba44 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -401,7 +401,7 @@ impl<'a> Widget for SettingsWindow<'a> { events.push(Event::CrosshairTransp(new_val)); } - Text::new(&format!("{}", crosshair_transp,)) + Text::new(&format!("{:.2}", crosshair_transp,)) .right_from(state.ids.ch_transp_slider, 8.0) .font_size(14) .font_id(self.fonts.opensans) From 70f8fe90021b90fa1603a087dd2c849f7ed4cda1 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 15:29:37 +0200 Subject: [PATCH 23/27] ui scaling relative to window size --- voxygen/src/hud/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 3002281939..f8d6d81e61 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -10,7 +10,6 @@ mod settings_window; mod skillbar; mod small_window; -use crate::hud::Event::CrosshairTransp; use bag::Bag; use buttons::Buttons; use character_window::CharacterWindow; @@ -124,6 +123,7 @@ pub enum Event { ChangeAudioDevice(String), ChangeMaxFPS(u32), CrosshairTransp(f32), + //UiScale(f32), CharacterSelection, Logout, Quit, @@ -271,7 +271,10 @@ impl Hud { pub fn new(window: &mut Window) -> Self { let mut ui = Ui::new(window).unwrap(); // TODO: Adjust/remove this, right now it is used to demonstrate window scaling functionality. - ui.scaling_mode(ScaleMode::RelativeToWindow([1920.0, 1080.0].into())); + let ui_scale = 0.7; + ui.scaling_mode(ScaleMode::RelativeToWindow( + window.renderer().get_resolution().map(|e| e as f64) / ui_scale as f64, + )); // Generate ids. let ids = Ids::new(ui.id_generator()); // Load images. @@ -284,6 +287,7 @@ impl Hud { imgs, fonts, ids, + ui_scale, new_messages: VecDeque::new(), inventory_space: 8, show: Show { From a56747b555db99bb42e03b3c52b226e0a5ebb55e Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 15:38:16 +0200 Subject: [PATCH 24/27] acacia trees --- assets/world/tree/acacia/1.vox | 3 +++ assets/world/tree/acacia/2.vox | 3 +++ assets/world/tree/acacia/3.vox | 3 +++ assets/world/tree/acacia/4.vox | 3 +++ assets/world/tree/acacia/5.vox | 3 +++ 5 files changed, 15 insertions(+) create mode 100644 assets/world/tree/acacia/1.vox create mode 100644 assets/world/tree/acacia/2.vox create mode 100644 assets/world/tree/acacia/3.vox create mode 100644 assets/world/tree/acacia/4.vox create mode 100644 assets/world/tree/acacia/5.vox diff --git a/assets/world/tree/acacia/1.vox b/assets/world/tree/acacia/1.vox new file mode 100644 index 0000000000..cda1574acc --- /dev/null +++ b/assets/world/tree/acacia/1.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8f5224352c662e4400b16f0ebff2ee7accdf188b20748d5049f16f7011902bd +size 51468 diff --git a/assets/world/tree/acacia/2.vox b/assets/world/tree/acacia/2.vox new file mode 100644 index 0000000000..32ecce590e --- /dev/null +++ b/assets/world/tree/acacia/2.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcbe884c673e8e16911318fe228bfba6bc36e65bc1f8c26c9706d92719eac97c +size 44527 diff --git a/assets/world/tree/acacia/3.vox b/assets/world/tree/acacia/3.vox new file mode 100644 index 0000000000..8bc06e54cc --- /dev/null +++ b/assets/world/tree/acacia/3.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9734b6769fa66c77ddee14490b1c6a1241048fbdf7f7cfacfefb77c045e484b2 +size 44795 diff --git a/assets/world/tree/acacia/4.vox b/assets/world/tree/acacia/4.vox new file mode 100644 index 0000000000..6bc02dac6e --- /dev/null +++ b/assets/world/tree/acacia/4.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2a53a49c63b45712ee7ddcf9c6ec991193bc17041d12f63264e6372e112c056 +size 51196 diff --git a/assets/world/tree/acacia/5.vox b/assets/world/tree/acacia/5.vox new file mode 100644 index 0000000000..0c22065caa --- /dev/null +++ b/assets/world/tree/acacia/5.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdea24bb04530868486a9b50a84c756a5a90981a70af1bb3c50c1ca72e3b666e +size 51672 From f3bda57e6712ab5cf3ee63cc8a3d044b060e858d Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 15:44:34 +0200 Subject: [PATCH 25/27] fmt --- voxygen/src/hud/bag.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 06b759ed8e..245242a930 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -3,7 +3,7 @@ use conrod_core::{ color, position::Relative, widget::{self, Button, Image, Rectangle, Scrollbar}, - widget_ids, Colorable, Color, Labelable, Positionable, Sizeable, Widget, WidgetCommon, + widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; widget_ids! { @@ -36,7 +36,7 @@ pub struct Bag<'a> { impl<'a> Bag<'a> { pub fn new(inventory_space: usize, imgs: &'a Imgs, fonts: &'a Fonts) -> Self { Self { - inventory_space, + inventory_space, imgs, fonts, common: widget::CommonBuilder::default(), @@ -78,21 +78,29 @@ impl<'a> Widget for Bag<'a> { .bottom_right_with_margins_on(ui.window, 60.0, 5.0) .set(state.ids.bag_bot, ui); Image::new(self.imgs.bag_mid) - .w_h(61.0 * BAG_SCALE, ((self.inventory_space + 4) / 5) as f64 * 44.0) + .w_h( + 61.0 * BAG_SCALE, + ((self.inventory_space + 4) / 5) as f64 * 44.0, + ) .up_from(state.ids.bag_bot, 0.0) .set(state.ids.bag_mid, ui); Image::new(self.imgs.bag_top) .w_h(61.0 * BAG_SCALE, 9.0 * BAG_SCALE) .up_from(state.ids.bag_mid, 0.0) - .set(state.ids.bag_top, ui); + .set(state.ids.bag_top, ui); // Alignment for Grid - Rectangle::fill_with([54.0 * BAG_SCALE, ((self.inventory_space + 4) / 5) as f64 * 44.0], color::TRANSPARENT) - .top_left_with_margins_on(state.ids.bag_top, 9.0 * BAG_SCALE, 3.0 * BAG_SCALE) - .scroll_kids() - .scroll_kids_vertically() - .set(state.ids.inv_alignment, ui); - + Rectangle::fill_with( + [ + 54.0 * BAG_SCALE, + ((self.inventory_space + 4) / 5) as f64 * 44.0, + ], + color::TRANSPARENT, + ) + .top_left_with_margins_on(state.ids.bag_top, 9.0 * BAG_SCALE, 3.0 * BAG_SCALE) + .scroll_kids() + .scroll_kids_vertically() + .set(state.ids.inv_alignment, ui); // Grid /*Image::new(self.imgs.inv_grid) From 7f45d274a8eec004bb91856a91e9c03fceba55c9 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 16:06:27 +0200 Subject: [PATCH 26/27] clean up --- voxygen/src/hud/bag.rs | 4 ++-- voxygen/src/hud/mod.rs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 245242a930..89614c70f7 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -2,8 +2,8 @@ use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; use conrod_core::{ color, position::Relative, - widget::{self, Button, Image, Rectangle, Scrollbar}, - widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, + widget::{self, Button, Image, Rectangle/*, Scrollbar*/}, + widget_ids, /*Color, Colorable,*/ Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; widget_ids! { diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index f8d6d81e61..25fb5fbb5e 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -286,8 +286,7 @@ impl Hud { ui, imgs, fonts, - ids, - ui_scale, + ids, new_messages: VecDeque::new(), inventory_space: 8, show: Show { From 0cc3c7654226bb8e9d3ec0c5d9c6e44a57f45c81 Mon Sep 17 00:00:00 2001 From: Pfauenauge90 <44173739+Pfauenauge90@users.noreply.github.com> Date: Sun, 7 Jul 2019 17:31:34 +0200 Subject: [PATCH 27/27] fmt --- voxygen/src/hud/bag.rs | 2 +- voxygen/src/hud/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 89614c70f7..c0a7f86188 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -2,7 +2,7 @@ use super::{img_ids::Imgs, Fonts, TEXT_COLOR}; use conrod_core::{ color, position::Relative, - widget::{self, Button, Image, Rectangle/*, Scrollbar*/}, + widget::{self, Button, Image, Rectangle /*, Scrollbar*/}, widget_ids, /*Color, Colorable,*/ Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 25fb5fbb5e..95ae8a07fa 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -286,7 +286,7 @@ impl Hud { ui, imgs, fonts, - ids, + ids, new_messages: VecDeque::new(), inventory_space: 8, show: Show {