Fractional GUI scale (0.5 step), fit menu to window, fix settings pages

- display.gui-scale is now a number: 0 (auto) or 0.5..4 in 0.5 steps
- explicit scale is no longer limited by window size (tiled windows);
  only an open menu page is shrunk to fit the window
- snap Batch2D vertices to pixels on fractional scale (fixes dots above text)
- pass app to settings_common via options (not visible inside modules)
- gui.get_scale() returns a number
This commit is contained in:
loki5512344 2026-10-03 15:28:03 +02:00
parent 33e132a231
commit 48d5d54b77
13 changed files with 76 additions and 41 deletions

View file

@ -44,6 +44,10 @@ void Batch2D::vertex(
float u, float v,
float r, float g, float b, float a
) {
if (pixelSnap > 0.0f) {
x = std::round(x * pixelSnap) / pixelSnap;
y = std::round(y * pixelSnap) / pixelSnap;
}
buffer[index].position = {x, y};
buffer[index].uv = {u * region.getWidth() + region.u1, v * region.getHeight() + region.v1};
buffer[index].color = {r, g, b, a};
@ -54,6 +58,9 @@ void Batch2D::vertex(
glm::vec2 uvpoint,
float r, float g, float b, float a
) {
if (pixelSnap > 0.0f) {
point = glm::round(point * pixelSnap) / pixelSnap;
}
buffer[index].position = point;
buffer[index].uv = {uvpoint.x * region.getWidth() + region.u1, uvpoint.y * region.getHeight() + region.v1};
buffer[index].color = {r, g, b, a};
@ -83,6 +90,10 @@ void Batch2D::setRegion(UVRegion region) {
this->region = region;
}
void Batch2D::setPixelSnap(float pixelsPerUnit) {
pixelSnap = pixelsPerUnit;
}
void Batch2D::point(float x, float y, float r, float g, float b, float a){
if (index + 6 >= capacity)
flush();