FPS display moved, changes to windows

Former-commit-id: 141d250e29273f59edf661eff7fc7ebd88754435
This commit is contained in:
Pfauenauge90 2019-04-26 18:13:30 +02:00 committed by Pfauenauge
parent 33515bd04c
commit 0afbba3303

View File

@ -6,9 +6,7 @@ use crate::{
window::{Event as WinEvent, Key, Window},
GlobalState,
};
use common::{
assets,
figure::Segment};
use common::{assets, figure::Segment};
use conrod_core::{
color,
@ -24,13 +22,13 @@ widget_ids! {
bag_space_add,
inventorytest_button,
inventorytest_button_label,
//Debug
// Debug
debug_bg,
debug_button,
debug_button_label,
fps_counter,
// Logo
v_logo,
// Game Version
version,
// Bag and Inventory
bag,
@ -282,7 +280,7 @@ pub(self) struct Imgs {
}
impl Imgs {
fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs {
let mut load_img = |filename, ui: &mut Ui| {
let mut load_img = |filename, ui: &mut Ui| {
let fullpath: String = ["/voxygen/", filename].concat();
let image = image::load_from_memory(
assets::load(fullpath.as_str())
@ -302,9 +300,9 @@ impl Imgs {
.unwrap();
ui.new_graphic(ui::Graphic::Voxel(Segment::from(dot_vox)))
};
Imgs {
Imgs {
// Bag
bag: load_img("element/buttons/bag/closed.png", ui),
bag: load_img("element/buttons/bag/closed.png", ui),
bag_hover: load_img("element/buttons/bag/closed_hover.png", ui),
bag_press: load_img("element/buttons/bag/closed_press.png", ui),
bag_open: load_img("element/buttons/bag/open.png", ui),
@ -315,7 +313,6 @@ impl Imgs {
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),
@ -361,7 +358,6 @@ impl Imgs {
mmap_frame: load_vox("element/frames/mmap.vox", ui),
mmap_frame_bg: load_img("element/misc_bg/mmap_bg.png", ui),
// Skillbar Module
sb_grid: load_img("element/skill_bar/sbar_grid.png", ui),
sb_grid_bg: load_img("element/skill_bar/sbar_grid_bg.png", ui),
@ -386,7 +382,7 @@ impl Imgs {
check_checked_mo: load_img("element/buttons/check/yes_mo.png", ui),
slider: load_img("element/slider/track.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_img("element/buttons/blue_mo.png", ui),
button_blue_press: load_img("element/buttons/blue_press.png", ui),
@ -424,7 +420,6 @@ impl Imgs {
chat_arrow: load_img("element/buttons/arrow/chat_arrow.png", ui),
chat_arrow_mo: load_img("element/buttons/arrow/chat_arrow_mo.png", ui),
chat_arrow_press: load_img("element/buttons/arrow/chat_arrow_press.png", ui),
}
}
}
@ -550,15 +545,18 @@ impl Hud {
// Display debug window
if self.show_debug {
Image::new(self.imgs.window_frame_2)
.down_from(self.ids.mmap_frame, 20.0)
.w_h(300.0, 350.0)
.set(self.ids.debug_bg, ui_widgets);
// Alpha Version
Text::new(version)
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14)
.font_id(self.font_opensans)
.color(TEXT_COLOR)
.set(self.ids.version, ui_widgets);
Text::new(&format!("FPS: {:.1}", tps))
.color(TEXT_COLOR)
.top_left_with_margins_on(self.ids.debug_bg, 20.0, 20.0)
.down_from(self.ids.version, 5.0)
.font_id(self.font_opensans)
.font_size(18)
.font_size(14)
.set(self.ids.fps_counter, ui_widgets);
}
@ -586,13 +584,6 @@ 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)
@ -608,13 +599,13 @@ impl Hud {
F2 = Toggle Interface \n\
\n\
Enter = Open Chat \n\
Mouse Wheel = Scroll Chat"
Mouse Wheel = Scroll Chat",
)
.color(TEXT_COLOR)
.top_left_with_margins_on(self.ids.help_bg, 20.0, 20.0)
.font_id(self.font_opensans)
.font_size(18)
.set(self.ids.help, ui_widgets);
.color(TEXT_COLOR)
.top_left_with_margins_on(self.ids.help_bg, 20.0, 20.0)
.font_id(self.font_opensans)
.font_size(18)
.set(self.ids.help, ui_widgets);
// X-button
if Button::image(self.imgs.close_button)
@ -631,18 +622,17 @@ impl Hud {
// Minimap frame and bg
//Image::new(self.imgs.mmap_frame_bg)
//.w_h(1750.0 / 8.0, 1650.0 / 8.0)
//.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
//.set(self.ids.mmap_frame_bg, ui_widgets);
//.w_h(1750.0 / 8.0, 1650.0 / 8.0)
//.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
//.set(self.ids.mmap_frame_bg, ui_widgets);
Image::new(self.imgs.mmap_frame)
.w_h(100.0*2.5, 100.0*2.5)
.w_h(100.0 * 2.0, 100.0 * 2.0)
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.set(self.ids.mmap_frame, ui_widgets);
Rectangle::fill_with([92.0*2.5, 82.0*2.5], color::RED)
.mid_top_with_margin_on(self.ids.mmap_frame, 13.0*2.5+2.5)
Rectangle::fill_with([92.0 * 2.0, 82.0 * 2.0], color::TRANSPARENT)
.mid_top_with_margin_on(self.ids.mmap_frame, 13.0 * 2.0 + 2.0)
.set(self.ids.mmap_frame_bg, ui_widgets);
// Title
@ -663,6 +653,8 @@ impl Hud {
.press_image(self.imgs.settings_press)
.label("N")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.color(TEXT_COLOR)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
@ -684,6 +676,7 @@ impl Hud {
.press_image(self.imgs.map_press)
.label("M")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
@ -717,7 +710,8 @@ impl Hud {
if match self.open_windows {
Windows::Settings => false,
_ => true,
} && self.map_open == false {
} && self.map_open == false
{
// 1 Social
if Button::image(self.imgs.social_button)
.w_h(25.0, 25.0)
@ -726,6 +720,7 @@ impl Hud {
.press_image(self.imgs.social_press)
.label("O")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
@ -751,6 +746,7 @@ impl Hud {
.press_image(self.imgs.spellbook_press)
.label("P")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
@ -776,6 +772,7 @@ impl Hud {
.press_image(self.imgs.character_press)
.label("C")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.label_color(TEXT_COLOR)
.label_y(conrod_core::position::Relative::Scalar(-7.0))
.label_x(conrod_core::position::Relative::Scalar(10.0))
@ -793,20 +790,21 @@ impl Hud {
}
}
// 5 Quest-Log
if Button::image(self.imgs.qlog_button)
.w_h(23.0, 25.0)
.left_from(self.ids.character_button, 10.0)
.hover_image(self.imgs.qlog_hover)
.press_image(self.imgs.qlog_press)
.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()
{
// 5 Quest-Log
if Button::image(self.imgs.qlog_button)
.w_h(23.0, 25.0)
.left_from(self.ids.character_button, 10.0)
.hover_image(self.imgs.qlog_hover)
.press_image(self.imgs.qlog_press)
.label("L")
.label_font_size(10)
.label_font_id(self.font_metamorph)
.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()
{
self.open_windows = match self.open_windows {
Windows::Small(Small::Questlog) => Windows::None,
Windows::None | Windows::Small(_) => Windows::Small(Small::Questlog),
@ -819,7 +817,6 @@ impl Hud {
}
}
// Skillbar Module
// Experience-Bar
@ -916,54 +913,54 @@ impl Hud {
.set(self.ids.next_level_text, ui_widgets);
// Bag contents
if self.bag_open {
// Contents
Image::new(self.imgs.bag_contents)
.w_h(68.0*4.0, 123.0*4.0)
.bottom_right_with_margins_on(ui_widgets.window, 90.0, 5.0)
.set(self.ids.bag_contents, ui_widgets);
if self.bag_open {
// Contents
Image::new(self.imgs.bag_contents)
.w_h(68.0 * 4.0, 123.0 * 4.0)
.bottom_right_with_margins_on(ui_widgets.window, 90.0, 5.0)
.set(self.ids.bag_contents, ui_widgets);
// Alignment for Grid
Rectangle::fill_with([(58.0*4.0)-5.0, 100.0*4.0], color::TRANSPARENT)
.top_left_with_margins_on(self.ids.bag_contents, 11.0*4.0, 5.0*4.0)
.scroll_kids()
.scroll_kids_vertically()
.set(self.ids.inv_alignment, ui_widgets);
// Grid
Image::new(self.imgs.inv_grid)
.w_h(58.0*4.0, 111.0*4.0)
.mid_top_with_margin_on(self.ids.inv_alignment, 0.0)
.set(self.ids.inv_grid_1, ui_widgets);
Image::new(self.imgs.inv_grid)
.w_h(58.0*4.0, 111.0*4.0)
.mid_top_with_margin_on(self.ids.inv_alignment, 110.0*4.0)
.set(self.ids.inv_grid_2, ui_widgets);
Scrollbar::y_axis(self.ids.inv_alignment)
.thickness(5.0)
.rgba(0.33, 0.33, 0.33, 1.0)
.set(self.ids.inv_scrollbar, ui_widgets);
// Alignment for Grid
Rectangle::fill_with([(58.0 * 4.0) - 5.0, 100.0 * 4.0], color::TRANSPARENT)
.top_left_with_margins_on(self.ids.bag_contents, 11.0 * 4.0, 5.0 * 4.0)
.scroll_kids()
.scroll_kids_vertically()
.set(self.ids.inv_alignment, ui_widgets);
// Grid
Image::new(self.imgs.inv_grid)
.w_h(58.0 * 4.0, 111.0 * 4.0)
.mid_top_with_margin_on(self.ids.inv_alignment, 0.0)
.set(self.ids.inv_grid_1, ui_widgets);
Image::new(self.imgs.inv_grid)
.w_h(58.0 * 4.0, 111.0 * 4.0)
.mid_top_with_margin_on(self.ids.inv_alignment, 110.0 * 4.0)
.set(self.ids.inv_grid_2, ui_widgets);
Scrollbar::y_axis(self.ids.inv_alignment)
.thickness(5.0)
.rgba(0.33, 0.33, 0.33, 1.0)
.set(self.ids.inv_scrollbar, ui_widgets);
// X-button
if Button::image(self.imgs.close_button)
.w_h(4.0*4.0, 4.0*4.0)
.hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.bag_contents, 4.5, 4.5)
.set(self.ids.bag_close, ui_widgets)
.was_clicked()
{
self.bag_open = false;
}
if self.inventory_space > 0 {
// First Slot
Button::image(self.imgs.inv_slot)
.top_left_with_margins_on(self.ids.inv_grid_1, 4.0, 4.0)
.w_h(10.0*4.0, 10.0*4.0)
.set(self.ids.inv_slot_0, ui_widgets);
}
// X-button
if Button::image(self.imgs.close_button)
.w_h(4.0 * 4.0, 4.0 * 4.0)
.hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.bag_contents, 4.5, 4.5)
.set(self.ids.bag_close, ui_widgets)
.was_clicked()
{
self.bag_open = false;
}
if self.inventory_space > 0 {
// First Slot
Button::image(self.imgs.inv_slot)
.top_left_with_margins_on(self.ids.inv_grid_1, 4.0, 4.0)
.w_h(10.0 * 4.0, 10.0 * 4.0)
.set(self.ids.inv_slot_0, ui_widgets);
}
}
// Bag
if !self.map_open && self.show_ui {
self.bag_open = ToggleButton::new(self.bag_open, self.imgs.bag, self.imgs.bag_open)
@ -972,9 +969,10 @@ impl Hud {
.press_images(self.imgs.bag_press, self.imgs.bag_open_press)
.w_h(420.0 / 10.0, 480.0 / 10.0)
.set(self.ids.bag, ui_widgets);
Text::new("B")
Text::new("B")
.bottom_right_with_margins_on(self.ids.bag, 0.0, 0.0)
.font_size(10)
.font_id(self.font_metamorph)
.color(TEXT_COLOR)
.set(self.ids.bag_text, ui_widgets);
} else {
@ -985,9 +983,8 @@ impl Hud {
Text::new("B")
.bottom_right_with_margins_on(self.ids.bag, 0.0, 0.0)
.font_size(10)
.color(TEXT_COLOR)
.font_id(self.font_metamorph)
.set(self.ids.bag_text, ui_widgets);
}
//Windows
@ -999,7 +996,7 @@ impl Hud {
if let Windows::Settings = self.open_windows {
// BG
Image::new(self.imgs.settings_bg)
Image::new(self.imgs.window_frame)
.middle_of(ui_widgets.window)
.w_h(1648.0 / 2.5, 1952.0 / 2.5)
.set(self.ids.settings_bg, ui_widgets);
@ -1073,11 +1070,11 @@ impl Hud {
self.imgs.check,
self.imgs.check_checked,
)
.w_h(288.0 / 24.0, 288.0 / 24.0)
.top_left_with_margins_on(self.ids.rectangle, 40.0, 15.0)
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.inventorytest_button, ui_widgets);
.w_h(288.0 / 24.0, 288.0 / 24.0)
.top_left_with_margins_on(self.ids.rectangle, 40.0, 15.0)
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.inventorytest_button, ui_widgets);
Text::new("Show Inventory Test Button")
.right_from(self.ids.inventorytest_button, 10.0)
@ -1087,16 +1084,13 @@ impl Hud {
.color(TEXT_COLOR)
.set(self.ids.inventorytest_button_label, ui_widgets);
self.show_debug = ToggleButton::new(
self.show_debug,
self.imgs.check,
self.imgs.check_checked
)
.w_h(288.0 / 24.0, 288.0 / 24.0)
.top_left_with_margins_on(self.ids.rectangle, 65.0, 15.0)
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.debug_button, ui_widgets);
self.show_debug =
ToggleButton::new(self.show_debug, self.imgs.check, self.imgs.check_checked)
.w_h(288.0 / 24.0, 288.0 / 24.0)
.top_left_with_margins_on(self.ids.rectangle, 65.0, 15.0)
.hover_images(self.imgs.check_checked_mo, self.imgs.check_mo)
.press_images(self.imgs.check_press, self.imgs.check_press)
.set(self.ids.debug_button, ui_widgets);
Text::new("Show Debug Window")
.right_from(self.ids.debug_button, 10.0)
@ -1105,85 +1099,80 @@ impl Hud {
.graphics_for(self.ids.debug_button)
.color(TEXT_COLOR)
.set(self.ids.debug_button_label, ui_widgets);
}
// 2 Gameplay////////////////
if Button::image(if let SettingsTab::Gameplay = self.settings_tab {
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
}
)
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.interface, 1.0)
.label("Gameplay")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.gameplay, ui_widgets)
.was_clicked()
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
})
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.interface, 1.0)
.label("Gameplay")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.gameplay, ui_widgets)
.was_clicked()
{
self.settings_tab = SettingsTab::Gameplay;
}
// 3 Controls/////////////////////
if Button::image(if let SettingsTab::Controls = self.settings_tab {
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
}
)
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.gameplay, 1.0)
.label("Controls")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.controls, ui_widgets)
.was_clicked()
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
})
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.gameplay, 1.0)
.label("Controls")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.controls, ui_widgets)
.was_clicked()
{
self.settings_tab = SettingsTab::Controls;
}
// 4 Video////////////////////////////////
if Button::image(if let SettingsTab::Video = self.settings_tab {
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
}
)
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.controls, 1.0)
.label("Video")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.video, ui_widgets)
.was_clicked()
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
})
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.controls, 1.0)
.label("Video")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.video, ui_widgets)
.was_clicked()
{
self.settings_tab = SettingsTab::Video;
}
// 5 Sound///////////////////////////////
if Button::image(if let SettingsTab::Sound = self.settings_tab {
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
}
)
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.video, 1.0)
.label("Sound")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.sound, ui_widgets)
.was_clicked()
self.imgs.button_blue_mo
} else {
self.imgs.button_blank
})
.w_h(304.0 / 2.5, 80.0 / 2.5)
.hover_image(self.imgs.button_blue_mo)
.press_image(self.imgs.button_blue_press)
.down_from(self.ids.video, 1.0)
.label("Sound")
.label_font_size(14)
.label_color(TEXT_COLOR)
.set(self.ids.sound, ui_widgets)
.was_clicked()
{
self.settings_tab = SettingsTab::Sound;
}
@ -1201,12 +1190,12 @@ impl Hud {
if char_window_open {
Image::new(self.imgs.window_frame)
.right_from(self.ids.charwindow_frame, 20.0)
.w_h(107.0*4.0, 125.0*4.0)
.w_h(107.0 * 4.0, 125.0 * 4.0)
.set(self.ids.social_frame, ui_widgets);
} else {
Image::new(self.imgs.window_frame)
.top_left_with_margins_on(ui_widgets.window, 200.0, 10.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);
}
@ -1223,7 +1212,6 @@ impl Hud {
.scroll_kids_vertically()
.set(self.ids.social_bg, ui_widgets);
// X-Button
if Button::image(self.imgs.close_button)
.w_h(20.0, 20.0)
@ -1252,33 +1240,34 @@ impl Hud {
if char_window_open {
Image::new(self.imgs.window_frame)
.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.spellbook_frame, ui_widgets);
} else {
Image::new(self.imgs.window_frame)
.top_left_with_margins_on(ui_widgets.window, 200.0, 90.0)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.top_left_with_margins_on(ui_widgets.window, 200.0, 10.0)
.w_h(107.0 * 4.0, 125.0 * 4.0)
.set(self.ids.spellbook_frame, ui_widgets);
}
// BG
Image::new(self.imgs.spellbook_bg)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.middle_of(self.ids.spellbook_frame)
.set(self.ids.spellbook_bg, ui_widgets);
// Icon
Image::new(self.imgs.spellbook_icon)
.w_h(224.0 / 3.0, 224.0 / 3.0)
.top_left_with_margins_on(self.ids.spellbook_frame, -10.0, -10.0)
.w_h(40.0, 40.0)
.top_left_with_margins_on(self.ids.spellbook_frame, 4.0, 4.0)
.set(self.ids.spellbook_icon, ui_widgets);
// Content alignment
Rectangle::fill_with([362.0, 418.0], color::TRANSPARENT)
.bottom_right_with_margins_on(self.ids.spellbook_frame, 17.0, 17.0)
.scroll_kids()
.scroll_kids_vertically()
.set(self.ids.spellbook_bg, ui_widgets);
// X-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)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.spellbook_frame, 4.0, 4.0)
.top_right_with_margins_on(self.ids.spellbook_frame, 17.0, 5.0)
.set(self.ids.spellbook_close, ui_widgets)
.was_clicked()
{
@ -1290,7 +1279,8 @@ impl Hud {
}
// Title
Text::new("Spellbook")
.mid_top_with_margin_on(self.ids.spellbook_frame, 7.0)
.mid_top_with_margin_on(self.ids.spellbook_frame, 17.0)
.font_size(14)
.color(TEXT_COLOR)
.set(self.ids.spellbook_title, ui_widgets);
}
@ -1299,33 +1289,33 @@ impl Hud {
if char_window_open {
Image::new(self.imgs.window_frame)
.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.questlog_frame, ui_widgets);
} else {
Image::new(self.imgs.window_frame)
.top_left_with_margins_on(ui_widgets.window, 200.0, 90.0)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.top_left_with_margins_on(ui_widgets.window, 200.0, 10.0)
.w_h(107.0 * 4.0, 125.0 * 4.0)
.set(self.ids.questlog_frame, ui_widgets);
}
// BG
Image::new(self.imgs.questlog_bg)
.w_h(1648.0 / 4.0, 1952.0 / 4.0)
.middle_of(self.ids.questlog_frame)
.set(self.ids.questlog_bg, ui_widgets);
// Icon
Image::new(self.imgs.questlog_icon)
.w_h(224.0 / 3.0, 224.0 / 3.0)
.top_left_with_margins_on(self.ids.questlog_frame, -10.0, -10.0)
.w_h(40.0, 40.0)
.top_left_with_margins_on(self.ids.questlog_frame, 4.0, 4.0)
.set(self.ids.questlog_icon, ui_widgets);
// Content alignment
Rectangle::fill_with([362.0, 418.0], color::TRANSPARENT)
.bottom_right_with_margins_on(self.ids.questlog_frame, 17.0, 17.0)
.scroll_kids()
.scroll_kids_vertically()
.set(self.ids.questlog_bg, ui_widgets);
// X-Button
if Button::image(self.imgs.close_button)
.w_h(244.0 * 0.22 / 4.0, 244.0 * 0.22 / 4.0)
.hover_image(self.imgs.close_button_hover)
.w_h(20.0, 20.0)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.questlog_frame, 4.0, 4.0)
.top_right_with_margins_on(self.ids.questlog_frame, 17.0, 5.0)
.set(self.ids.questlog_close, ui_widgets)
.was_clicked()
{
@ -1337,8 +1327,9 @@ impl Hud {
}
// Title
Text::new("Quest-Log")
.mid_top_with_margin_on(self.ids.questlog_frame, 7.0)
.mid_top_with_margin_on(self.ids.questlog_frame, 17.0)
.color(TEXT_COLOR)
.font_size(14)
.set(self.ids.questlog_title, ui_widgets);
}
}
@ -1353,15 +1344,15 @@ impl Hud {
.set(self.ids.charwindow_frame, ui_widgets);
// BG
Image::new(self.imgs.window_bg)
.w_h(348.0, 404.0)
.mid_top_with_margin_on(self.ids.charwindow_frame, 48.0)
.set(self.ids.charwindow_bg, ui_widgets);
//Image::new(self.imgs.window_bg)
//.w_h(348.0, 404.0)
//.mid_top_with_margin_on(self.ids.charwindow_frame, 48.0)
//.set(self.ids.charwindow_bg, ui_widgets);
// Overlay
Image::new(self.imgs.charwindow)
.middle_of(self.ids.charwindow_bg)
.set(self.ids.charwindow, ui_widgets);
//Image::new(self.imgs.charwindow)
//.middle_of(self.ids.charwindow_bg)
//.set(self.ids.charwindow, ui_widgets);
// Icon
//Image::new(self.imgs.charwindow_icon)
@ -1444,11 +1435,11 @@ impl Hud {
\n\
Intelligence",
)
.top_left_with_margins_on(self.ids.charwindow_rectangle, 100.0, 20.0)
.font_id(self.font_opensans)
.font_size(16)
.color(TEXT_COLOR)
.set(self.ids.charwindow_tab1_statnames, ui_widgets);
.top_left_with_margins_on(self.ids.charwindow_rectangle, 100.0, 20.0)
.font_id(self.font_opensans)
.font_size(16)
.color(TEXT_COLOR)
.set(self.ids.charwindow_tab1_statnames, ui_widgets);
Text::new(
"1234\n\
@ -1459,11 +1450,11 @@ impl Hud {
\n\
124124",
)
.right_from(self.ids.charwindow_tab1_statnames, 10.0)
.font_id(self.font_opensans)
.font_size(16)
.color(TEXT_COLOR)
.set(self.ids.charwindow_tab1_stats, ui_widgets);
.right_from(self.ids.charwindow_tab1_statnames, 10.0)
.font_id(self.font_opensans)
.font_size(16)
.color(TEXT_COLOR)
.set(self.ids.charwindow_tab1_stats, ui_widgets);
}
// 2 Map
@ -1471,7 +1462,7 @@ impl Hud {
// BG
Image::new(self.imgs.map_bg)
.w_h(824.0, 488.0)
.middle_of(ui_widgets.window)
.mid_top_with_margin_on(ui_widgets.window, 200.0)
.set(self.ids.map_bg, ui_widgets);
// Frame
Image::new(self.imgs.map_frame_l)
@ -1491,10 +1482,10 @@ impl Hud {
// X-Button
if Button::image(self.imgs.close_button)
.w_h(4.0*2.0, 4.0*2.0)
.w_h(20.0, 20.0)
.hover_image(self.imgs.close_button_hover)
.press_image(self.imgs.close_button_press)
.top_right_with_margins_on(self.ids.map_frame_r, 1.0, 1.0)
.top_right_with_margins_on(self.ids.map_frame_r, 17.0, 5.0)
.set(self.ids.map_close, ui_widgets)
.was_clicked()
{
@ -1503,12 +1494,11 @@ impl Hud {
// Title
Text::new("Map")
.mid_top_with_margin_on(self.ids.map_bg, -7.0)
.font_size(50)
.font_size(14)
.color(TEXT_COLOR)
.set(self.ids.map_title, ui_widgets);
}
// ESC-MENU
// Background
if self.menu_open {