Debug FPS display with rendering backend info

This commit is contained in:
Richard Zink committed 2026-11-05 07:21:37 +01:00
1 parent ee7b76fa6a
commit 07371cc893
8 files changed
+133 -4

No files matched your search

+5 -1
View File
@@ -50,6 +50,7 @@ pub enum Item {
Lights,
UiScale,
RenderScale,
DebugFps,
GameSpeed,
Hints,
TouchUi,
@@ -62,7 +63,7 @@ fn tab_items(tab: usize) -> &'static [Item] {
0 => &[Language, Volume, MusicVolume, Mute, Voice],
1 => &[RotateSpeed, PanSpeed, ZoomSpeed, EdgeScroll, InvertMouse],
2 => &[Outlines, WallDetail, Lights, UiScale, RenderScale],
3 => &[GameSpeed, Hints, TouchUi],
3 => &[GameSpeed, Hints, TouchUi, DebugFps],
_ => &[],
}
}
@@ -83,6 +84,7 @@ fn item_label(it: Item) -> String {
Item::Lights => "set.lights",
Item::UiScale => "set.ui_scale",
Item::RenderScale => "set.render_scale",
Item::DebugFps => "set.debug_fps",
Item::GameSpeed => "set.game_speed",
Item::Hints => "set.hints",
Item::TouchUi => "set.touch_ui",
@@ -124,6 +126,7 @@ fn item_value(it: Item, s: &Settings) -> String {
format!("{}x", s.ui_factor)
}
}
Item::DebugFps => onoff(s.debug_fps),
Item::RenderScale => {
// the setting is for a 1080 pixel high window; show what applies to this one
let now = crate::render3d::effective_div(s.render_scale.max(1) as u32, crate::ui::sh());
@@ -174,6 +177,7 @@ fn item_change(it: Item, s: &mut Settings, d: i32) {
Item::Lights => s.max_lights = cycle(&[8u8, 16, 24], s.max_lights, d),
Item::UiScale => s.ui_factor = cycle(&[0u8, 1, 2, 3, 4], s.ui_factor, d),
Item::RenderScale => s.render_scale = cycle(&(1u8..=16).collect::<Vec<u8>>(), s.render_scale.clamp(1, 16), d),
Item::DebugFps => s.debug_fps = !s.debug_fps,
Item::GameSpeed => s.game_speed = cycle(&[1.0f32, 2.0], s.game_speed, d),
Item::Hints => s.hints = !s.hints,
Item::TouchUi => s.touch_ui = cycle(&[0u8, 1, 2], s.touch_ui, d),