Merge branch 'pfauenauge-fix' into 'master'

Update UI (Pfauenauge)

See merge request veloren/veloren!68

Former-commit-id: 43d549dbb8882937df929f618325163d22c919a4
This commit is contained in:
Joshua Barretto
2019-04-25 12:25:30 +00:00
4 changed files with 568 additions and 469 deletions

View File

@ -6,7 +6,10 @@ use crate::{
window::{Event as WinEvent, Key, Window}, window::{Event as WinEvent, Key, Window},
GlobalState, GlobalState,
}; };
use common::assets; use common::{
assets,
figure::Segment};
use conrod_core::{ use conrod_core::{
color, color,
image::Id as ImgId, image::Id as ImgId,
@ -21,13 +24,11 @@ widget_ids! {
bag_space_add, bag_space_add,
inventorytest_button, inventorytest_button,
inventorytest_button_label, inventorytest_button_label,
//Debug //Debug
debug_bg, debug_bg,
debug_button, debug_button,
debug_button_label, debug_button_label,
fps_counter, fps_counter,
// Logo // Logo
v_logo, v_logo,
@ -41,6 +42,19 @@ widget_ids! {
inv_scrollbar, inv_scrollbar,
inv_slot_0, inv_slot_0,
inv_slot[], inv_slot[],
// Buttons
settings_button,
social_button,
map_button,
spellbook_button,
character_button,
qlog_button,
social_button_bg,
spellbook_button_bg,
character_button_bg,
qlog_button_bg,
bag_text,
//help //help
help, help,
help_bg, help_bg,
@ -55,13 +69,6 @@ widget_ids! {
//Mini-Map //Mini-Map
mmap_frame, mmap_frame,
mmap_frame_bg, mmap_frame_bg,
mmap_button_0,
mmap_button_1,
mmap_button_2,
mmap_button_3,
mmap_button_4,
mmap_button_5,
mmap_icons,
mmap_location, mmap_location,
//Action-Bar //Action-Bar
xp_bar, xp_bar,
@ -114,6 +121,8 @@ widget_ids! {
map_icon, map_icon,
map_close, map_close,
map_title, map_title,
map_frame_l,
map_frame_r,
//3 Spellbook //3 Spellbook
spellbook_frame, spellbook_frame,
spellbook_bg, spellbook_bg,
@ -150,9 +159,6 @@ widget_ids! {
// TODO: make macro to mimic widget_ids! for images ids or find another solution to simplify addition of new images. // TODO: make macro to mimic widget_ids! for images ids or find another solution to simplify addition of new images.
pub(self) struct Imgs { pub(self) struct Imgs {
//Missing: ActionBar, Health/Mana/Energy Bar & Char Window BG/Frame
//Logo
//v_logo: ImgId,
// Bag // Bag
bag: ImgId, bag: ImgId,
bag_hover: ImgId, bag_hover: ImgId,
@ -164,6 +170,31 @@ pub(self) struct Imgs {
inv_grid: ImgId, inv_grid: ImgId,
inv_slot: ImgId, inv_slot: ImgId,
// Buttons
settings: ImgId,
settings_hover: ImgId,
settings_press: ImgId,
social_button: ImgId,
social_hover: ImgId,
social_press: ImgId,
map_button: ImgId,
map_hover: ImgId,
map_press: ImgId,
spellbook_button: ImgId,
spellbook_hover: ImgId,
spellbook_press: ImgId,
character_button: ImgId,
character_hover: ImgId,
character_press: ImgId,
qlog_button: ImgId,
qlog_hover: ImgId,
qlog_press: ImgId,
// Close button // Close button
close_button: ImgId, close_button: ImgId,
close_button_hover: ImgId, close_button_hover: ImgId,
@ -179,13 +210,6 @@ pub(self) struct Imgs {
// MiniMap // MiniMap
mmap_frame: ImgId, mmap_frame: ImgId,
mmap_frame_bg: ImgId, mmap_frame_bg: ImgId,
mmap_icons: ImgId,
// Settings at Mini-Map
mmap_button: ImgId,
mmap_button_hover: ImgId,
mmap_button_press: ImgId,
mmap_button_open: ImgId,
// SkillBar Module // SkillBar Module
sb_grid: ImgId, sb_grid: ImgId,
@ -226,7 +250,8 @@ pub(self) struct Imgs {
// Map-Window // Map-Window
map_bg: ImgId, map_bg: ImgId,
map_icon: ImgId, map_icon: ImgId,
map_frame: ImgId, map_frame_l: ImgId,
map_frame_r: ImgId,
// Spell Book Window // Spell Book Window
spellbook_bg: ImgId, spellbook_bg: ImgId,
spellbook_icon: ImgId, spellbook_icon: ImgId,
@ -239,142 +264,166 @@ pub(self) struct Imgs {
progress_frame: ImgId, progress_frame: ImgId,
progress: ImgId, progress: ImgId,
// Buttons
mmap_button: ImgId,
mmap_button_hover: ImgId,
mmap_button_press: ImgId,
mmap_button_open: ImgId,
// Quest-Log Window // Quest-Log Window
questlog_bg: ImgId, questlog_bg: ImgId,
questlog_icon: ImgId, questlog_icon: ImgId,
//help //help
//help: ImgId,
// Chat-Arrow // Chat-Arrow
chat_arrow: ImgId, chat_arrow: ImgId,
chat_arrow_mo: ImgId, chat_arrow_mo: ImgId,
chat_arrow_press: ImgId, chat_arrow_press: ImgId,
chat_arrow_up: ImgId,
chat_arrow_up_mo: ImgId,
chat_arrow_up_press: ImgId,
chat_arrow_down: ImgId,
chat_arrow_down_mo: ImgId,
chat_arrow_down_press: ImgId,
} }
impl Imgs { impl Imgs {
fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs { fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs {
let load = |filename, ui: &mut Ui| { let mut load_img = |filename, ui: &mut Ui| {
let fullpath: String = ["/voxygen/", filename].concat(); let fullpath: String = ["/voxygen/", filename].concat();
let image = image::load_from_memory( let image = image::load_from_memory(
assets::load(fullpath.as_str()) assets::load(fullpath.as_str())
.expect("Error loading file") .expect("Error loading Main UI Image")
.as_slice(), .as_slice(),
) )
.unwrap(); .unwrap();
ui.new_graphic(ui::Graphic::Image(image)) ui.new_graphic(ui::Graphic::Image(image))
};
let mut load_vox = |filename, ui: &mut Ui| {
let fullpath: String = ["/voxygen/", filename].concat();
let dot_vox = dot_vox::load_bytes(
assets::load(fullpath.as_str())
.expect("Error loading Main UI .vox")
.as_slice(),
)
.unwrap();
ui.new_graphic(ui::Graphic::Voxel(Segment::from(dot_vox)))
}; };
Imgs { Imgs {
// Bag // Bag
bag: load("element/buttons/bag/closed.png", ui), bag: load_img("element/buttons/bag/closed.png", ui),
bag_hover: load("element/buttons/bag/closed_hover.png", ui), bag_hover: load_img("element/buttons/bag/closed_hover.png", ui),
bag_press: load("element/buttons/bag/closed_press.png", ui), bag_press: load_img("element/buttons/bag/closed_press.png", ui),
bag_open: load("element/buttons/bag/open.png", ui), bag_open: load_img("element/buttons/bag/open.png", ui),
bag_open_hover: load("element/buttons/bag/open_hover.png", ui), bag_open_hover: load_img("element/buttons/bag/open_hover.png", ui),
bag_open_press: load("element/buttons/bag/open_press.png", ui), bag_open_press: load_img("element/buttons/bag/open_press.png", ui),
bag_contents: load("element/frames/bag.png", ui), bag_contents: load_vox("element/frames/bag.vox", ui),
inv_grid: load("element/frames/inv_grid.png", ui), inv_grid: load_vox("element/frames/inv_grid.vox", ui),
inv_slot: load("element/buttons/inv_slot.png", ui), inv_slot: load_vox("element/buttons/inv_slot.vox", ui),
// Buttons
settings: load_vox("element/buttons/settings.vox", ui),
settings_hover: load_vox("element/buttons/settings_hover.vox", ui),
settings_press: load_vox("element/buttons/settings_press.vox", ui),
social_button: load_vox("element/buttons/social.vox", ui),
social_hover: load_vox("element/buttons/social_hover.vox", ui),
social_press: load_vox("element/buttons/social_press.vox", ui),
map_button: load_vox("element/buttons/map.vox", ui),
map_hover: load_vox("element/buttons/map_hover.vox", ui),
map_press: load_vox("element/buttons/map_press.vox", ui),
spellbook_button: load_vox("element/buttons/spellbook.vox", ui),
spellbook_hover: load_vox("element/buttons/spellbook_hover.vox", ui),
spellbook_press: load_vox("element/buttons/spellbook_press.vox", ui),
character_button: load_vox("element/buttons/character.vox", ui),
character_hover: load_vox("element/buttons/character_hover.vox", ui),
character_press: load_vox("element/buttons/character_press.vox", ui),
qlog_button: load_vox("element/buttons/qlog.vox", ui),
qlog_hover: load_vox("element/buttons/qlog_hover.vox", ui),
qlog_press: load_vox("element/buttons/qlog_press.vox", ui),
mmap_button: load_img("element/buttons/border.png", ui),
mmap_button_hover: load_img("element/buttons/border_mo.png", ui),
mmap_button_press: load_img("element/buttons/border_press.png", ui),
mmap_button_open: load_img("element/buttons/border_pressed.png", ui),
// Close button // Close button
close_button: load("element/buttons/x.png", ui), close_button: load_vox("element/buttons/x.vox", ui),
close_button_hover: load("element/buttons/x_hover.png", ui), close_button_hover: load_vox("element/buttons/x_hover.vox", ui),
close_button_press: load("element/buttons/x_press.png", ui), close_button_press: load_vox("element/buttons/x_press.vox", ui),
// Esc-Menu // Esc-Menu
esc_bg: load("element/frames/menu.png", ui), esc_bg: load_img("element/frames/menu.png", ui),
fireplace: load("element/misc_backgrounds/fireplace.png", ui), fireplace: load_vox("element/misc_bg/fireplace.vox", ui),
button_dark: load("element/buttons/button_dark.png", ui), button_dark: load_vox("element/buttons/button_dark.vox", ui),
button_dark_hover: load("element/buttons/button_dark_hover.png", ui), button_dark_hover: load_img("element/buttons/button_dark_hover.png", ui),
button_dark_press: load("element/buttons/button_dark_press.png", ui), button_dark_press: load_img("element/buttons/button_dark_press.png", ui),
// MiniMap // MiniMap
mmap_frame: load("element/frames/mmap.png", ui), mmap_frame: load_vox("element/frames/mmap.vox", ui),
mmap_frame_bg: load("element/misc_backgrounds/mmap_bg.png", ui), mmap_frame_bg: load_img("element/misc_bg/mmap_bg.png", ui),
mmap_icons: load("element/buttons/mmap_icons.png", ui),
// Settings at Mini-Map
mmap_button: load("element/buttons/border.png", ui),
mmap_button_hover: load("element/buttons/border_mo.png", ui),
mmap_button_press: load("element/buttons/border_press.png", ui),
mmap_button_open: load("element/buttons/border_pressed.png", ui),
// Skillbar Module // Skillbar Module
sb_grid: load("element/skill_bar/sbar_grid.png", ui), sb_grid: load_img("element/skill_bar/sbar_grid.png", ui),
sb_grid_bg: load("element/skill_bar/sbar_grid_bg.png", ui), sb_grid_bg: load_img("element/skill_bar/sbar_grid_bg.png", ui),
l_click: load("element/skill_bar/l.png", ui), l_click: load_img("element/skill_bar/l.png", ui),
r_click: load("element/skill_bar/r.png", ui), r_click: load_img("element/skill_bar/r.png", ui),
mana_bar: load("element/skill_bar/mana_bar.png", ui), mana_bar: load_img("element/skill_bar/mana_bar.png", ui),
health_bar: load("element/skill_bar/health_bar.png", ui), health_bar: load_img("element/skill_bar/health_bar.png", ui),
xp_bar: load("element/skill_bar/xp_bar.png", ui), xp_bar: load_img("element/skill_bar/xp_bar.png", ui),
//Buff Frame(s)
//buff_frame: load("element/skill_bar/buff_frame.png", ui),
//buff_frame_bg: load("element/skill_bar/buff_frame_bg.png", ui),
//buff_frame_red: load("element/skill_bar/buff_frame_red.png", ui),
//buff_frame_green: load("element/skill_bar/buff_frame_green.png", ui),
// Missing: Buff Frame Animation (.gif ?!) (we could do animation in ui.maintain(), or in shader?) // Missing: Buff Frame Animation (.gif ?!) (we could do animation in ui.maintain(), or in shader?)
window_frame: load("element/frames/window.png", ui), window_frame: load_vox("element/frames/window2.vox", ui),
window_frame_2: load("element/frames/window_2.png", ui), window_frame_2: load_img("element/frames/window_2.png", ui),
// Settings Window // Settings Window
settings_bg: load("element/frames/settings.png", ui), settings_bg: load_img("element/frames/settings.png", ui),
settings_icon: load("element/icons/settings.png", ui), settings_icon: load_img("element/icons/settings.png", ui),
settings_button_mo: load("element/buttons/blue_mo.png", ui), settings_button_mo: load_img("element/buttons/blue_mo.png", ui),
check: load("element/buttons/check/no.png", ui), check: load_img("element/buttons/check/no.png", ui),
check_mo: load("element/buttons/check/no_mo.png", ui), check_mo: load_img("element/buttons/check/no_mo.png", ui),
check_press: load("element/buttons/check/press.png", ui), check_press: load_img("element/buttons/check/press.png", ui),
check_checked: load("element/buttons/check/yes.png", ui), check_checked: load_img("element/buttons/check/yes.png", ui),
check_checked_mo: load("element/buttons/check/yes_mo.png", ui), check_checked_mo: load_img("element/buttons/check/yes_mo.png", ui),
slider: load("element/slider/track.png", ui), slider: load_img("element/slider/track.png", ui),
slider_indicator: load("element/slider/indicator.png", ui), slider_indicator: load_img("element/slider/indicator.png", ui),
button_blank: ui.new_graphic(ui::Graphic::Blank), button_blank: ui.new_graphic(ui::Graphic::Blank),
button_blue_mo: load("element/buttons/blue_mo.png", ui), button_blue_mo: load_img("element/buttons/blue_mo.png", ui),
button_blue_press: load("element/buttons/blue_press.png", ui), button_blue_press: load_img("element/buttons/blue_press.png", ui),
// Window BG // Window BG
window_bg: load("element/misc_backgrounds/window_bg.png", ui), window_bg: load_img("element/misc_bg/window_bg.png", ui),
// Social Window // Social Window
social_bg: load("element/misc_backgrounds/small_bg.png", ui), social_bg: load_img("element/misc_bg/small_bg.png", ui),
social_icon: load("element/icons/social.png", ui), social_icon: load_img("element/icons/social.png", ui),
// Map Window // Map Window
map_bg: load("element/misc_backgrounds/small_bg.png", ui), map_bg: load_img("element/misc_bg/small_bg.png", ui),
map_icon: load("element/icons/map.png", ui), map_icon: load_img("element/icons/map.png", ui),
map_frame: load("element/frames/window_map.png", ui), map_frame_l: load_vox("element/frames/map_l.vox", ui),
map_frame_r: load_vox("element/frames/map_r.vox", ui),
// Spell Book Window // Spell Book Window
spellbook_bg: load("element/misc_backgrounds/small_bg.png", ui), spellbook_bg: load_img("element/misc_bg/small_bg.png", ui),
spellbook_icon: load("element/icons/spellbook.png", ui), spellbook_icon: load_img("element/icons/spellbook.png", ui),
// Char Window // Char Window
charwindow: load("element/misc_backgrounds/charwindow.png", ui), charwindow: load_img("element/misc_bg/charwindow.png", ui),
charwindow_icon: load("element/icons/charwindow.png", ui), charwindow_icon: load_img("element/icons/charwindow.png", ui),
charwindow_tab_bg: load("element/frames/tab.png", ui), charwindow_tab_bg: load_img("element/frames/tab.png", ui),
charwindow_tab: load("element/buttons/tab.png", ui), charwindow_tab: load_img("element/buttons/tab.png", ui),
charwindow_expbar: load("element/misc_backgrounds/small_bg.png", ui), charwindow_expbar: load_img("element/misc_bg/small_bg.png", ui),
progress_frame: load("element/frames/progress_bar.png", ui), progress_frame: load_img("element/frames/progress_bar.png", ui),
progress: load("element/misc_backgrounds/progress.png", ui), progress: load_img("element/misc_bg/progress.png", ui),
// Quest-Log Window // Quest-Log Window
questlog_bg: load("element/misc_backgrounds/small_bg.png", ui), questlog_bg: load_img("element/misc_bg/small_bg.png", ui),
questlog_icon: load("element/icons/questlog.png", ui), questlog_icon: load_img("element/icons/questlog.png", ui),
// Chat-Arrows // Chat-Arrows
chat_arrow: load("element/buttons/arrow/chat_arrow.png", ui), chat_arrow: load_img("element/buttons/arrow/chat_arrow.png", ui),
chat_arrow_mo: load("element/buttons/arrow/chat_arrow_mo.png", ui), chat_arrow_mo: load_img("element/buttons/arrow/chat_arrow_mo.png", ui),
chat_arrow_press: load("element/buttons/arrow/chat_arrow_press.png", ui), chat_arrow_press: load_img("element/buttons/arrow/chat_arrow_press.png", ui),
chat_arrow_up: load("element/buttons/arrow/chat_arrow_up.png", ui),
chat_arrow_up_mo: load("element/buttons/arrow/chat_arrow_up_mo.png", ui),
chat_arrow_up_press: load("element/buttons/arrow/chat_arrow_up_press.png", ui),
chat_arrow_down: load("element/buttons/arrow/chat_arrow_down.png", ui),
chat_arrow_down_mo: load("element/buttons/arrow/chat_arrow_down_mo.png", ui),
chat_arrow_down_press: load("element/buttons/arrow/chat_arrow_down_press.png", ui),
} }
} }
} }
@ -527,6 +576,7 @@ impl Hud {
self.inventory_space = self.inventory_space + 1; self.inventory_space = self.inventory_space + 1;
}; };
} }
// Chat box // Chat box
if let Some(msg) = self if let Some(msg) = self
.chat .chat
@ -534,17 +584,19 @@ impl Hud {
{ {
events.push(Event::SendMessage(msg)); events.push(Event::SendMessage(msg));
} }
// Alpha Version // Alpha Version
Text::new(version) Text::new(version)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0) .top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14) .font_size(14)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(self.ids.v_logo, ui_widgets); .set(self.ids.v_logo, ui_widgets);
// Help Text // Help Text
if self.show_help { if self.show_help {
Image::new(self.imgs.window_frame_2) Image::new(self.imgs.window_frame_2)
.top_left_with_margins_on(ui_widgets.window, 3.0, 3.0) .top_left_with_margins_on(ui_widgets.window, 3.0, 3.0)
.w_h(300.0, 350.0) .w_h(300.0, 190.0)
.set(self.ids.help_bg, ui_widgets); .set(self.ids.help_bg, ui_widgets);
Text::new( Text::new(
@ -555,24 +607,17 @@ impl Hud {
F2 = Toggle Interface \n\ F2 = Toggle Interface \n\
\n\ \n\
Enter = Open Chat \n\ Enter = Open Chat \n\
Mouse Wheel = Scroll Chat\n\ Mouse Wheel = Scroll Chat"
\n\
M = Map \n\
B = Bag \n\
L = Quest-Log \n\
C = Character Window \n\
O = Social \n\
P = Spellbook \n\
N = Settings",
) )
.color(TEXT_COLOR) .color(TEXT_COLOR)
.top_left_with_margins_on(self.ids.help_bg, 20.0, 20.0) .top_left_with_margins_on(self.ids.help_bg, 20.0, 20.0)
.font_id(self.font_opensans) .font_id(self.font_opensans)
.font_size(18) .font_size(18)
.set(self.ids.help, ui_widgets); .set(self.ids.help, ui_widgets);
// X-button // X-button
if Button::image(self.imgs.close_button) if Button::image(self.imgs.close_button)
.w_h(244.0 * 0.22 / 3.0, 244.0 * 0.22 / 3.0) .w_h(100.0 * 0.2, 100.0 * 0.2)
.hover_image(self.imgs.close_button_hover) .hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press) .press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.help_bg, 8.0, 3.0) .top_right_with_margins_on(self.ids.help_bg, 8.0, 3.0)
@ -586,19 +631,14 @@ impl Hud {
// Minimap frame and bg // Minimap frame and bg
Image::new(self.imgs.mmap_frame_bg) Image::new(self.imgs.mmap_frame_bg)
.w_h(1750.0 / 8.0, 1650.0 / 8.0) .w_h(1750.0 / 8.0, 1650.0 / 8.0)
.top_right_with_margins_on(ui_widgets.window, 5.0, 30.0) .top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.set(self.ids.mmap_frame_bg, ui_widgets); .set(self.ids.mmap_frame_bg, ui_widgets);
Image::new(self.imgs.mmap_frame) Image::new(self.imgs.mmap_frame)
.w_h(1750.0 / 8.0, 1650.0 / 8.0) .w_h(1750.0 / 8.0, 1650.0 / 8.0)
.top_right_with_margins_on(ui_widgets.window, 5.0, 30.0) .top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.set(self.ids.mmap_frame, ui_widgets); .set(self.ids.mmap_frame, ui_widgets);
Image::new(self.imgs.mmap_icons)
.w_h(448.0 / 14.93, 2688.0 / 14.93)
.right_from(self.ids.mmap_frame, 0.0)
.align_bottom_of(self.ids.mmap_frame)
.set(self.ids.mmap_icons, ui_widgets);
// Title // Title
// Make it display the actual location // Make it display the actual location
Text::new("Uncanny Valley") Text::new("Uncanny Valley")
@ -607,15 +647,20 @@ impl Hud {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(self.ids.mmap_location, ui_widgets); .set(self.ids.mmap_location, ui_widgets);
// Minimap Buttons // Buttons at Bag
// 0 Settings // 0 Settings
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.settings)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(29.0, 25.0)
.top_right_with_margins_on(self.ids.mmap_icons, 0.0, 0.0) .bottom_right_with_margins_on(ui_widgets.window, 5.0, 57.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.settings_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.settings_press)
.set(self.ids.mmap_button_0, ui_widgets) .label("N")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.settings_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.open_windows = match self.open_windows { self.open_windows = match self.open_windows {
@ -624,34 +669,61 @@ impl Hud {
}; };
self.bag_open = false; self.bag_open = false;
}; };
// 2 Map // 2 Map
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.map_button)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(22.0, 25.0)
.down_from(self.ids.mmap_button_1, 0.0) .left_from(self.ids.social_button, 10.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.map_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.map_press)
.set(self.ids.mmap_button_2, ui_widgets) .label("M")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.map_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.map_open = !self.map_open; self.map_open = !self.map_open;
self.bag_open = false; self.bag_open = false;
}; };
// Other Windows can only be accessed, when Settings are closed. Opening Settings will close all other Windows including the Bag. // Other Windows can only be accessed, when Settings are closed.
// Opening Settings will close all other Windows including the Bag.
// Opening the Map won't close the windows displayed before. // Opening the Map won't close the windows displayed before.
Image::new(self.imgs.social_button)
.w_h(25.0, 25.0)
.left_from(self.ids.settings_button, 10.0)
.set(self.ids.social_button_bg, ui_widgets);
Image::new(self.imgs.spellbook_button)
.w_h(28.0, 25.0)
.left_from(self.ids.map_button, 10.0)
.set(self.ids.spellbook_button_bg, ui_widgets);
Image::new(self.imgs.character_button)
.w_h(27.0, 25.0)
.left_from(self.ids.spellbook_button, 10.0)
.set(self.ids.character_button_bg, ui_widgets);
Image::new(self.imgs.qlog_button)
.w_h(23.0, 25.0)
.left_from(self.ids.character_button, 10.0)
.set(self.ids.qlog_button_bg, ui_widgets);
if match self.open_windows { if match self.open_windows {
Windows::Settings => false, Windows::Settings => false,
_ => true, _ => true,
} && self.map_open == false } && self.map_open == false {
{
// 1 Social // 1 Social
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.social_button)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(25.0, 25.0)
.down_from(self.ids.mmap_button_0, 0.0) .left_from(self.ids.settings_button, 10.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.social_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.social_press)
.set(self.ids.mmap_button_1, ui_widgets) .label("O")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.social_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.open_windows = match self.open_windows { self.open_windows = match self.open_windows {
@ -666,12 +738,17 @@ impl Hud {
} }
// 3 Spellbook // 3 Spellbook
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.spellbook_button)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(28.0, 25.0)
.down_from(self.ids.mmap_button_2, 0.0) .left_from(self.ids.map_button, 10.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.spellbook_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.spellbook_press)
.set(self.ids.mmap_button_3, ui_widgets) .label("P")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.spellbook_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.open_windows = match self.open_windows { self.open_windows = match self.open_windows {
@ -684,13 +761,19 @@ impl Hud {
Windows::Settings => Windows::Settings, Windows::Settings => Windows::Settings,
}; };
} }
// 4 Char-Window // 4 Char-Window
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.character_button)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(27.0, 25.0)
.down_from(self.ids.mmap_button_3, 0.0) .left_from(self.ids.spellbook_button, 10.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.character_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.character_press)
.set(self.ids.mmap_button_4, ui_widgets) .label("C")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.character_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.open_windows = match self.open_windows { self.open_windows = match self.open_windows {
@ -703,13 +786,19 @@ impl Hud {
Windows::Settings => Windows::Settings, Windows::Settings => Windows::Settings,
} }
} }
// 5 Quest-Log // 5 Quest-Log
if Button::image(self.imgs.mmap_button) if Button::image(self.imgs.qlog_button)
.w_h(448.0 / 15.0, 448.0 / 15.0) .w_h(23.0, 25.0)
.down_from(self.ids.mmap_button_4, 0.0) .left_from(self.ids.character_button, 10.0)
.hover_image(self.imgs.mmap_button_hover) .hover_image(self.imgs.qlog_hover)
.press_image(self.imgs.mmap_button_press) .press_image(self.imgs.qlog_press)
.set(self.ids.mmap_button_5, ui_widgets) .label("L")
.label_font_size(10)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
.set(self.ids.qlog_button, ui_widgets)
.was_clicked() .was_clicked()
{ {
self.open_windows = match self.open_windows { self.open_windows = match self.open_windows {
@ -724,6 +813,7 @@ impl Hud {
} }
} }
// Skillbar Module // Skillbar Module
// Experience-Bar // Experience-Bar
@ -862,40 +952,33 @@ impl Hud {
.w_h(40.0, 40.0) .w_h(40.0, 40.0)
.set(self.ids.inv_slot_0, ui_widgets); .set(self.ids.inv_slot_0, ui_widgets);
} }
// if self.ids.inv_slot.len() < self.inventory_space {
// self.ids.inv_slot.resize(self.inventory_space, &mut ui_widgets.widget_id_generator());
//}
//let num = self.ids.inv_slot.len();
//println!("self.ids.inv_slot.len(): {:?}", num);
//if num > 0 {
//Button::image(self.imgs.inv_slot)
//.top_left_with_margins_on(self.ids.inv_grid, 5.0, 5.0)
//.w_h(40.0, 40.0)
//.set(self.ids.inv_slot[0], ui_widgets);
//}
//for i in 1..5 {
//Button::image(self.imgs.inv_slot)
//.right(10.0)
//.label(&format!("{}", i + 1))
//.label_color(TEXT_COLOR)
//.label_font_size(5)
//.set(self.ids.inv_slot[i], ui_widgets);}
} }
// Bag // Bag
if !self.map_open { if !self.map_open && self.show_ui {
self.bag_open = ToggleButton::new(self.bag_open, self.imgs.bag, self.imgs.bag_open) self.bag_open = ToggleButton::new(self.bag_open, self.imgs.bag, self.imgs.bag_open)
.bottom_right_with_margins_on(ui_widgets.window, 5.0, 5.0) .bottom_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.hover_images(self.imgs.bag_hover, self.imgs.bag_open_hover) .hover_images(self.imgs.bag_hover, self.imgs.bag_open_hover)
.press_images(self.imgs.bag_press, self.imgs.bag_open_press) .press_images(self.imgs.bag_press, self.imgs.bag_open_press)
.w_h(420.0 / 6.0, 480.0 / 6.0) .w_h(420.0 / 10.0, 480.0 / 10.0)
.set(self.ids.bag, ui_widgets); .set(self.ids.bag, ui_widgets);
Text::new("B")
.bottom_right_with_margins_on(self.ids.bag, 0.0, 0.0)
.font_size(10)
.color(TEXT_COLOR)
.set(self.ids.bag_text, ui_widgets);
} else { } else {
Image::new(self.imgs.bag) Image::new(self.imgs.bag)
.bottom_right_with_margins_on(ui_widgets.window, 5.0, 5.0) .bottom_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.w_h(420.0 / 6.0, 480.0 / 6.0) .w_h(420.0 / 10.0, 480.0 / 10.0)
.set(self.ids.bag_map_open, ui_widgets); .set(self.ids.bag_map_open, ui_widgets);
Text::new("B")
.bottom_right_with_margins_on(self.ids.bag, 0.0, 0.0)
.font_size(10)
.color(TEXT_COLOR)
.set(self.ids.bag_text, ui_widgets);
} }
//Windows //Windows
@ -986,6 +1069,7 @@ impl Hud {
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo) .hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press) .press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.inventorytest_button, ui_widgets); .set(self.ids.inventorytest_button, ui_widgets);
Text::new("Show Inventory Test Button") Text::new("Show Inventory Test Button")
.right_from(self.ids.inventorytest_button, 10.0) .right_from(self.ids.inventorytest_button, 10.0)
.font_size(12) .font_size(12)
@ -994,13 +1078,17 @@ impl Hud {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(self.ids.inventorytest_button_label, ui_widgets); .set(self.ids.inventorytest_button_label, ui_widgets);
self.show_debug = self.show_debug = ToggleButton::new(
ToggleButton::new(self.show_debug, self.imgs.check, self.imgs.check_checked) self.show_debug,
self.imgs.check,
self.imgs.check_checked
)
.w_h(288.0 / 24.0, 288.0 / 24.0) .w_h(288.0 / 24.0, 288.0 / 24.0)
.top_left_with_margins_on(self.ids.rectangle, 65.0, 15.0) .top_left_with_margins_on(self.ids.rectangle, 65.0, 15.0)
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo) .hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press) .press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.debug_button, ui_widgets); .set(self.ids.debug_button, ui_widgets);
Text::new("Show Debug Window") Text::new("Show Debug Window")
.right_from(self.ids.debug_button, 10.0) .right_from(self.ids.debug_button, 10.0)
.font_size(12) .font_size(12)
@ -1010,12 +1098,14 @@ impl Hud {
.set(self.ids.debug_button_label, ui_widgets); .set(self.ids.debug_button_label, ui_widgets);
} }
// 2 Gameplay//////////////// // 2 Gameplay////////////////
if Button::image(if let SettingsTab::Gameplay = self.settings_tab { if Button::image(if let SettingsTab::Gameplay = self.settings_tab {
self.imgs.button_blue_mo self.imgs.button_blue_mo
} else { } else {
self.imgs.button_blank self.imgs.button_blank
}) }
)
.w_h(304.0 / 2.5, 80.0 / 2.5) .w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo) .hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press) .press_image(self.imgs.button_blue_press)
@ -1034,7 +1124,8 @@ impl Hud {
self.imgs.button_blue_mo self.imgs.button_blue_mo
} else { } else {
self.imgs.button_blank self.imgs.button_blank
}) }
)
.w_h(304.0 / 2.5, 80.0 / 2.5) .w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo) .hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press) .press_image(self.imgs.button_blue_press)
@ -1053,7 +1144,8 @@ impl Hud {
self.imgs.button_blue_mo self.imgs.button_blue_mo
} else { } else {
self.imgs.button_blank self.imgs.button_blank
}) }
)
.w_h(304.0 / 2.5, 80.0 / 2.5) .w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo) .hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press) .press_image(self.imgs.button_blue_press)
@ -1072,7 +1164,8 @@ impl Hud {
self.imgs.button_blue_mo self.imgs.button_blue_mo
} else { } else {
self.imgs.button_blank self.imgs.button_blank
}) }
)
.w_h(304.0 / 2.5, 80.0 / 2.5) .w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo) .hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press) .press_image(self.imgs.button_blue_press)
@ -1086,6 +1179,7 @@ impl Hud {
self.settings_tab = SettingsTab::Sound; self.settings_tab = SettingsTab::Sound;
} }
} }
if let Some((small, char_window_open)) = match self.open_windows { if let Some((small, char_window_open)) = match self.open_windows {
Windows::Small(small) => Some((small, false)), Windows::Small(small) => Some((small, false)),
Windows::CharacterAnd(Some(small)) => Some((small, true)), Windows::CharacterAnd(Some(small)) => Some((small, true)),
@ -1098,33 +1192,35 @@ impl Hud {
if char_window_open { if char_window_open {
Image::new(self.imgs.window_frame) Image::new(self.imgs.window_frame)
.right_from(self.ids.charwindow_frame, 20.0) .right_from(self.ids.charwindow_frame, 20.0)
.w_h(1648.0 / 4.0, 1952.0 / 4.0) .w_h(107.0*4.0, 125.0*4.0)
.set(self.ids.social_frame, ui_widgets); .set(self.ids.social_frame, ui_widgets);
} else { } else {
Image::new(self.imgs.window_frame) Image::new(self.imgs.window_frame)
.top_left_with_margins_on(ui_widgets.window, 200.0, 90.0) .top_left_with_margins_on(ui_widgets.window, 200.0, 10.0)
.w_h(1648.0 / 4.0, 1952.0 / 4.0) .w_h(1648.0 / 4.0, 1952.0 / 4.0)
.set(self.ids.social_frame, ui_widgets); .set(self.ids.social_frame, ui_widgets);
} }
//BG
Image::new(self.imgs.social_bg)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.middle_of(self.ids.social_frame)
.set(self.ids.social_bg, ui_widgets);
// Icon // Icon
Image::new(self.imgs.social_icon) Image::new(self.imgs.social_icon)
.w_h(224.0 / 3.0, 224.0 / 3.0) .w_h(40.0, 40.0)
.top_left_with_margins_on(self.ids.social_frame, -10.0, -10.0) .top_left_with_margins_on(self.ids.social_frame, 4.0, 4.0)
.set(self.ids.social_icon, ui_widgets); .set(self.ids.social_icon, ui_widgets);
// Content alignment
Rectangle::fill_with([362.0, 418.0], color::TRANSPARENT)
.bottom_right_with_margins_on(self.ids.social_frame, 17.0, 17.0)
.scroll_kids()
.scroll_kids_vertically()
.set(self.ids.social_bg, ui_widgets);
// X-Button // X-Button
if Button::image(self.imgs.close_button) if Button::image(self.imgs.close_button)
.w_h(244.0 * 0.22 / 4.0, 244.0 * 0.22 / 4.0) .w_h(20.0, 20.0)
.hover_image(self.imgs.close_button_hover) .hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press) .press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.social_frame, 4.0, 4.0) .top_right_with_margins_on(self.ids.social_frame, 17.0, 5.0)
.set(self.ids.social_close, ui_widgets) .set(self.ids.social_close, ui_widgets)
.was_clicked() .was_clicked()
{ {
@ -1136,7 +1232,9 @@ impl Hud {
} }
// Title // Title
Text::new("Social") Text::new("Social")
.mid_top_with_margin_on(self.ids.social_frame, 7.0) .mid_top_with_margin_on(self.ids.social_frame, 16.0)
.font_id(self.font_metamorph)
.font_size(14)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(self.ids.social_title, ui_widgets); .set(self.ids.social_title, ui_widgets);
} }
@ -1361,17 +1459,20 @@ impl Hud {
// 2 Map // 2 Map
if self.map_open { if self.map_open {
//Frame
Image::new(self.imgs.map_frame)
.middle_of(ui_widgets.window)
.w_h(5000.0 / 4.0, 3000.0 / 4.0)
.set(self.ids.map_frame, ui_widgets);
// BG // BG
Image::new(self.imgs.map_bg) Image::new(self.imgs.map_bg)
.w_h(5000.0 / 4.0, 3000.0 / 4.0) .w_h(824.0, 488.0)
.middle_of(self.ids.map_frame) .middle_of(ui_widgets.window)
.set(self.ids.map_bg, ui_widgets); .set(self.ids.map_bg, ui_widgets);
// Frame
Image::new(self.imgs.map_frame_l)
.top_left_with_margins_on(self.ids.map_bg, 0.0, 0.0)
.w_h(412.0, 488.0)
.set(self.ids.map_frame_l, ui_widgets);
Image::new(self.imgs.map_frame_r)
.top_right_with_margins_on(self.ids.map_bg, 0.0, 0.0)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.set(self.ids.map_frame_r, ui_widgets);
// Icon // Icon
Image::new(self.imgs.map_icon) Image::new(self.imgs.map_icon)
@ -1381,10 +1482,10 @@ impl Hud {
// X-Button // X-Button
if Button::image(self.imgs.close_button) if Button::image(self.imgs.close_button)
.w_h(244.0 * 0.22 / 1.0, 244.0 * 0.22 / 1.0) .w_h(4.0*2.0, 4.0*2.0)
.hover_image(self.imgs.close_button_hover) .hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press) .press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.map_frame, 1.0, 1.0) .top_right_with_margins_on(self.ids.map_frame_r, 1.0, 1.0)
.set(self.ids.map_close, ui_widgets) .set(self.ids.map_close, ui_widgets)
.was_clicked() .was_clicked()
{ {
@ -1392,12 +1493,13 @@ impl Hud {
} }
// Title // Title
Text::new("Map") Text::new("Map")
.mid_top_with_margin_on(self.ids.map_frame, -7.0) .mid_top_with_margin_on(self.ids.map_bg, -7.0)
.font_size(50) .font_size(50)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(self.ids.map_title, ui_widgets); .set(self.ids.map_title, ui_widgets);
} }
// ESC-MENU // ESC-MENU
// Background // Background
if self.menu_open { if self.menu_open {

View File

@ -5,6 +5,7 @@ use crate::{
}; };
use common::{ use common::{
assets, assets,
figure::Segment,
comp::character::{ comp::character::{
Character, Character,
Race, Race,
@ -33,7 +34,7 @@ widget_ids! {
bg_selection, bg_selection,
bg_creation, bg_creation,
v_logo, v_logo,
alpha_version, version,
// Windows // Windows
selection_window, selection_window,
@ -173,12 +174,12 @@ struct Imgs {
v_logo: ImgId, v_logo: ImgId,
bg_selection: ImgId, bg_selection: ImgId,
bg_creation: ImgId, bg_creation: ImgId,
button_dark: ImgId, button: ImgId,
button_dark_hover: ImgId, button_hover: ImgId,
button_dark_press: ImgId, button_press: ImgId,
button_dark_red: ImgId, button_red: ImgId,
button_dark_red_hover: ImgId, button_red_hover: ImgId,
button_dark_red_press: ImgId, button_red_press: ImgId,
selection_window: ImgId, selection_window: ImgId,
test_char_l_button: ImgId, test_char_l_button: ImgId,
test_char_l_big: ImgId, test_char_l_big: ImgId,
@ -241,7 +242,7 @@ struct Imgs {
} }
impl Imgs { impl Imgs {
fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs { fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs {
let mut load = |filename| { let load_img = |filename, ui: &mut Ui| {
let fullpath: String = ["/voxygen/", filename].concat(); let fullpath: String = ["/voxygen/", filename].concat();
let image = image::load_from_memory( let image = image::load_from_memory(
assets::load(fullpath.as_str()) assets::load(fullpath.as_str())
@ -251,75 +252,85 @@ impl Imgs {
.unwrap(); .unwrap();
ui.new_graphic(ui::Graphic::Image(image)) ui.new_graphic(ui::Graphic::Image(image))
}; };
let load_vox = |filename, ui: &mut Ui| {
let fullpath: String = ["/voxygen/", filename].concat();
let dot_vox = dot_vox::load_bytes(
assets::load(fullpath.as_str())
.expect("Error loading file")
.as_slice(),
)
.unwrap();
ui.new_graphic(ui::Graphic::Voxel(Segment::from(dot_vox)))
};
Imgs { Imgs {
v_logo: load("element/v_logo.png"), v_logo: load_vox("element/v_logo.vox", ui),
bg_selection: load("background/bg_selection.png"), bg_selection: load_img("background/bg_selection.png", ui),
bg_creation: load("background/bg_creation.png"), bg_creation: load_img("background/bg_creation.png", ui),
selection_window: load("element/frames/selection.png"), selection_window: load_img("element/frames/selection.png", ui),
button_dark: load("element/buttons/button_dark.png"), button: load_vox("element/buttons/button.vox", ui),
button_dark_hover: load("element/buttons/button_dark_hover.png"), button_hover: load_vox("element/buttons/button_hover.vox", ui),
button_dark_press: load("element/buttons/button_dark_press.png"), button_press: load_vox("element/buttons/button_press.vox", ui),
button_dark_red: load("element/buttons/button_dark_red.png"), button_red: load_vox("element/buttons/button_red.vox", ui),
button_dark_red_hover: load("element/buttons/button_dark_red_hover.png"), button_red_hover: load_vox("element/buttons/button_red_hover.vox", ui),
button_dark_red_press: load("element/buttons/button_dark_red_press.png"), button_red_press: load_vox("element/buttons/button_red_press.vox", ui),
test_char_l_button: load("element/misc_backgrounds/test_char_l.png"), test_char_l_button: load_img("element/misc_bg/test_char_l.png", ui),
test_char_l_big: load("element/misc_backgrounds/test_char_l_big.png"), test_char_l_big: load_img("element/misc_bg/test_char_l_big.png", ui),
name_input: load("element/misc_backgrounds/textbox.png"), name_input: load_vox("element/misc_bg/textbox.vox", ui),
creation_window: load("element/frames/char_creation.png"), creation_window: load_img("element/frames/char_creation.png", ui),
creation_window_body: load("element/frames/body_creation.png"), creation_window_body: load_img("element/frames/body_creation.png", ui),
frame_closed: load("element/buttons/frame/closed.png"), frame_closed: load_img("element/buttons/frame/closed.png", ui),
frame_closed_mo: load("element/buttons/frame/closed_mo.png"), frame_closed_mo: load_img("element/buttons/frame/closed_mo.png", ui),
frame_closed_press: load("element/buttons/frame/closed_press.png"), frame_closed_press: load_img("element/buttons/frame/closed_press.png", ui),
frame_open: load("element/buttons/frame/open.png"), frame_open: load_img("element/buttons/frame/open.png", ui),
frame_open_mo: load("element/buttons/frame/open_mo.png"), frame_open_mo: load_img("element/buttons/frame/open_mo.png", ui),
frame_open_press: load("element/buttons/frame/open_press.png"), frame_open_press: load_img("element/buttons/frame/open_press.png", ui),
skin_eyes_window: load("element/frames/skin_eyes.png"), skin_eyes_window: load_img("element/frames/skin_eyes.png", ui),
hair_window: load("element/frames/skin_eyes.png"), hair_window: load_img("element/frames/skin_eyes.png", ui),
accessories_window: load("element/frames/skin_eyes.png"), accessories_window: load_img("element/frames/skin_eyes.png", ui),
color_picker_bg: load("element/misc_backgrounds/color_picker_blank.png"), color_picker_bg: load_img("element/misc_bg/color_picker_blank.png", ui),
slider_range: load("element/slider/track.png"), slider_range: load_img("element/slider/track.png", ui),
slider_indicator: load("element/slider/indicator.png"), slider_indicator: load_img("element/slider/indicator.png", ui),
window_frame_2: load("element/frames/window_2.png"), window_frame_2: load_img("element/frames/window_2.png", ui),
// Weapon Icons // Weapon Icons
daggers: load("element/icons/daggers.png"), daggers: load_img("element/icons/daggers.png", ui),
sword_shield: load("element/icons/swordshield.png"), sword_shield: load_img("element/icons/swordshield.png", ui),
sword: load("element/icons/sword.png"), sword: load_img("element/icons/sword.png", ui),
axe: load("element/icons/axe.png"), axe: load_img("element/icons/axe.png", ui),
hammer: load("element/icons/hammer.png"), hammer: load_img("element/icons/hammer.png", ui),
bow: load("element/icons/bow.png"), bow: load_img("element/icons/bow.png", ui),
staff: load("element/icons/staff.png"), staff: load_img("element/icons/staff.png", ui),
//test_char_m_button: load("test_char_m_button"), //test_char_m_button: load_img("test_char_m_button"),
//test_char_r_button: load("test_char_r_button"), //test_char_r_button: load_img("test_char_r_button"),
// Race Icons // Race Icons
male: load("element/icons/male.png"), male: load_img("element/icons/male.png", ui),
female: load("element/icons/female.png"), female: load_img("element/icons/female.png", ui),
human_m: load("element/icons/human_m.png"), human_m: load_img("element/icons/human_m.png", ui),
human_f: load("element/icons/human_f.png"), human_f: load_img("element/icons/human_f.png", ui),
orc_m: load("element/icons/orc_m.png"), orc_m: load_img("element/icons/orc_m.png", ui),
orc_f: load("element/icons/orc_f.png"), orc_f: load_img("element/icons/orc_f.png", ui),
dwarf_m: load("element/icons/dwarf_m.png"), dwarf_m: load_img("element/icons/dwarf_m.png", ui),
dwarf_f: load("element/icons/dwarf_f.png"), dwarf_f: load_img("element/icons/dwarf_f.png", ui),
undead_m: load("element/icons/ud_m.png"), undead_m: load_img("element/icons/ud_m.png", ui),
undead_f: load("element/icons/ud_f.png"), undead_f: load_img("element/icons/ud_f.png", ui),
elf_m: load("element/icons/elf_m.png"), elf_m: load_img("element/icons/elf_m.png", ui),
elf_f: load("element/icons/elf_f.png"), elf_f: load_img("element/icons/elf_f.png", ui),
danari_m: load("element/icons/danari_m.png"), danari_m: load_img("element/icons/danari_m.png", ui),
danari_f: load("element/icons/danari_f.png"), danari_f: load_img("element/icons/danari_f.png", ui),
// Arrows // Arrows
arrow_left: load("element/buttons/arrow/left.png"), arrow_left: load_img("element/buttons/arrow/left.png", ui),
arrow_left_mo: load("element/buttons/arrow/left_mo.png"), arrow_left_mo: load_img("element/buttons/arrow/left_mo.png", ui),
arrow_left_press: load("element/buttons/arrow/left_press.png"), arrow_left_press: load_img("element/buttons/arrow/left_press.png", ui),
arrow_left_grey: load("element/buttons/arrow/left_inactive.png"), arrow_left_grey: load_img("element/buttons/arrow/left_inactive.png", ui),
arrow_right: load("element/buttons/arrow/right.png"), arrow_right: load_img("element/buttons/arrow/right.png", ui),
arrow_right_mo: load("element/buttons/arrow/right_mo.png"), arrow_right_mo: load_img("element/buttons/arrow/right_mo.png", ui),
arrow_right_press: load("element/buttons/arrow/right_press.png"), arrow_right_press: load_img("element/buttons/arrow/right_press.png", ui),
arrow_right_grey: load("element/buttons/arrow/right_inactive.png"), arrow_right_grey: load_img("element/buttons/arrow/right_inactive.png", ui),
// Icon Borders // Icon Borders
icon_border: load("element/buttons/border.png"), icon_border: load_img("element/buttons/border.png", ui),
icon_border_mo: load("element/buttons/border_mo.png"), icon_border_mo: load_img("element/buttons/border_mo.png", ui),
icon_border_press: load("element/buttons/border_press.png"), icon_border_press: load_img("element/buttons/border_press.png", ui),
icon_border_pressed: load("element/buttons/border_pressed.png"), icon_border_pressed: load_img("element/buttons/border_pressed.png", ui),
} }
} }
} }
@ -415,11 +426,11 @@ impl CharSelectionUi {
.set(self.ids.bg_selection, ui_widgets); .set(self.ids.bg_selection, ui_widgets);
// Logout_Button // Logout_Button
if Button::image(self.imgs.button_dark) if Button::image(self.imgs.button)
.bottom_left_with_margins_on(self.ids.bg_selection, 10.0, 10.0) .bottom_left_with_margins_on(self.ids.bg_selection, 10.0, 10.0)
.w_h(150.0, 40.0) .w_h(150.0, 40.0)
.hover_image(self.imgs.button_dark_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_dark_press) .press_image(self.imgs.button_press)
.label("Logout") .label("Logout")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(18) .label_font_size(18)
@ -431,11 +442,11 @@ impl CharSelectionUi {
} }
// Create Character Button // Create Character Button
if Button::image(self.imgs.button_dark) if Button::image(self.imgs.button)
.mid_bottom_with_margin_on(self.ids.bg_selection, 10.0) .mid_bottom_with_margin_on(self.ids.bg_selection, 10.0)
.w_h(270.0, 50.0) .w_h(270.0, 50.0)
.hover_image(self.imgs.button_dark_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_dark_press) .press_image(self.imgs.button_press)
.label("Create Character") .label("Create Character")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(20) .label_font_size(20)
@ -459,15 +470,15 @@ impl CharSelectionUi {
} }
// Veloren Logo and Alpha Version // Veloren Logo and Alpha Version
Button::image(self.imgs.v_logo) Image::new(self.imgs.v_logo)
.w_h(346.0, 111.0) .w_h(123.0*3.0, 35.0*3.0)
.top_left_with_margins_on(self.ids.bg_selection, 30.0, 40.0) .top_left_with_margins(30.0, 30.0)
.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))
.label_x(conrod_core::position::Relative::Scalar(-100.0))
.set(self.ids.v_logo, ui_widgets); .set(self.ids.v_logo, ui_widgets);
Text::new(version)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14)
.color(TEXT_COLOR)
.set(self.ids.version, ui_widgets);
// Click Character to Login <-- Temporary! // Click Character to Login <-- Temporary!
Image::new(self.imgs.window_frame_2) Image::new(self.imgs.window_frame_2)
.mid_top_with_margin_on(self.ids.bg_selection, 60.0) .mid_top_with_margin_on(self.ids.bg_selection, 60.0)
@ -506,11 +517,11 @@ impl CharSelectionUi {
} }
// Enter World Button // Enter World Button
if Button::image(self.imgs.button_dark) if Button::image(self.imgs.button)
.mid_bottom_with_margin_on(self.ids.selection_window, 65.0) .mid_bottom_with_margin_on(self.ids.selection_window, 65.0)
.w_h(210.0, 55.0) .w_h(210.0, 55.0)
.hover_image(self.imgs.button_dark_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_dark_press) .press_image(self.imgs.button_press)
.label("Enter World") .label("Enter World")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(22) .label_font_size(22)
@ -523,11 +534,11 @@ impl CharSelectionUi {
} }
// Delete Button // Delete Button
if Button::image(self.imgs.button_dark_red) if Button::image(self.imgs.button_red)
.bottom_right_with_margins_on(self.ids.selection_window, -25.0, 0.0) .bottom_right_with_margins_on(self.ids.selection_window, -25.0, 0.0)
.w_h(100.0, 20.0) .w_h(100.0, 20.0)
.hover_image(self.imgs.button_dark_red_hover) .hover_image(self.imgs.button_red_hover)
.press_image(self.imgs.button_dark_red_press) .press_image(self.imgs.button_red_press)
.label("Delete") .label("Delete")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(12) .label_font_size(12)
@ -544,11 +555,11 @@ impl CharSelectionUi {
.middle_of(ui_widgets.window) .middle_of(ui_widgets.window)
.set(self.ids.bg_creation, ui_widgets); .set(self.ids.bg_creation, ui_widgets);
// Back Button // Back Button
if Button::image(self.imgs.button_dark) if Button::image(self.imgs.button)
.bottom_left_with_margins_on(self.ids.bg_creation, 10.0, 10.0) .bottom_left_with_margins_on(self.ids.bg_creation, 10.0, 10.0)
.w_h(150.0, 40.0) .w_h(150.0, 40.0)
.hover_image(self.imgs.button_dark_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_dark_press) .press_image(self.imgs.button_press)
.label("Back") .label("Back")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(18) .label_font_size(18)
@ -559,11 +570,11 @@ impl CharSelectionUi {
self.character_creation = false; self.character_creation = false;
} }
// Create Button // Create Button
if Button::image(self.imgs.button_dark) if Button::image(self.imgs.button)
.bottom_right_with_margins_on(self.ids.bg_creation, 10.0, 10.0) .bottom_right_with_margins_on(self.ids.bg_creation, 10.0, 10.0)
.w_h(150.0, 40.0) .w_h(150.0, 40.0)
.hover_image(self.imgs.button_dark_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_dark_press) .press_image(self.imgs.button_press)
.label("Create") .label("Create")
.label_color(TEXT_COLOR) .label_color(TEXT_COLOR)
.label_font_size(18) .label_font_size(18)

View File

@ -45,6 +45,7 @@ widget_ids! {
// Error // Error
error_frame, error_frame,
button_ok, button_ok,
version,
} }
} }
@ -54,18 +55,13 @@ struct Imgs {
input_bg: ImgId, input_bg: ImgId,
login_button: ImgId,
login_button_hover: ImgId,
login_button_press: ImgId,
button: ImgId,
button_hover: ImgId,
button_press: ImgId,
error_frame: ImgId, error_frame: ImgId,
button_dark: ImgId, button_dark: ImgId,
button_dark_hover: ImgId, button_dark_hover: ImgId,
button_dark_press: ImgId, button_dark_press: ImgId,
button: ImgId,
button_hover: ImgId,
button_press: ImgId,
} }
impl Imgs { impl Imgs {
fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs { fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs {
@ -91,27 +87,18 @@ impl Imgs {
}; };
Imgs { Imgs {
bg: load_img("background/bg_main.png", ui), bg: load_img("background/bg_main.png", ui),
v_logo: load_img("element/v_logo.png", ui), v_logo: load_vox("element/v_logo.vox", ui),
// Input fields // Input fields
input_bg: load_img("element/misc_backgrounds/textbox.png", ui), input_bg: load_vox("element/misc_bg/textbox.vox", ui),
// Login button
login_button: load_img("element/buttons/button_login.png", ui),
login_button_hover: load_img("element/buttons/button_login_hover.png", ui),
login_button_press: load_img("element/buttons/button_login_press.png", ui),
// Servers, settings, and quit buttons
//button: load_vox("element/buttons/button.vox", ui),
button: load_img("element/buttons/button.png", ui),
button_hover: load_img("element/buttons/button_hover.png", ui),
button_press: load_img("element/buttons/button_press.png", ui),
//Error
error_frame: load_img("element/frames/window_2.png", ui), error_frame: load_img("element/frames/window_2.png", ui),
button_dark: load_img("element/buttons/button_dark.png", ui), button_dark: load_vox("element/buttons/button_dark.vox", ui),
button_dark_hover: load_img("element/buttons/button_dark_hover.png", ui), button_dark_hover: load_vox("element/buttons/button_dark_hover.vox", ui),
button_dark_press: load_img("element/buttons/button_dark_press.png", ui), button_dark_press: load_vox("element/buttons/button_dark_press.vox", ui),
button: load_vox("element/buttons/button.vox", ui),
button_hover: load_vox("element/buttons/button_hover.vox", ui),
button_press: load_vox("element/buttons/button_press.vox", ui),
} }
} }
} }
@ -184,16 +171,15 @@ impl MainMenuUi {
Image::new(self.imgs.bg) Image::new(self.imgs.bg)
.middle_of(ui_widgets.window) .middle_of(ui_widgets.window)
.set(self.ids.bg, ui_widgets); .set(self.ids.bg, ui_widgets);
Button::image(self.imgs.v_logo) Image::new(self.imgs.v_logo)
.w_h(346.0, 111.0) .w_h(123.0*3.0, 35.0*3.0)
.top_left_with_margins(30.0, 40.0) .top_left_with_margins(30.0, 30.0)
.label(version)
.label_rgba(1.0, 1.0, 1.0, 1.0)
.label_font_size(10)
.label_y(Relative::Scalar(-40.0))
.label_x(Relative::Scalar(-100.0))
.set(self.ids.v_logo, ui_widgets); .set(self.ids.v_logo, ui_widgets);
Text::new(version)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14)
.color(TEXT_COLOR)
.set(self.ids.version, ui_widgets);
// Input fields // Input fields
// Used when the login button is pressed, or enter is pressed within input field // Used when the login button is pressed, or enter is pressed within input field
macro_rules! login { macro_rules! login {
@ -368,7 +354,7 @@ impl MainMenuUi {
// Login button // Login button
// Change button text and remove hover/press images if a connection is in progress // Change button text and remove hover/press images if a connection is in progress
if let Some(start) = self.connecting { if let Some(start) = self.connecting {
Button::image(self.imgs.login_button) Button::image(self.imgs.button)
.w_h(258.0, 68.0) .w_h(258.0, 68.0)
.down_from(self.ids.address_bg, 20.0) .down_from(self.ids.address_bg, 20.0)
.align_middle_x_of(self.ids.address_bg) .align_middle_x_of(self.ids.address_bg)
@ -386,9 +372,9 @@ impl MainMenuUi {
.label_y(Relative::Scalar(5.0)) .label_y(Relative::Scalar(5.0))
.set(self.ids.login_button, ui_widgets); .set(self.ids.login_button, ui_widgets);
} else { } else {
if Button::image(self.imgs.login_button) if Button::image(self.imgs.button)
.hover_image(self.imgs.login_button_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.login_button_press) .press_image(self.imgs.button_press)
.w_h(258.0, 68.0) .w_h(258.0, 68.0)
.down_from(self.ids.address_bg, 20.0) .down_from(self.ids.address_bg, 20.0)
.align_middle_x_of(self.ids.address_bg) .align_middle_x_of(self.ids.address_bg)
@ -404,9 +390,9 @@ impl MainMenuUi {
}; };
// Singleplayer button // Singleplayer button
if Button::image(self.imgs.login_button) if Button::image(self.imgs.button)
.hover_image(self.imgs.login_button_hover) .hover_image(self.imgs.button_hover)
.press_image(self.imgs.login_button_press) .press_image(self.imgs.button_press)
.w_h(258.0, 68.0) .w_h(258.0, 68.0)
.down_from(self.ids.login_button, 20.0) .down_from(self.ids.login_button, 20.0)
.align_middle_x_of(self.ids.address_bg) .align_middle_x_of(self.ids.address_bg)