Error Window, Alpha Version Display

Former-commit-id: e2ad4e0974c513f806227720cdb2055c1847e9d7
This commit is contained in:
Pfauenauge90 2019-04-17 22:38:52 +02:00
parent 93fedf3b86
commit 0635894557
3 changed files with 42 additions and 29 deletions

View File

@ -20,6 +20,8 @@ widget_ids! {
bag_space_add,
inventorytest_button,
inventorytest_button_label,
// Logo
v_logo,
// Bag and Inventory
bag,
@ -141,6 +143,8 @@ widget_ids! {
// TODO: make macro to mimic widget_ids! for images ids or find another solution to simplify addition of new images.
pub(self) struct Imgs {
//Missing: ActionBar, Health/Mana/Energy Bar & Char Window BG/Frame
//Logo
v_logo: ImgId,
// Bag
bag: ImgId,
bag_hover: ImgId,
@ -326,6 +330,7 @@ impl Imgs {
// Window BG
window_bg: load("element/misc_backgrounds/window_bg.png"),
v_logo: load("element/v_logo.png"),
//Social Window
social_bg: load("element/misc_backgrounds/small_bg.png"),
@ -476,6 +481,7 @@ impl Hud {
fn update_layout(&mut self) -> Vec<Event> {
let mut events = Vec::new();
let ref mut ui_widgets = self.ui.set_widgets();
let version = env!("Cargo_PKG_VERSION");
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
const HP_COLOR: Color = Color::Rgba(0.33, 0.63, 0.0, 1.0);
@ -505,11 +511,17 @@ impl Hud {
{
events.push(Event::SendMessage(msg));
}
// Alpha Version
Text::new(version)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14)
.color(TEXT_COLOR)
.set(self.ids.v_logo, ui_widgets);
// Help Text
if self.show_help {
Image::new(self.imgs.window_frame_2)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.w_h(300.0, 370.0)
.top_left_with_margins_on(ui_widgets.window, 3.0, 3.0)
.w_h(300.0, 350.0)
.set(self.ids.help_bg, ui_widgets);
Text::new(
@ -535,14 +547,12 @@ impl Hud {
.font_id(self.font_opensans)
.font_size(18)
.set(self.ids.help, ui_widgets);
if Button::image(self.imgs.button_dark)
.w_h(50.0, 30.0)
.bottom_right_with_margins_on(self.ids.help_bg, 10.0, 10.0)
.hover_image(self.imgs.button_dark_hover)
.press_image(self.imgs.button_dark_press)
.label("Close")
.label_font_size(10)
.label_color(TEXT_COLOR)
// X-button
if Button::image(self.imgs.close_button)
.w_h(244.0 * 0.22 / 3.0, 244.0 * 0.22 / 3.0)
.hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.help_bg, 8.0, 4.0)
.set(self.ids.button_help2, ui_widgets)
.was_clicked()
{

View File

@ -411,6 +411,7 @@ impl CharSelectionUi {
fn update_layout(&mut self) -> Vec<Event> {
let mut events = Vec::new();
let ref mut ui_widgets = self.ui.set_widgets();
let version = env!("Cargo_PKG_VERSION");
// Character Selection /////////////////
// Supposed functionality:
@ -475,7 +476,7 @@ impl CharSelectionUi {
Button::image(self.imgs.v_logo)
.w_h(346.0, 111.0)
.top_left_with_margins_on(self.ids.bg_selection, 30.0, 40.0)
.label("Alpha 0.1")
.label(version)
.label_rgba(1.0, 1.0, 1.0, 1.0)
.label_font_size(10)
.label_y(conrod_core::position::Relative::Scalar(-40.0))

View File

@ -6,7 +6,6 @@ use crate::{
use common::assets;
use conrod_core::{
color,
color::BLACK,
color::TRANSPARENT,
image::Id as ImgId,
position::{Dimension, Relative},
@ -24,6 +23,8 @@ widget_ids! {
// Login, Singleplayer
login_button,
login_text,
login_error,
login_error_bg,
address_text,
address_bg,
address_field,
@ -39,8 +40,6 @@ widget_ids! {
// Error
error_frame,
button_ok,
login_error,
login_error_bg,
}
}
@ -94,7 +93,7 @@ impl Imgs {
button_press: load("element/buttons/button_press.png"),
//Error
error_frame: load("element/frames/skin_eyes.png"),
error_frame: load("element/frames/window_2.png"),
button_dark: load("element/buttons/button_dark.png"),
button_dark_hover: load("element/buttons/button_dark_hover.png"),
button_dark_press: load("element/buttons/button_dark_press.png"),
@ -162,6 +161,7 @@ impl MainMenuUi {
fn update_layout(&mut self) -> Vec<Event> {
let mut events = Vec::new();
let ref mut ui_widgets = self.ui.set_widgets();
let version = env!("Cargo_PKG_VERSION");
// Background image, Veloren logo, Alpha-Version Label
Image::new(self.imgs.bg)
.middle_of(ui_widgets.window)
@ -169,7 +169,7 @@ impl MainMenuUi {
Button::image(self.imgs.v_logo)
.w_h(346.0, 111.0)
.top_left_with_margins(30.0, 40.0)
.label("Alpha 0.1")
.label(version)
.label_rgba(1.0, 1.0, 1.0, 1.0)
.label_font_size(10)
.label_y(Relative::Scalar(-40.0))
@ -222,30 +222,32 @@ impl MainMenuUi {
.rgba(1.0, 1.0, 1.0, 1.0)
.font_size(30)
.font_id(self.font_opensans);
Rectangle::fill_with([200.0, 100.0], color::BLACK)
Rectangle::fill_with([400.0, 100.0], color::TRANSPARENT)
.rgba(0.1, 0.1, 0.1, 1.0)
.parent(ui_widgets.window)
.up_from(self.ids.username_bg, 35.0)
.mid_top_with_margin_on(self.ids.username_bg, -35.0)
.set(self.ids.login_error_bg, ui_widgets);
text.mid_top_with_margin_on(self.ids.login_error_bg, 10.0)
.set(self.ids.login_error, ui_widgets);
Image::new(self.imgs.error_frame)
.middle_of(self.ids.login_error)
.w_h(400.0, 100.0)
.middle_of(self.ids.login_error_bg)
.set(self.ids.error_frame, ui_widgets);
text.mid_top_with_margin_on(self.ids.error_frame, 10.0)
.set(self.ids.login_error, ui_widgets);
if Button::image(self.imgs.button_dark)
.w_h(50.0, 30.0)
.mid_top_with_margin_on(self.ids.login_error_bg, 20.0)
.w_h(100.0, 30.0)
.mid_bottom_with_margin_on(self.ids.login_error_bg, 5.0)
.hover_image(self.imgs.button_dark_hover)
.press_image(self.imgs.button_dark_press)
.label("Ok")
.label_y(Relative::Scalar(2.0))
.label("Okay")
.label_font_size(10)
.label_color(TEXT_COLOR)
.set(self.ids.button_ok, ui_widgets)
.was_clicked()
{}
};
{
self.login_error = None
};
}
// Server address
Image::new(self.imgs.input_bg)
.w_h(337.0, 67.0)
@ -318,7 +320,7 @@ impl MainMenuUi {
.align_middle_x_of(self.ids.address_bg)
.label("Singleplayer")
.label_color(TEXT_COLOR)
.label_font_size(26)
.label_font_size(24)
.label_y(Relative::Scalar(5.0))
.label_x(Relative::Scalar(2.0))
.set(self.ids.singleplayer_button, ui_widgets)