mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Key Command Changes, Char Window
Former-commit-id: 16c94f35da889ea418e7dc32043e6ebd25f2664b
This commit is contained in:
parent
4607ad612d
commit
3f2a938735
@ -50,15 +50,9 @@ impl Chat {
|
||||
// (i.e. the player is viewing new messages)
|
||||
// If so scroll down when new messages are added
|
||||
fn scroll_new_messages(&self, ui_widgets: &mut UiCell) {
|
||||
if let Some(scroll) = ui_widgets
|
||||
.widget_graph()
|
||||
.widget(self.ids.message_box)
|
||||
.and_then(|widget| widget.maybe_y_scroll_state)
|
||||
{
|
||||
// If previously scrolled to the bottom stay there
|
||||
if self.scrolled_to_bottom(ui_widgets) {
|
||||
self.scroll_to_bottom(ui_widgets);
|
||||
}
|
||||
// If previously scrolled to the bottom stay there
|
||||
if self.scrolled_to_bottom(ui_widgets) {
|
||||
self.scroll_to_bottom(ui_widgets);
|
||||
}
|
||||
}
|
||||
fn scrolled_to_bottom(&self, ui_widgets: &UiCell) -> bool {
|
||||
@ -123,7 +117,7 @@ impl Chat {
|
||||
Text::new(&self.messages[item.i])
|
||||
.font_size(14)
|
||||
.font_id(font)
|
||||
.rgba(220.0, 220.0, 220.0, 1.0),
|
||||
.rgba(0.86 , 0.86, 0.86, 1.0),
|
||||
ui_widgets,
|
||||
)
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
window::{Event as WinEvent, Key, Window},
|
||||
};
|
||||
use conrod_core::{
|
||||
color,
|
||||
color, Color,
|
||||
image::Id as ImgId,
|
||||
text::font::Id as FontId,
|
||||
widget::{Button, Image, Rectangle, Scrollbar, Text},
|
||||
@ -465,9 +465,9 @@ impl Hud {
|
||||
open_windows: Windows::None,
|
||||
font_metamorph,
|
||||
font_opensans,
|
||||
xp_percentage: 0.8,
|
||||
hp_percentage: 0.8,
|
||||
mana_percentage: 0.8,
|
||||
xp_percentage: 0.4,
|
||||
hp_percentage: 1.0,
|
||||
mana_percentage: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,6 +475,12 @@ impl Hud {
|
||||
let mut events = Vec::new();
|
||||
let ref mut ui_widgets = self.ui.set_widgets();
|
||||
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
const HP_COLOR: Color = Color::Rgba(0.33, 0.63, 0.0, 1.0);
|
||||
const MANA_COLOR: Color = Color::Rgba(0.42, 0.41, 0.66, 1.0);
|
||||
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||
|
||||
|
||||
if self.show_ui {
|
||||
// Add Bag-Space Button
|
||||
if self.inventorytest_button {
|
||||
@ -521,7 +527,7 @@ impl Hud {
|
||||
P = Spellbook \n\
|
||||
N = Settings",
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.top_left_with_margins_on(self.ids.help_bg, 20.0, 20.0)
|
||||
.font_id(self.font_opensans)
|
||||
.font_size(18)
|
||||
@ -533,7 +539,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Close")
|
||||
.label_font_size(10)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.button_help2, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -562,7 +568,7 @@ impl Hud {
|
||||
Text::new("Uncanny Valley")
|
||||
.mid_top_with_margin_on(self.ids.mmap_frame, 5.0)
|
||||
.font_size(14)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.mmap_location, ui_widgets);
|
||||
|
||||
// Minimap Buttons
|
||||
@ -690,7 +696,7 @@ impl Hud {
|
||||
.mid_bottom_of(ui_widgets.window)
|
||||
.set(self.ids.xp_bar, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([406.0 * (self.xp_percentage), 5.0], color::rgb(0.31, 0.14, 0.4)) // "W=406*[Exp. %]"
|
||||
Rectangle::fill_with([406.0 * (self.xp_percentage), 5.0], XP_COLOR) // "W=406*[Exp. %]"
|
||||
.top_left_with_margins_on(self.ids.xp_bar, 5.0, 21.0)
|
||||
.set(self.ids.xp_bar_progress, ui_widgets);
|
||||
|
||||
@ -739,7 +745,7 @@ impl Hud {
|
||||
.set(self.ids.health_bar, ui_widgets);
|
||||
|
||||
// Filling
|
||||
Rectangle::fill_with([182.0 * (self.hp_percentage), 6.0], color::rgb(0.09, 0.36, 0.0)) // "W=182.0 * [Health. %]"
|
||||
Rectangle::fill_with([182.0 * (self.hp_percentage), 6.0], HP_COLOR) // "W=182.0 * [Health. %]"
|
||||
.top_right_with_margins_on(self.ids.health_bar, 5.0, 0.0)
|
||||
.set(self.ids.health_bar_color, ui_widgets);
|
||||
|
||||
@ -752,7 +758,7 @@ impl Hud {
|
||||
.set(self.ids.mana_bar, ui_widgets);
|
||||
|
||||
// Filling
|
||||
Rectangle::fill_with([182.0 * (self.mana_percentage), 6.0], color::rgb(0.15, 0.14, 0.39)) // "W=182.0 * [Mana. %]"
|
||||
Rectangle::fill_with([182.0 * (self.mana_percentage), 6.0], MANA_COLOR) // "W=182.0 * [Mana. %]"
|
||||
.top_left_with_margins_on(self.ids.mana_bar, 5.0, 0.0)
|
||||
.set(self.ids.mana_bar_color, ui_widgets);
|
||||
|
||||
@ -769,14 +775,14 @@ impl Hud {
|
||||
Text::new("1")
|
||||
.left_from(self.ids.xp_bar, -15.0)
|
||||
.font_size(14)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.level_text, ui_widgets);
|
||||
|
||||
// Insert next Level here
|
||||
Text::new("2")
|
||||
.right_from(self.ids.xp_bar, -15.0)
|
||||
.font_size(14)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.next_level_text, ui_widgets);
|
||||
|
||||
// Bag contents
|
||||
@ -800,7 +806,7 @@ impl Hud {
|
||||
.set(self.ids.inv_grid, ui_widgets);
|
||||
Scrollbar::y_axis(self.ids.inv_alignment)
|
||||
.thickness(5.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.1)
|
||||
.rgba(0.86, 0.86, 0.86, 0.1)
|
||||
.set(self.ids.inv_scrollbar, ui_widgets);
|
||||
|
||||
// X-button
|
||||
@ -838,7 +844,7 @@ impl Hud {
|
||||
//Button::image(self.imgs.inv_slot)
|
||||
//.right(10.0)
|
||||
//.label(&format!("{}", i + 1))
|
||||
//.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
//.label_color(TEXT_COLOR)
|
||||
//.label_font_size(5)
|
||||
//.set(self.ids.inv_slot[i], ui_widgets);}
|
||||
}
|
||||
@ -888,7 +894,7 @@ impl Hud {
|
||||
Text::new("Settings")
|
||||
.mid_top_with_margin_on(self.ids.settings_bg, 10.0)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.settings_title, ui_widgets);
|
||||
// Icon
|
||||
Image::new(self.imgs.settings_icon)
|
||||
@ -913,7 +919,7 @@ impl Hud {
|
||||
.top_left_with_margins_on(self.ids.settings_bg, 78.0, 50.0)
|
||||
.label("Interface")
|
||||
.label_font_size(14)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.interface, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -933,7 +939,7 @@ impl Hud {
|
||||
.font_size(12)
|
||||
.font_id(self.font_opensans)
|
||||
.graphics_for(self.ids.button_help)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.show_help_label, ui_widgets);
|
||||
|
||||
self.inventorytest_button = ToggleButton::new(
|
||||
@ -951,7 +957,7 @@ impl Hud {
|
||||
.font_size(12)
|
||||
.font_id(self.font_opensans)
|
||||
.graphics_for(self.ids.inventorytest_button)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.inventorytest_button_label, ui_widgets);
|
||||
}
|
||||
//2 Gameplay////////////////
|
||||
@ -966,7 +972,7 @@ impl Hud {
|
||||
.down_from(self.ids.interface, 1.0)
|
||||
.label("Gameplay")
|
||||
.label_font_size(14)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.gameplay, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -985,7 +991,7 @@ impl Hud {
|
||||
.down_from(self.ids.gameplay, 1.0)
|
||||
.label("Controls")
|
||||
.label_font_size(14)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.controls, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -1004,7 +1010,7 @@ impl Hud {
|
||||
.down_from(self.ids.controls, 1.0)
|
||||
.label("Video")
|
||||
.label_font_size(14)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.video, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -1023,7 +1029,7 @@ impl Hud {
|
||||
.down_from(self.ids.video, 1.0)
|
||||
.label("Sound")
|
||||
.label_font_size(14)
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.set(self.ids.sound, ui_widgets)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -1081,7 +1087,7 @@ impl Hud {
|
||||
// Title
|
||||
Text::new("Social")
|
||||
.mid_top_with_margin_on(self.ids.social_frame, 7.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.social_title, ui_widgets);
|
||||
}
|
||||
Small::Spellbook => {
|
||||
@ -1128,7 +1134,7 @@ impl Hud {
|
||||
// Title
|
||||
Text::new("Spellbook")
|
||||
.mid_top_with_margin_on(self.ids.spellbook_frame, 7.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.spellbook_title, ui_widgets);
|
||||
}
|
||||
Small::Questlog => {
|
||||
@ -1175,7 +1181,7 @@ impl Hud {
|
||||
// Title
|
||||
Text::new("Quest-Log")
|
||||
.mid_top_with_margin_on(self.ids.questlog_frame, 7.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.questlog_title, ui_widgets);
|
||||
}
|
||||
}
|
||||
@ -1224,7 +1230,7 @@ impl Hud {
|
||||
// Title
|
||||
Text::new("Character Name") //Add in actual Character Name
|
||||
.mid_top_with_margin_on(self.ids.charwindow_frame, 7.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.charwindow_title, ui_widgets);
|
||||
// Tab BG
|
||||
Image::new(self.imgs.charwindow_tab_bg)
|
||||
@ -1240,7 +1246,7 @@ impl Hud {
|
||||
.w_h(65.0, 23.0)
|
||||
.top_left_with_margins_on(self.ids.charwindow_tab_bg, -18.0, 2.0)
|
||||
.label("Stats")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_id(self.font_opensans)
|
||||
.label_font_size(14)
|
||||
.set(self.ids.charwindow_tab1, ui_widgets);
|
||||
@ -1248,14 +1254,14 @@ impl Hud {
|
||||
.mid_top_with_margin_on(self.ids.charwindow_rectangle, 10.0)
|
||||
.font_id(self.font_opensans)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.charwindow_tab1_level, ui_widgets);
|
||||
// Exp-Bar Background
|
||||
Rectangle::fill_with([170.0, 10.0], color::BLACK)
|
||||
.mid_top_with_margin_on(self.ids.charwindow_rectangle, 50.0)
|
||||
.set(self.ids.charwindow_exp_rectangle, ui_widgets);
|
||||
// Exp-Bar Progress
|
||||
Rectangle::fill_with([170.0 * (self.xp_percentage), 6.0], color::rgb(0.31, 0.14, 0.40)) // 0.8 = Experience percantage
|
||||
Rectangle::fill_with([170.0 * (self.xp_percentage), 6.0], XP_COLOR) // 0.8 = Experience percantage
|
||||
.mid_left_with_margin_on(self.ids.charwindow_tab1_expbar, 1.0)
|
||||
.set(self.ids.charwindow_exp_progress_rectangle, ui_widgets);
|
||||
// Exp-Bar Foreground Frame
|
||||
@ -1268,7 +1274,7 @@ impl Hud {
|
||||
.mid_top_with_margin_on(self.ids.charwindow_tab1_expbar, 10.0)
|
||||
.font_id(self.font_opensans)
|
||||
.font_size(15)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.charwindow_tab1_exp, ui_widgets);
|
||||
|
||||
// Stats
|
||||
@ -1284,7 +1290,7 @@ impl Hud {
|
||||
.top_left_with_margins_on(self.ids.charwindow_rectangle, 100.0, 20.0)
|
||||
.font_id(self.font_opensans)
|
||||
.font_size(16)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.charwindow_tab1_statnames, ui_widgets);
|
||||
|
||||
Text::new(
|
||||
@ -1299,7 +1305,7 @@ impl Hud {
|
||||
.right_from(self.ids.charwindow_tab1_statnames, 10.0)
|
||||
.font_id(self.font_opensans)
|
||||
.font_size(16)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.charwindow_tab1_stats, ui_widgets);
|
||||
}
|
||||
|
||||
@ -1338,7 +1344,7 @@ impl Hud {
|
||||
Text::new("Map")
|
||||
.mid_top_with_margin_on(self.ids.map_frame, -7.0)
|
||||
.font_size(50)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.map_title, ui_widgets);
|
||||
}
|
||||
|
||||
@ -1363,7 +1369,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Settings")
|
||||
.label_y(conrod_core::position::Relative::Scalar(2.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(17)
|
||||
.set(self.ids.menu_button_1, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1379,7 +1385,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Controls")
|
||||
.label_y(conrod_core::position::Relative::Scalar(2.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(17)
|
||||
.set(self.ids.menu_button_2, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1394,7 +1400,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Servers")
|
||||
.label_y(conrod_core::position::Relative::Scalar(2.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(17)
|
||||
.set(self.ids.menu_button_3, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1409,7 +1415,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Logout")
|
||||
.label_y(conrod_core::position::Relative::Scalar(2.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(17)
|
||||
.set(self.ids.menu_button_4, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1424,7 +1430,7 @@ impl Hud {
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Quit")
|
||||
.label_y(conrod_core::position::Relative::Scalar(2.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(17)
|
||||
.set(self.ids.menu_button_5, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1531,25 +1537,64 @@ impl Hud {
|
||||
true
|
||||
}
|
||||
WinEvent::KeyDown(Key::Enter) => {
|
||||
if self.cursor_grabbed && self.typing {
|
||||
if self.typing {
|
||||
self.ui.focus_widget(None);
|
||||
self.typing = false;
|
||||
} else if !self.typing {
|
||||
} else {
|
||||
self.ui.focus_widget(Some(self.chat.input_box_id()));
|
||||
self.typing = true;
|
||||
};
|
||||
true
|
||||
}
|
||||
WinEvent::KeyDown(Key::Escape) if self.typing => {
|
||||
WinEvent::KeyDown(Key::Escape) => {
|
||||
if self.typing {
|
||||
self.typing = false;
|
||||
self.ui.focus_widget(None);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
// Close windows on esc
|
||||
self.toggle_windows();
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
WinEvent::KeyDown(key) if !self.typing => match key {
|
||||
Key::Map => {
|
||||
self.toggle_map();
|
||||
true
|
||||
}
|
||||
Key::Bag => {
|
||||
self.toggle_bag();
|
||||
true
|
||||
}
|
||||
Key::QuestLog => {
|
||||
self.toggle_questlog();
|
||||
true
|
||||
}
|
||||
Key::CharacterWindow => {
|
||||
self.toggle_charwindow();
|
||||
true
|
||||
}
|
||||
Key::Social => {
|
||||
self.toggle_social();
|
||||
true
|
||||
}
|
||||
Key::Spellbook => {
|
||||
self.toggle_spellbook();
|
||||
true
|
||||
}
|
||||
Key::Settings => {
|
||||
self.toggle_settings();
|
||||
true
|
||||
}
|
||||
Key::Help => {
|
||||
self.toggle_help();
|
||||
true
|
||||
}
|
||||
Key::Interface => {
|
||||
self.toggle_ui();
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
WinEvent::KeyDown(key) | WinEvent::KeyUp(key) => match key {
|
||||
Key::ToggleCursor => false,
|
||||
_ => self.typing,
|
||||
|
@ -346,6 +346,8 @@ pub enum Event {
|
||||
Play,
|
||||
}
|
||||
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
|
||||
pub struct CharSelectionUi {
|
||||
ui: Ui,
|
||||
ids: Ids,
|
||||
@ -428,7 +430,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_hover)
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Logout")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(18)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.logout_button, ui_widgets)
|
||||
@ -444,7 +446,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_hover)
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Create Character")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(20)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.create_character_button, ui_widgets)
|
||||
@ -470,7 +472,7 @@ impl CharSelectionUi {
|
||||
.w_h(346.0, 111.0)
|
||||
.top_left_with_margins_on(self.ids.bg_selection, 30.0, 40.0)
|
||||
.label("Alpha 0.1")
|
||||
.label_rgba(255.0, 255.0, 255.0, 1.0)
|
||||
.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))
|
||||
@ -486,12 +488,12 @@ impl CharSelectionUi {
|
||||
Text::new("Character Name")
|
||||
.mid_top_with_margin_on(self.ids.selection_window, 80.0)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.char_name, ui_widgets);
|
||||
Text::new("1")
|
||||
.mid_top_with_margin_on(self.ids.char_name, 40.0)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.char_level, ui_widgets);
|
||||
|
||||
|
||||
@ -510,7 +512,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_hover)
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Enter World")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(22)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.enter_world_button, ui_widgets)
|
||||
@ -527,7 +529,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_red_hover)
|
||||
.press_image(self.imgs.button_dark_red_press)
|
||||
.label("Delete")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(12)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.delete_button, ui_widgets)
|
||||
@ -548,7 +550,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_hover)
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Back")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(18)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.back_button, ui_widgets)
|
||||
@ -563,7 +565,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.button_dark_hover)
|
||||
.press_image(self.imgs.button_dark_press)
|
||||
.label("Create")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(18)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.create_button, ui_widgets)
|
||||
@ -582,7 +584,7 @@ impl CharSelectionUi {
|
||||
.font_size(26)
|
||||
.font_id(self.font_metamorph)
|
||||
.center_justify()
|
||||
.text_color(Color::Rgba(220.0, 220.0, 220.0, 0.8))
|
||||
.text_color(TEXT_COLOR)
|
||||
.color(TRANSPARENT)
|
||||
.border_color(TRANSPARENT)
|
||||
.set(self.ids.name_field, ui_widgets)
|
||||
@ -678,7 +680,7 @@ impl CharSelectionUi {
|
||||
Text::new("Choose your Race")
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
||||
.font_size(28)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.select_window_title, ui_widgets);
|
||||
|
||||
// Male/Female/Race Icons
|
||||
@ -920,14 +922,14 @@ impl CharSelectionUi {
|
||||
Text::new(race_str)
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 370.0)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.race_heading, ui_widgets);
|
||||
Text::new(race_desc)
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 410.0)
|
||||
.w(500.0)
|
||||
.font_size(20)
|
||||
.font_id(self.font_opensans)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.wrap_by_word()
|
||||
.set(self.ids.race_description, ui_widgets);
|
||||
// Races Descriptions
|
||||
@ -937,7 +939,7 @@ impl CharSelectionUi {
|
||||
Text::new("Choose your Weapon")
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
||||
.font_size(28)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.select_window_title, ui_widgets);
|
||||
// BG for Alignment
|
||||
Rectangle::fill_with([470.0, 60.0], color::TRANSPARENT)
|
||||
@ -1094,14 +1096,14 @@ impl CharSelectionUi {
|
||||
Text::new(weapon_str)
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 370.0)
|
||||
.font_size(30)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.race_heading, ui_widgets);
|
||||
Text::new(weapon_desc)
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 410.0)
|
||||
.w(500.0)
|
||||
.font_size(20)
|
||||
.font_id(self.font_opensans)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.wrap_by_word()
|
||||
.set(self.ids.race_description, ui_widgets);
|
||||
// Races Descriptions
|
||||
@ -1116,7 +1118,7 @@ impl CharSelectionUi {
|
||||
Text::new("Body Customization")
|
||||
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
||||
.font_size(28)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.select_window_title, ui_widgets);
|
||||
|
||||
match state {
|
||||
@ -1133,7 +1135,7 @@ impl CharSelectionUi {
|
||||
//.hover_image(self.imgs.frame_open_mo)
|
||||
//.press_image(self.imgs.frame_open_press)
|
||||
.label("Skin & Eyes")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
||||
.label_font_size(16)
|
||||
.set(self.ids.skin_eyes_button, ui_widgets)
|
||||
@ -1148,7 +1150,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Hair")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.hair_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1162,7 +1164,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Accessories")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.accessories_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1184,7 +1186,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Skin & Eyes")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.skin_eyes_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1198,7 +1200,7 @@ impl CharSelectionUi {
|
||||
//.hover_image(self.imgs.frame_closed_mo)
|
||||
//.press_image(self.imgs.frame_closed_press)
|
||||
.label("Hair")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
||||
.label_font_size(16)
|
||||
.set(self.ids.hair_button, ui_widgets)
|
||||
@ -1213,7 +1215,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Accessories")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.accessories_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1235,7 +1237,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Skin & Eyes")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.skin_eyes_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1249,7 +1251,7 @@ impl CharSelectionUi {
|
||||
.hover_image(self.imgs.frame_closed_mo)
|
||||
.press_image(self.imgs.frame_closed_press)
|
||||
.label("Hair")
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.hair_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1264,7 +1266,7 @@ impl CharSelectionUi {
|
||||
//.press_image(self.imgs.frame_closed_press)
|
||||
.label("Accessories")
|
||||
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
||||
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(16)
|
||||
.set(self.ids.accessories_button, ui_widgets)
|
||||
.was_clicked()
|
||||
@ -1281,7 +1283,7 @@ impl CharSelectionUi {
|
||||
Text::new("Skin Color")
|
||||
.top_left_with_margins_on(self.ids.skin_rect, 0.0, -250.0)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.skin_color_text, ui_widgets);
|
||||
// TODO: Align Buttons here
|
||||
// They set an i32 to a value from 0-14
|
||||
@ -1289,7 +1291,7 @@ impl CharSelectionUi {
|
||||
// Here only the BG image changes depending on the race.
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
.top_right_with_margins_on(self.ids.skin_eyes_window, 60.0, 30.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.skin_rect, ui_widgets);
|
||||
|
||||
// TODO:Slider
|
||||
@ -1307,7 +1309,7 @@ impl CharSelectionUi {
|
||||
|
||||
Text::new("Brightness")
|
||||
.top_left_with_margins_on(self.ids.skin_color_slider_range, -27.0, 0.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.skin_color_slider_text, ui_widgets);
|
||||
|
||||
@ -1315,7 +1317,7 @@ impl CharSelectionUi {
|
||||
Text::new("Eye Color")
|
||||
.top_left_with_margins_on(self.ids.eyes_rect, 0.0, -250.0)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.eye_color_text, ui_widgets);
|
||||
// TODO: Align 16 Buttons here
|
||||
//
|
||||
@ -1324,7 +1326,7 @@ impl CharSelectionUi {
|
||||
// Only the BG image (190x114 -> 2px border!) changes depending on the race.
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
.top_right_with_margins_on(self.ids.skin_eyes_window, 186.0, 30.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.eyes_rect, ui_widgets);
|
||||
|
||||
// TODO:Slider
|
||||
@ -1341,7 +1343,7 @@ impl CharSelectionUi {
|
||||
|
||||
Text::new("Brightness")
|
||||
.top_left_with_margins_on(self.ids.eye_color_slider_range, -27.0, 0.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.eye_color_slider_text, ui_widgets);
|
||||
}
|
||||
@ -1356,7 +1358,7 @@ impl CharSelectionUi {
|
||||
// Hair
|
||||
Text::new("Hair Style")
|
||||
.mid_top_with_margin_on(self.ids.hair_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.hair_style_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1379,12 +1381,12 @@ impl CharSelectionUi {
|
||||
Text::new("Hair Color")
|
||||
.top_left_with_margins_on(self.ids.hair_color_picker_bg, 0.0, -250.0)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.hair_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
.top_right_with_margins_on(self.ids.hair_window, 114.0, 30.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.hair_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1403,13 +1405,13 @@ impl CharSelectionUi {
|
||||
|
||||
Text::new("Brightness")
|
||||
.top_left_with_margins_on(self.ids.hair_color_slider_range, -27.0, 0.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.hair_color_slider_text, ui_widgets);
|
||||
// Eyebrows
|
||||
Text::new("Eyebrow Style")
|
||||
.mid_top_with_margin_on(self.ids.hair_window, 280.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.eyebrow_style_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1432,7 +1434,7 @@ impl CharSelectionUi {
|
||||
if let Sex::Male = self.sex {
|
||||
Text::new("Beard Style")
|
||||
.mid_top_with_margin_on(self.ids.hair_window, 340.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.beard_style_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1464,7 +1466,7 @@ impl CharSelectionUi {
|
||||
Races::Human => {
|
||||
Text::new("Head Band")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1491,7 +1493,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1500,7 +1502,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1523,14 +1525,14 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Human
|
||||
Races::Orc => {
|
||||
Text::new("Head Band")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1557,7 +1559,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1566,7 +1568,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1589,14 +1591,14 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Orc
|
||||
Races::Elf => {
|
||||
Text::new("Tribe Markings")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1623,7 +1625,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1632,7 +1634,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1655,14 +1657,14 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Elf
|
||||
Races::Dwarf => {
|
||||
Text::new("War Paint")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1689,7 +1691,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1698,7 +1700,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1721,14 +1723,14 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Dwarf
|
||||
Races::Undead => {
|
||||
Text::new("Teeth")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1755,7 +1757,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1764,7 +1766,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1787,14 +1789,14 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Undead
|
||||
Races::Danari => {
|
||||
Text::new("Horns")
|
||||
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(24)
|
||||
.set(self.ids.warpaint_text, ui_widgets);
|
||||
if Button::image(self.imgs.arrow_right)
|
||||
@ -1821,7 +1823,7 @@ impl CharSelectionUi {
|
||||
-250.0,
|
||||
)
|
||||
.font_size(25)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_text, ui_widgets);
|
||||
|
||||
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
||||
@ -1830,7 +1832,7 @@ impl CharSelectionUi {
|
||||
114.0,
|
||||
30.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
||||
|
||||
Image::new(self.imgs.slider_range)
|
||||
@ -1853,7 +1855,7 @@ impl CharSelectionUi {
|
||||
-27.0,
|
||||
0.0,
|
||||
)
|
||||
.rgba(220.0, 220.0, 220.0, 0.8)
|
||||
.color(TEXT_COLOR)
|
||||
.font_size(14)
|
||||
.set(self.ids.warpaint_slider_text, ui_widgets);
|
||||
} // Danari
|
||||
|
@ -171,6 +171,7 @@ impl MainMenuUi {
|
||||
});
|
||||
};
|
||||
}
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.94, 0.94, 0.94, 0.8);
|
||||
// Username
|
||||
// TODO: get a lower resolution and cleaner input_bg.png
|
||||
Image::new(self.imgs.input_bg)
|
||||
@ -182,7 +183,7 @@ impl MainMenuUi {
|
||||
.mid_bottom_with_margin_on(self.ids.username_bg, 44.0 / 2.0)
|
||||
.font_size(20)
|
||||
.font_id(self.font_opensans)
|
||||
.text_color(Color::Rgba(0.86, 0.86, 0.86, 0.8))
|
||||
.text_color(TEXT_COLOR)
|
||||
// transparent background
|
||||
.color(TRANSPARENT)
|
||||
.border_color(TRANSPARENT)
|
||||
@ -225,7 +226,7 @@ impl MainMenuUi {
|
||||
.mid_bottom_with_margin_on(self.ids.address_bg, 44.0 / 2.0)
|
||||
.font_size(20)
|
||||
.font_id(self.font_opensans)
|
||||
.text_color(Color::Rgba(0.86, 0.86, 0.86, 0.8))
|
||||
.text_color(TEXT_COLOR)
|
||||
// transparent background
|
||||
.color(TRANSPARENT)
|
||||
.border_color(TRANSPARENT)
|
||||
@ -246,7 +247,7 @@ impl MainMenuUi {
|
||||
.down_from(self.ids.address_bg, 20.0)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label("Login")
|
||||
.label_rgba(0.86, 0.86, 0.86, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(28)
|
||||
.label_y(conrod_core::position::Relative::Scalar(5.0))
|
||||
.set(self.ids.login_button, ui_widgets)
|
||||
@ -262,7 +263,7 @@ impl MainMenuUi {
|
||||
.down_from(self.ids.login_button, 20.0)
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label("Singleplayer")
|
||||
.label_rgba(0.86, 0.86, 0.86, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(26)
|
||||
.label_y(conrod_core::position::Relative::Scalar(5.0))
|
||||
.label_x(conrod_core::position::Relative::Scalar(2.0))
|
||||
@ -278,7 +279,7 @@ impl MainMenuUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label("Quit")
|
||||
.label_rgba(0.86, 0.86, 0.86, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(20)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.quit_button, ui_widgets)
|
||||
@ -293,7 +294,7 @@ impl MainMenuUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label("Settings")
|
||||
.label_rgba(0.86, 0.86, 0.86, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(20)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.settings_button, ui_widgets)
|
||||
@ -306,7 +307,7 @@ impl MainMenuUi {
|
||||
.hover_image(self.imgs.button_hover)
|
||||
.press_image(self.imgs.button_press)
|
||||
.label("Servers")
|
||||
.label_rgba(0.86, 0.86, 0.86, 0.8)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(20)
|
||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||
.set(self.ids.servers_button, ui_widgets)
|
||||
|
@ -78,7 +78,7 @@ impl Scene {
|
||||
test_figure: Figure::new(
|
||||
renderer,
|
||||
[
|
||||
Some(load_segment("head.vox").generate_mesh(Vec3::new(-7.0, -5.5, -1.0))),
|
||||
Some(load_segment("head.vox").generate_mesh(Vec3::new(-7.0, -6.5, -6.0))),
|
||||
Some(load_segment("chest.vox").generate_mesh(Vec3::new(-6.0, -3.0, 0.0))),
|
||||
Some(load_segment("belt.vox").generate_mesh(Vec3::new(-5.0, -3.0, 0.0))),
|
||||
Some(load_segment("pants.vox").generate_mesh(Vec3::new(-5.0, -3.0, 0.0))),
|
||||
|
@ -124,18 +124,6 @@ impl PlayState for SessionState {
|
||||
}
|
||||
let _handled = match event {
|
||||
Event::Close => return PlayStateResult::Shutdown,
|
||||
Event::KeyDown(Key::Map) => self.hud.toggle_map(),
|
||||
Event::KeyDown(Key::Bag) => self.hud.toggle_bag(),
|
||||
Event::KeyDown(Key::QuestLog) => self.hud.toggle_questlog(),
|
||||
Event::KeyDown(Key::CharacterWindow) => self.hud.toggle_charwindow(),
|
||||
Event::KeyDown(Key::Social) => self.hud.toggle_social(),
|
||||
Event::KeyDown(Key::Spellbook) => self.hud.toggle_spellbook(),
|
||||
Event::KeyDown(Key::Settings) => self.hud.toggle_settings(),
|
||||
Event::KeyDown(Key::Help) => self.hud.toggle_help(),
|
||||
Event::KeyDown(Key::Interface) => self.hud.toggle_ui(),
|
||||
|
||||
// Close windows on esc
|
||||
Event::KeyDown(Key::Escape) => self.hud.toggle_windows(),
|
||||
// Toggle cursor grabbing
|
||||
Event::KeyDown(Key::ToggleCursor) => {
|
||||
global_state
|
||||
@ -166,7 +154,7 @@ impl PlayState for SessionState {
|
||||
self.tick(clock.get_last_delta())
|
||||
.expect("Failed to tick the scene");
|
||||
|
||||
// Maintain the scene
|
||||
// Maintain the scene
|
||||
self.scene.maintain(global_state.window.renderer_mut(), &self.client.borrow());
|
||||
// Maintain the UI
|
||||
for event in self.hud.maintain(global_state.window.renderer_mut()) {
|
||||
|
@ -367,7 +367,6 @@ impl Ui {
|
||||
|
||||
use conrod_core::render::PrimitiveKind;
|
||||
match kind {
|
||||
// TODO: use source_rect
|
||||
PrimitiveKind::Image { image_id, color, source_rect } => {
|
||||
|
||||
// Switch to the `Image` state for this image if we're not in it already.
|
||||
@ -389,7 +388,7 @@ impl Ui {
|
||||
}
|
||||
}
|
||||
|
||||
let color = color.unwrap_or(conrod_core::color::WHITE).to_fsa();
|
||||
let color = srgb_to_linear(color.unwrap_or(conrod_core::color::WHITE).to_fsa());
|
||||
|
||||
// Transform the source rectangle into uv coordinates
|
||||
let (image_w, image_h) = self.image_map
|
||||
@ -443,8 +442,7 @@ impl Ui {
|
||||
renderer.update_texture(cache_tex, offset, size, &new_data);
|
||||
}).unwrap();
|
||||
|
||||
// TODO: consider gamma....
|
||||
let color = color.to_fsa();
|
||||
let color = srgb_to_linear(color.to_fsa());
|
||||
|
||||
for g in positioned_glyphs {
|
||||
if let Ok(Some((uv_rect, screen_rect))) = glyph_cache.rect_for(font_id.index(), g) {
|
||||
@ -472,8 +470,7 @@ impl Ui {
|
||||
}
|
||||
}
|
||||
PrimitiveKind::Rectangle { color } => {
|
||||
// TODO: consider gamma/linear conversion....
|
||||
let color = color.to_fsa();
|
||||
let color = srgb_to_linear(color.to_fsa());
|
||||
// Don't draw a transparent rectangle
|
||||
if color[3] == 0.0 {
|
||||
continue;
|
||||
@ -493,7 +490,7 @@ impl Ui {
|
||||
}
|
||||
PrimitiveKind::TrianglesSingleColor { color, triangles } => {
|
||||
// Don't draw transparent triangle or switch state if there are actually no triangles
|
||||
let color: [f32; 4] = color.into();
|
||||
let color: [f32; 4] = srgb_to_linear(color.into());
|
||||
if triangles.is_empty() || color[3] == 0.0 {
|
||||
continue;
|
||||
}
|
||||
@ -577,3 +574,15 @@ fn default_scissor(renderer: &mut Renderer) -> Aabr<u16> {
|
||||
max: Vec2 { x: screen_w, y: screen_h }
|
||||
}
|
||||
}
|
||||
|
||||
fn srgb_to_linear(color: [f32; 4]) -> [f32; 4] {
|
||||
fn linearize(comp: f32) -> f32 {
|
||||
if comp <= 0.04045 {
|
||||
comp / 12.92
|
||||
} else {
|
||||
((comp + 0.055) / 1.055).powf(2.4)
|
||||
}
|
||||
}
|
||||
|
||||
[linearize(color[0]), linearize(color[1]), linearize(color[2]), color[3]]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user