diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index 05412179d2..36d8781725 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -62,7 +62,7 @@ impl PlayState for MainMenuState { global_state.window.renderer_mut().clear(BG_COLOR); // Poll client creation - match client_init.as_ref().and_then(|init| init.poll()) { + match client_init.as_ref().and_then(|init| init.poll()) { Some(Ok(client)) => { self.main_menu_ui.connected(); return PlayStateResult::Push(Box::new(CharSelectionState::new( @@ -72,11 +72,14 @@ impl PlayState for MainMenuState { } Some(Err(err)) => { client_init = None; - self.main_menu_ui.login_error(match err { - InitError::BadAddress(_) | InitError::NoAddress => "No such host is known", - InitError::ConnectionFailed(_) => "Could not connect to address", - }.to_string()); - }, + self.main_menu_ui.login_error( + match err { + InitError::BadAddress(_) | InitError::NoAddress => "Server not found", + InitError::ConnectionFailed(_) => "Connection failed", + } + .to_string(), + ); + } None => {} } diff --git a/voxygen/src/menu/main/ui.rs b/voxygen/src/menu/main/ui.rs index 6483690be5..2ea5c7d0e9 100644 --- a/voxygen/src/menu/main/ui.rs +++ b/voxygen/src/menu/main/ui.rs @@ -37,6 +37,8 @@ widget_ids! { servers_button, settings_button, quit_button, + // Error + error_frame, } } @@ -53,6 +55,8 @@ struct Imgs { button: ImgId, button_hover: ImgId, button_press: ImgId, + + error_frame: ImgId, } impl Imgs { fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs { @@ -83,6 +87,9 @@ impl Imgs { button: load("element/buttons/button.png"), button_hover: load("element/buttons/button_hover.png"), button_press: load("element/buttons/button_press.png"), + + //Error + error_frame: load("element/frames/skin_eyes.png"), } } } @@ -217,20 +224,24 @@ impl MainMenuUi { // Login error if let Some(msg) = &self.login_error { let text = Text::new(&msg) - .rgba(0.5, 0.0, 0.0, 1.0) + .rgba(1.0, 1.0, 1.0, 1.0) .font_size(30) .font_id(self.font_opensans); let x = match text.get_x_dimension(ui_widgets) { Dimension::Absolute(x) => x + 10.0, _ => 0.0, }; - Rectangle::fill([x, 40.0]) - .rgba(0.2, 0.3, 0.3, 0.7) + Rectangle::fill([x, 60.0]) + .rgba(0.1, 0.1, 0.1, 1.0) .parent(ui_widgets.window) - .up_from(self.ids.username_bg, 35.0) + .mid_bottom_with_margin_on(self.ids.username_bg, 0.0) .set(self.ids.login_error_bg, ui_widgets); text.middle_of(self.ids.login_error_bg) .set(self.ids.login_error, ui_widgets); + Image::new(self.imgs.error_frame) + .h(60.0) + .middle_of(self.ids.login_error) + .set(self.ids.error_frame, ui_widgets); } // Server address Image::new(self.imgs.input_bg)