From f52d98d3bc771df14797afc6ec6e79eb5ba4a56d Mon Sep 17 00:00:00 2001 From: timokoesters Date: Mon, 6 May 2019 21:17:29 +0200 Subject: [PATCH] Prepare relative small windows Former-commit-id: 6f1046518b49b302d69d51e0596514bf9ded7952 --- voxygen/src/hud/mod.rs | 2 +- voxygen/src/hud/small_window.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index e3d2724c83..aa6bc3d985 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -407,7 +407,7 @@ impl Hud { Windows::CharacterAnd(Some(small)) => Some((small, true)), _ => None, } { - match SmallWindow::new(small, &self.imgs, &self.fonts) + match SmallWindow::new(small, &self.show, &self.imgs, &self.fonts) .set(self.ids.small_window, ui_widgets) { Some(small_window::Event::Close) => self.show.open_windows = match self.show.open_windows { diff --git a/voxygen/src/hud/small_window.rs b/voxygen/src/hud/small_window.rs index e8cff99167..b52be3bc67 100644 --- a/voxygen/src/hud/small_window.rs +++ b/voxygen/src/hud/small_window.rs @@ -4,10 +4,11 @@ use conrod_core::{ widget::{self, Button, Image, Rectangle, Text}, widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, }; - +use crate::hud::Show; use super::{ img_ids::Imgs, font_ids::Fonts, + Windows, TEXT_COLOR, }; @@ -31,6 +32,7 @@ pub enum SmallWindowType { #[derive(WidgetCommon)] pub struct SmallWindow<'a> { content: SmallWindowType, + show: &'a Show, imgs: &'a Imgs, fonts: &'a Fonts, @@ -41,9 +43,10 @@ pub struct SmallWindow<'a> { } impl<'a> SmallWindow<'a> { - pub fn new(content: SmallWindowType, imgs: &'a Imgs, fonts: &'a Fonts) -> Self { + pub fn new(content: SmallWindowType, show: &'a Show, imgs: &'a Imgs, fonts: &'a Fonts) -> Self { Self { content, + show, imgs, fonts, common: widget::CommonBuilder::default(), @@ -92,7 +95,7 @@ impl<'a> Widget for SmallWindow<'a> { // Frame // TODO: Relative to Char Window? - if true { //char_window_open { + if let Windows::CharacterAnd(_) = self.show.open_windows { Image::new(self.imgs.window_frame) // TODO: Position // .right_from(state.ids.character_window, 20.0)