From 072611f703bcf03969b4dcf89ce94b4a2cb49900 Mon Sep 17 00:00:00 2001 From: Monty Marz Date: Thu, 24 Oct 2019 18:21:17 +0000 Subject: [PATCH] .floating(true) for help window background to make it layer above every recent and future widget --- voxygen/src/hud/mod.rs | 51 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index ee22ca2dbf..9cde31b6d4 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -96,6 +96,8 @@ widget_ids! { intro_close, intro_close_2, intro_close_3, + intro_close_4, + intro_close_5, intro_check, intro_check_text, @@ -661,8 +663,8 @@ impl Hud { match global_state.settings.gameplay.intro_show { Intro::Show => { Rectangle::fill_with([800.0, 850.0], Color::Rgba(0.0, 0.0, 0.0, 0.80)) - .mid_left_with_margin_on(ui_widgets.window, 10.0) - .depth(-1.0) + .top_left_with_margins_on(ui_widgets.window, 180.0, 10.0) + .floating(true) .set(self.ids.intro_bg, ui_widgets); Text::new(intro_text) .top_left_with_margins_on(self.ids.intro_bg, 10.0, 10.0) @@ -716,6 +718,27 @@ impl Hud { .font_id(self.fonts.cyri) .color(TEXT_COLOR) .set(self.ids.intro_check_text, ui_widgets); + // X-button + if Button::image(self.imgs.close_button) + .w_h(40.0, 40.0) + .hover_image(self.imgs.close_button_hover) + .press_image(self.imgs.close_button_press) + .top_right_with_margins_on(self.ids.intro_bg, 0.0, 0.0) + .color(Color::Rgba(1.0, 1.0, 1.0, 0.8)) + .set(self.ids.intro_close_4, ui_widgets) + .was_clicked() + { + if self.never_show { + events.push(Event::Intro(Intro::Never)); + self.never_show = !self.never_show; + self.intro = false; + self.intro_2 = false; + } else { + self.show.intro = !self.show.intro; + self.intro = false; + self.intro_2 = false; + } + }; } Intro::Never => {} } @@ -723,7 +746,8 @@ impl Hud { if self.intro_2 && !self.show.esc_menu { Rectangle::fill_with([800.0, 850.0], Color::Rgba(0.0, 0.0, 0.0, 0.80)) - .mid_left_with_margin_on(ui_widgets.window, 10.0) + .top_left_with_margins_on(ui_widgets.window, 180.0, 10.0) + .floating(true) .set(self.ids.intro_bg, ui_widgets); Text::new(intro_text) .top_left_with_margins_on(self.ids.intro_bg, 10.0, 10.0) @@ -744,6 +768,27 @@ impl Hud { { self.intro_2 = false; } + // X-button + if Button::image(self.imgs.close_button) + .w_h(40.0, 40.0) + .hover_image(self.imgs.close_button_hover) + .press_image(self.imgs.close_button_press) + .top_right_with_margins_on(self.ids.intro_bg, 0.0, 0.0) + .color(Color::Rgba(1.0, 1.0, 1.0, 0.8)) + .set(self.ids.intro_close_4, ui_widgets) + .was_clicked() + { + if self.never_show { + events.push(Event::Intro(Intro::Never)); + self.never_show = !self.never_show; + self.intro = false; + self.intro_2 = false; + } else { + self.show.intro = !self.show.intro; + self.intro = false; + self.intro_2 = false; + } + }; } // Display debug window.