Interface size setting: auto, large, medium or small on the world's pixel grid

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 13:21:07 +01:00
1 parent 95655a0886
commit 70f112543f
21 files changed
+50 -11

No files matched your search

+6 -2
View File
@@ -976,8 +976,12 @@ async fn main() {
// 1080 device rows in landscape; a smaller screen draws in device pixels)
let need: u32 = 900;
// measured on the shorter side: upright (portrait) the width gets those pixels and the
// height grows with the screen, so the world and the menus keep their size
let short = rows * need.div_ceil(rows);
// height grows with the screen, so the world and the menus keep their size. The setting
// "interface size" picks the interface pixels per world pixel: large 2, medium 3, small 4
let short = match app.settings.ui_factor {
k @ 2..=4 => rows * k as u32,
_ => rows * need.div_ceil(rows),
};
let (w, h) = (screen_width().max(1.0), screen_height().max(1.0));
let vrows = if h > w { (short as f32 * h / w).round() as u32 } else { short };
ui::set_virtual_rows(vrows);
+7 -8
View File
@@ -141,13 +141,12 @@ fn item_value(it: Item, s: &Settings) -> String {
_ => "val.medium",
}),
Item::Lights => s.max_lights.to_string(),
Item::UiScale => {
if s.ui_factor == 0 {
trf("val.auto", &[crate::ui::F().to_string()])
} else {
format!("{}x", s.ui_factor)
}
}
Item::UiScale => tr(match s.ui_factor {
2 => "val.large",
3 => "val.medium",
4 => "val.small",
_ => "val.auto_plain",
}),
Item::DebugFps => onoff(s.debug_fps),
Item::DebugFrameTime => onoff(s.debug_frame_time),
Item::DebugPing => onoff(s.debug_ping),
@@ -202,7 +201,7 @@ fn item_change(it: Item, s: &mut Settings, d: i32) {
Item::Outlines => s.outlines = !s.outlines,
Item::WallDetail => s.wall_detail = cycle(&[1u8, 2, 3], s.wall_detail, d),
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::UiScale => s.ui_factor = cycle(&[0u8, 2, 3, 4], if [0, 2, 3, 4].contains(&s.ui_factor) { s.ui_factor } else { 0 }, d),
Item::RenderScale => s.pixel_rows = cycle(&[270u16, 360, 480], if [270, 360, 480].contains(&s.pixel_rows) { s.pixel_rows } else { 360 }, d),
Item::DebugFps => s.debug_fps = !s.debug_fps,
Item::DebugFrameTime => s.debug_frame_time = !s.debug_frame_time,
+1 -1
View File
@@ -148,7 +148,7 @@ pub struct Settings {
pub outlines: bool,
pub wall_detail: u8, // 1 low, 2 medium, 3 high
pub max_lights: u8, // 8, 16 or 24
pub ui_factor: u8, // interface size: 0 = automatic, 1..4 = fixed integer factor
pub ui_factor: u8, // interface size: 0 = automatic, 2 large, 3 medium, 4 small (interface pixels per world pixel)
pub render_scale: u8, // old pixel-look divisor (no longer used, kept for old settings files)
pub pixel_rows: u16, // pixel look: rows of the world on every screen (270, 360, 480)
pub touch_ui: u8, // touch interface: 0 = automatic (after the first touch), 1 = on, 2 = off