mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Ui scaling interface tweaks
This commit is contained in:
parent
c6951b089b
commit
81ef1aae5f
Binary file not shown.
Before Width: | Height: | Size: 156 B |
@ -145,7 +145,6 @@ image_ids! {
|
|||||||
<ImageGraphic>
|
<ImageGraphic>
|
||||||
|
|
||||||
charwindow_gradient:"voxygen/element/misc_bg/charwindow.png",
|
charwindow_gradient:"voxygen/element/misc_bg/charwindow.png",
|
||||||
nothing: "voxygen/element/nothing.png",
|
|
||||||
|
|
||||||
// Spell Book Window
|
// Spell Book Window
|
||||||
spellbook_icon: "voxygen/element/icons/spellbook.png",
|
spellbook_icon: "voxygen/element/icons/spellbook.png",
|
||||||
@ -196,6 +195,6 @@ image_ids! {
|
|||||||
social_icon: "voxygen/element/icons/social.png",
|
social_icon: "voxygen/element/icons/social.png",
|
||||||
|
|
||||||
<BlankGraphic>
|
<BlankGraphic>
|
||||||
blank: (),
|
nothing: (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ pub struct DebugInfo {
|
|||||||
pub ping_ms: f64,
|
pub ping_ms: f64,
|
||||||
pub coordinates: Option<comp::Pos>,
|
pub coordinates: Option<comp::Pos>,
|
||||||
}
|
}
|
||||||
//#[derive(Serialize, Deserialize)]
|
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
SendMessage(String),
|
SendMessage(String),
|
||||||
AdjustMousePan(u32),
|
AdjustMousePan(u32),
|
||||||
@ -167,8 +167,6 @@ pub struct Show {
|
|||||||
open_windows: Windows,
|
open_windows: Windows,
|
||||||
map: bool,
|
map: bool,
|
||||||
inventory_test_button: bool,
|
inventory_test_button: bool,
|
||||||
rel_to_win: bool,
|
|
||||||
absolute: bool,
|
|
||||||
mini_map: bool,
|
mini_map: bool,
|
||||||
ingame: bool,
|
ingame: bool,
|
||||||
settings_tab: SettingsTab,
|
settings_tab: SettingsTab,
|
||||||
@ -320,8 +318,6 @@ impl Hud {
|
|||||||
settings_tab: SettingsTab::Interface,
|
settings_tab: SettingsTab::Interface,
|
||||||
want_grab: true,
|
want_grab: true,
|
||||||
ingame: true,
|
ingame: true,
|
||||||
rel_to_win: true,
|
|
||||||
absolute: false,
|
|
||||||
},
|
},
|
||||||
to_focus: None,
|
to_focus: None,
|
||||||
force_ungrab: false,
|
force_ungrab: false,
|
||||||
@ -638,13 +634,8 @@ impl Hud {
|
|||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
if let Windows::Settings = self.show.open_windows {
|
if let Windows::Settings = self.show.open_windows {
|
||||||
for event in SettingsWindow::new(
|
for event in SettingsWindow::new(&global_state, &self.show, &self.imgs, &self.fonts)
|
||||||
&global_state,
|
.set(self.ids.settings_window, ui_widgets)
|
||||||
&self.show,
|
|
||||||
&self.imgs,
|
|
||||||
&self.fonts,
|
|
||||||
)
|
|
||||||
.set(self.ids.settings_window, ui_widgets)
|
|
||||||
{
|
{
|
||||||
match event {
|
match event {
|
||||||
settings_window::Event::ToggleHelp => self.show.toggle_help(),
|
settings_window::Event::ToggleHelp => self.show.toggle_help(),
|
||||||
|
@ -29,7 +29,6 @@ widget_ids! {
|
|||||||
show_help_label,
|
show_help_label,
|
||||||
ui_scale_label,
|
ui_scale_label,
|
||||||
ui_scale_slider,
|
ui_scale_slider,
|
||||||
ui_scale_slider_2,
|
|
||||||
ui_scale_button,
|
ui_scale_button,
|
||||||
ui_scale_value,
|
ui_scale_value,
|
||||||
relative_to_win_button,
|
relative_to_win_button,
|
||||||
@ -325,26 +324,28 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.set(state.ids.ui_scale_label, ui);
|
.set(state.ids.ui_scale_label, ui);
|
||||||
|
|
||||||
// Relative Scaling Button
|
// Relative Scaling Button
|
||||||
|
let (check_img, check_mo_img, check_press_img, relative_selected) = match ui_scale {
|
||||||
if Button::image(match ui_scale {
|
ScaleMode::RelativeToWindow(_) => (
|
||||||
ScaleMode::Absolute(_) => self.imgs.check,
|
self.imgs.check_checked,
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check_checked,
|
self.imgs.check_checked,
|
||||||
ScaleMode::DpiFactor => self.imgs.check_checked,
|
self.imgs.check_checked,
|
||||||
})
|
true,
|
||||||
.w_h(288.0 / 24.0, 288.0 / 24.0)
|
),
|
||||||
.down_from(state.ids.ui_scale_label, 20.0)
|
ScaleMode::Absolute(_) | ScaleMode::DpiFactor => (
|
||||||
.hover_image(match ui_scale {
|
self.imgs.check,
|
||||||
ScaleMode::Absolute(_) => self.imgs.check_mo,
|
self.imgs.check_mo,
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check_checked,
|
self.imgs.check_press,
|
||||||
ScaleMode::DpiFactor => self.imgs.check_checked,
|
false,
|
||||||
})
|
),
|
||||||
.press_image(match ui_scale {
|
};
|
||||||
ScaleMode::Absolute(_) => self.imgs.check_press,
|
if Button::image(check_img)
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check_checked,
|
.w_h(288.0 / 24.0, 288.0 / 24.0)
|
||||||
ScaleMode::DpiFactor => self.imgs.check_checked,
|
.down_from(state.ids.ui_scale_label, 20.0)
|
||||||
})
|
.hover_image(check_mo_img)
|
||||||
.set(state.ids.relative_to_win_button, ui)
|
.press_image(check_press_img)
|
||||||
.was_clicked()
|
.set(state.ids.relative_to_win_button, ui)
|
||||||
|
.was_clicked()
|
||||||
|
&& !relative_selected
|
||||||
{
|
{
|
||||||
events.push(Event::UiScale(ScaleChange::ToRelative));
|
events.push(Event::UiScale(ScaleChange::ToRelative));
|
||||||
}
|
}
|
||||||
@ -358,26 +359,28 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.set(state.ids.relative_to_win_text, ui);
|
.set(state.ids.relative_to_win_text, ui);
|
||||||
|
|
||||||
// Absolute Scaling Button
|
// Absolute Scaling Button
|
||||||
|
let (check_img, check_mo_img, check_press_img, absolute_selected) = match ui_scale {
|
||||||
if Button::image(match ui_scale {
|
ScaleMode::Absolute(_) => (
|
||||||
ScaleMode::Absolute(_) => self.imgs.check_checked,
|
self.imgs.check_checked,
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check,
|
self.imgs.check_checked,
|
||||||
ScaleMode::DpiFactor => self.imgs.check,
|
self.imgs.check_checked,
|
||||||
})
|
true,
|
||||||
.w_h(288.0 / 24.0, 288.0 / 24.0)
|
),
|
||||||
.down_from(state.ids.relative_to_win_button, 20.0)
|
ScaleMode::RelativeToWindow(_) | ScaleMode::DpiFactor => (
|
||||||
.hover_image(match ui_scale {
|
self.imgs.check,
|
||||||
ScaleMode::Absolute(_) => self.imgs.check_checked,
|
self.imgs.check_mo,
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check_mo,
|
self.imgs.check_press,
|
||||||
ScaleMode::DpiFactor => self.imgs.check_mo,
|
false,
|
||||||
})
|
),
|
||||||
.press_image(match ui_scale {
|
};
|
||||||
ScaleMode::Absolute(_) => self.imgs.check_checked,
|
if Button::image(check_img)
|
||||||
ScaleMode::RelativeToWindow(_) => self.imgs.check_press,
|
.w_h(288.0 / 24.0, 288.0 / 24.0)
|
||||||
ScaleMode::DpiFactor => self.imgs.check_press,
|
.down_from(state.ids.relative_to_win_button, 20.0)
|
||||||
})
|
.hover_image(check_mo_img)
|
||||||
.set(state.ids.absolute_scale_button, ui)
|
.press_image(check_press_img)
|
||||||
.was_clicked()
|
.set(state.ids.absolute_scale_button, ui)
|
||||||
|
.was_clicked()
|
||||||
|
&& !absolute_selected
|
||||||
{
|
{
|
||||||
events.push(Event::UiScale(ScaleChange::ToAbsolute));
|
events.push(Event::UiScale(ScaleChange::ToAbsolute));
|
||||||
}
|
}
|
||||||
@ -415,17 +418,15 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.ui_scale_value, ui);
|
.set(state.ids.ui_scale_value, ui);
|
||||||
} else {
|
} else {
|
||||||
if let Some(_val) =
|
ImageSlider::continuous(0.0, 0.0, 1.0, self.imgs.nothing, self.imgs.slider)
|
||||||
ImageSlider::continuous(5.0, 0.0, 10.0, self.imgs.nothing, self.imgs.slider)
|
.w_h(208.0, 22.0)
|
||||||
.w_h(210.0, 22.0)
|
.right_from(state.ids.absolute_scale_text, 10.0)
|
||||||
.right_from(state.ids.absolute_scale_text, 10.0)
|
.track_breadth(12.0)
|
||||||
.track_breadth(12.0)
|
.slider_length(10.0)
|
||||||
.slider_length(10.0)
|
.track_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
||||||
.track_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
.slider_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
||||||
.slider_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
.pad_track((5.0, 5.0))
|
||||||
.pad_track((5.0, 5.0))
|
.set(state.ids.ui_scale_slider, ui);
|
||||||
.set(state.ids.ui_scale_slider_2, ui)
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crosshair Options
|
// Crosshair Options
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
render::{Consts, Globals, Renderer},
|
render::{Consts, Globals, Renderer},
|
||||||
ui::{
|
ui::{
|
||||||
self,
|
self,
|
||||||
img_ids::{ImageGraphic, VoxelGraphic},
|
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic},
|
||||||
ImageSlider, Ui,
|
ImageSlider, Ui,
|
||||||
},
|
},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
@ -180,7 +180,9 @@ image_ids! {
|
|||||||
icon_border_mo: "voxygen/element/buttons/border_mo.png",
|
icon_border_mo: "voxygen/element/buttons/border_mo.png",
|
||||||
icon_border_press: "voxygen/element/buttons/border_press.png",
|
icon_border_press: "voxygen/element/buttons/border_press.png",
|
||||||
icon_border_pressed: "voxygen/element/buttons/border_pressed.png",
|
icon_border_pressed: "voxygen/element/buttons/border_pressed.png",
|
||||||
nothing: "voxygen/element/nothing.png",
|
|
||||||
|
<BlankGraphic>
|
||||||
|
nothing: (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
render::Renderer,
|
render::Renderer,
|
||||||
ui::{
|
ui::{
|
||||||
self,
|
self,
|
||||||
img_ids::{ImageGraphic, VoxelGraphic},
|
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic},
|
||||||
Ui,
|
Ui,
|
||||||
},
|
},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
@ -70,7 +70,9 @@ image_ids! {
|
|||||||
<ImageGraphic>
|
<ImageGraphic>
|
||||||
bg: "voxygen/background/bg_main.png",
|
bg: "voxygen/background/bg_main.png",
|
||||||
error_frame: "voxygen/element/frames/window_2.png",
|
error_frame: "voxygen/element/frames/window_2.png",
|
||||||
nothing: "voxygen/element/nothing.png",
|
|
||||||
|
<BlankGraphic>
|
||||||
|
nothing: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user