Graphics style: pixel art (360 rows) or high-res (1080 rows, detailed sprites)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 20:50:26 +01:00
1 parent 928c34e78b
commit 807a124a0b
23 files changed
+81 -48

No files matched your search

+18 -4
View File
@@ -151,7 +151,7 @@ pub struct Settings {
pub ui_factor: u8, // old interface size (2 large, 3 medium, 4 small; only read to carry old settings over)
pub ui_size: u16, // interface size in percent of the standard (100 = 1080 interface rows), 0 = automatic
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 (one of PIXEL_ROWS)
pub pixel_rows: u16, // graphics style: rows of the world on every screen (360 pixel art, 1080 high-res)
pub touch_ui: u8, // touch interface: 0 = automatic (after the first touch), 1 = on, 2 = off
pub debug_fps: bool, // show FPS and rendering backend
pub debug_frame_time: bool, // show the frame-time line and graph
@@ -264,11 +264,15 @@ impl Settings {
}
}
// the world's pixel rows of the settings menu (more rows: finer world, detailed sprites fit)
pub const PIXEL_ROWS: [u16; 5] = [270, 360, 480, 540, 1080];
// the graphics styles of the settings menu as the world's pixel rows: pixel art (360 rows, the
// small hand-made sprites) and high-res (1080 rows, detailed sprites; other values from older
// settings files count as pixel art)
pub const PIXEL_ART_ROWS: u16 = 360;
pub const HIGH_RES_ROWS: u16 = 1080;
pub const STYLES: [u16; 2] = [PIXEL_ART_ROWS, HIGH_RES_ROWS];
pub fn pixel_rows(set: u16) -> u32 {
if PIXEL_ROWS.contains(&set) { set as u32 } else { 360 }
if set == HIGH_RES_ROWS { HIGH_RES_ROWS as u32 } else { PIXEL_ART_ROWS as u32 }
}
// the interface sizes of the settings menu in percent (0 = automatic), from small to large
@@ -318,4 +322,14 @@ mod tests {
assert_eq!(ui_size_rows(150), 720);
assert!(ui_size_rows(200) < ui_size_rows(175));
}
#[test]
fn graphics_styles() {
assert_eq!(pixel_rows(1080), 1080);
assert_eq!(pixel_rows(360), 360);
// older pixel-look values count as pixel art
for old in [270u16, 480, 540, 0] {
assert_eq!(pixel_rows(old), 360);
}
}
}