Prepare relative small windows

Former-commit-id: 6f1046518b49b302d69d51e0596514bf9ded7952
This commit is contained in:
timokoesters 2019-05-06 21:17:29 +02:00 committed by Imbris
parent a36fcb4243
commit 7f709bba0c
2 changed files with 7 additions and 4 deletions

View File

@ -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 {

View File

@ -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)