formatting tweaks

Former-commit-id: 90d46c995737d7077a581e9767209fc338c392fa
This commit is contained in:
Imbris 2019-04-28 00:54:59 -04:00
parent 9d63253627
commit 33fbcd1e93
2 changed files with 34 additions and 19 deletions

View File

@ -58,13 +58,19 @@ impl Asset for DynamicImage {
fn load(specifier: &str) -> Result<Self, Error> {
Ok(image::load_from_memory(
load_from_path(specifier)?.as_slice()
).unwrap())
)
.unwrap()
)
}
}
impl Asset for DotVoxData {
fn load(specifier: &str) -> Result<Self, Error> {
Ok(dot_vox::load_bytes(load_from_path(specifier)?.as_slice()).unwrap())
Ok(dot_vox::load_bytes(
load_from_path(specifier)?.as_slice()
)
.unwrap()
)
}
}

View File

@ -1,12 +1,14 @@
use conrod_core::{
color,
builder_methods, color,
text::font,
builder_methods,
widget::{self, Button, Image, Rectangle, Text},
WidgetCommon, widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
};
use super::{WindowStyle, XP_COLOR, imgs::{Imgs, Voxs}};
use super::{
imgs::{Imgs, Voxs},
WindowStyle, XP_COLOR,
};
widget_ids! {
struct Ids {
@ -38,7 +40,6 @@ pub struct CharacterWindow<'a> {
#[conrod(common_builder)]
common: widget::CommonBuilder,
style: WindowStyle,
}
impl<'a> CharacterWindow<'a> {
@ -74,7 +75,9 @@ impl<'a> Widget for CharacterWindow<'a> {
type Event = Option<Event>;
fn init_state(&self, id_gen: widget::id::Generator) -> Self::State {
State { ids: Ids::new(id_gen) }
State {
ids: Ids::new(id_gen),
}
}
fn style(&self) -> Self::Style {
@ -82,7 +85,13 @@ impl<'a> Widget for CharacterWindow<'a> {
}
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { id, state, ui, style, .. } = args;
let widget::UpdateArgs {
id,
state,
ui,
style,
..
} = args;
let font_id = style.font_id(&ui.theme).or(ui.fonts.ids().next());
let text_color = style.text_color(&ui.theme);
@ -178,11 +187,11 @@ impl<'a> Widget for CharacterWindow<'a> {
\n\
Intelligence",
)
.top_left_with_margins_on(state.ids.charwindow_rectangle, 100.0, 20.0)
.and_then(font_id, Text::font_id)
.font_size(16)
.color(text_color)
.set(state.ids.charwindow_tab1_statnames, ui);
.top_left_with_margins_on(state.ids.charwindow_rectangle, 100.0, 20.0)
.and_then(font_id, Text::font_id)
.font_size(16)
.color(text_color)
.set(state.ids.charwindow_tab1_statnames, ui);
Text::new(
"1234\n\
@ -193,11 +202,11 @@ impl<'a> Widget for CharacterWindow<'a> {
\n\
124124",
)
.right_from(state.ids.charwindow_tab1_statnames, 10.0)
.and_then(font_id, Text::font_id)
.font_size(16)
.color(text_color)
.set(state.ids.charwindow_tab1_stats, ui);
.right_from(state.ids.charwindow_tab1_statnames, 10.0)
.and_then(font_id, Text::font_id)
.font_size(16)
.color(text_color)
.set(state.ids.charwindow_tab1_stats, ui);
if closed {
Some(Event::Close)