Interface size in finer percent steps; fixed sizes no longer double the interface

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:22:56 +01:00
1 parent d8aa0e5fc1
commit 361e1e4108
4 files changed
+52 -24

No files matched your search

+2 -10
View File
@@ -15,9 +15,9 @@ use macroquad::prelude::*;
// the frame (see begin_ui, end_frame) - on every device the same pixel grid. Small screens
// draw in device pixels. Every size is an integer multiple
// of the font's 6x8 pixel glyphs: small text = 1*F, normal text = 2*F, titles = 4*F, where F
// is the interface factor (automatic from the resolution or fixed in the settings).
// is the interface factor (1 on the virtual screen, whose rows follow the "interface size"
// setting; automatic from the resolution in device pixels).
thread_local! {
static UI_FACTOR_SETTING: std::cell::Cell<u8> = std::cell::Cell::new(0);
static TOUCH: std::cell::Cell<bool> = std::cell::Cell::new(false);
static POINTER: std::cell::Cell<(f32, f32)> = std::cell::Cell::new((-1e5, -1e5));
static VIRTUAL_ROWS: std::cell::Cell<u32> = std::cell::Cell::new(0);
@@ -43,10 +43,6 @@ pub fn device_dpr() -> f32 {
screen_dpi_scale()
}
pub fn set_ui_factor(f: u8) {
UI_FACTOR_SETTING.with(|c| c.set(f));
}
// touch interface active (bigger interface, category toolbar, gestures)
pub fn set_touch(on: bool) {
TOUCH.with(|c| c.set(on));
@@ -84,10 +80,6 @@ pub fn mouse() -> (f32, f32) {
// interface factor (integer)
#[allow(non_snake_case)]
pub fn F() -> u32 {
let set = UI_FACTOR_SETTING.with(|c| c.get());
if set > 0 {
return set as u32;
}
// the virtual screen already has the right size for the interface
if virtual_rows() > 0 {
return 1;