Settings UI: Allow custom values for DPI override and FPS

This commit is contained in:
Bu5hm4nn 2024-05-10 17:12:53 -06:00
parent 33c543e205
commit 0881222fde

View File

@ -47,9 +47,10 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
ui.add_space(20.0); ui.add_space(20.0);
ui.horizontal_wrapped(|ui| { ui.horizontal_wrapped(|ui| {
let dpi = app.override_dpi_value;
ui.label("Override DPI: ").on_hover_text("On some systems, DPI is not reported properly. In other cases, people like to zoom in or out. This lets you."); ui.label("Override DPI: ").on_hover_text("On some systems, DPI is not reported properly. In other cases, people like to zoom in or out. This lets you.");
ui.checkbox(&mut app.override_dpi, "Override to "); ui.checkbox(&mut app.override_dpi, "Override to ");
ui.add(Slider::new(&mut app.override_dpi_value, 72..=400).text("DPI")); ui.add(Slider::new(&mut app.override_dpi_value, dpi.min(72)..=dpi.max(400)).clamp_to_range(false).text("DPI"));
ui.add_space(10.0); // indent ui.add_space(10.0); // indent
@ -81,8 +82,9 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
ui.add_space(20.0); ui.add_space(20.0);
ui.horizontal(|ui| { ui.horizontal(|ui| {
let fps = app.unsaved_settings.max_fps;
ui.label("Maximum FPS: ").on_hover_text("The UI redraws every frame. By limiting the maximum FPS you can reduce load on your CPU. Takes effect immediately. I recommend 10, maybe even less."); ui.label("Maximum FPS: ").on_hover_text("The UI redraws every frame. By limiting the maximum FPS you can reduce load on your CPU. Takes effect immediately. I recommend 10, maybe even less.");
ui.add(Slider::new(&mut app.unsaved_settings.max_fps, 2..=60).text("Frames per second")); ui.add(Slider::new(&mut app.unsaved_settings.max_fps, fps.min(2)..=fps.max(60)).clamp_to_range(false).text("Frames per second"));
}); });
ui.add_space(20.0); ui.add_space(20.0);