FPS display moved, changes to windows

Former-commit-id: a044a52e3194ff7091964b3e7dcc83f368e32770
This commit is contained in:
Pfauenauge90 2019-04-26 18:13:30 +02:00
parent b83ab824b9
commit ed4336f408

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,
@ -29,8 +27,8 @@ widget_ids! {
debug_button,
debug_button_label,
fps_counter,
// Logo
v_logo,
// Game Version
version,
// Bag and Inventory
bag,
@ -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),
@ -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,7 +599,7 @@ 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)
@ -635,14 +626,13 @@ impl Hud {
//.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))
@ -801,6 +798,7 @@ impl Hud {
.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))
@ -819,7 +817,6 @@ impl Hud {
}
}
// Skillbar Module
// Experience-Bar
@ -975,6 +972,7 @@ impl Hud {
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);
@ -1087,11 +1084,8 @@ 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
)
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)
@ -1105,7 +1099,6 @@ impl Hud {
.graphics_for(self.ids.debug_button)
.color(TEXT_COLOR)
.set(self.ids.debug_button_label, ui_widgets);
}
// 2 Gameplay////////////////
@ -1113,8 +1106,7 @@ impl Hud {
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)
@ -1133,8 +1125,7 @@ impl Hud {
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)
@ -1153,8 +1144,7 @@ impl Hud {
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)
@ -1173,8 +1163,7 @@ impl Hud {
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)
@ -1206,7 +1195,7 @@ impl Hud {
} 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)
@ -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 {