Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
799 stars 90 forks source link

[WIP] Add GUI scale setting to options #90

Closed grgp closed 5 months ago

grgp commented 6 months ago

Addresses https://github.com/Phazorknight/Cogito/issues/81

Added slider here: godot-screenshot-gui

Changed project settings:

image

I used the official examples repo here as a reference. Still marking it as a work in progress because I haven't handled the case if the player simply clicks—not drag—the slider button.

It works right now, but it's kind of wonky.

Phazorknight commented 6 months ago

This is pretty sweet! Dragging as well as just clicking worked when I tested this just now.

I don't know much about Godot's UI / 2D Handling, but everything got quite pixelated or aliased if it wasn't in just the right scale, and that scale changes with the selected resolution (understandably).

Best results for me were: Res 1280x800 - Scale 1.0 Res 1440x900 - Scale 0.9 (though not quite perfect) Res 1600x900 - Scale 0.8 Res 1920x1080 - Scale 0.65 (though also some aliasing)

My assumption is that the scale value would probably have to "snap" to ones that can supply the right pixel alignments that also fits the selected resolution. Since 1920x1080 is the most common one, that's probably the base to start from.

grgp commented 6 months ago

Ah nice findings! Huh this is where my knowledge runs out tbh. I would assume since the 2D elements are from built-in Godot (vector and text, instead of image textures), it would scale perfectly no matter what scale we give it.

I'll leave this PR open for now in case anyone else has ideas. I'll ask on the Godot Discord, actually.