
Both the GUI and the actual gameplay need to use this pixelated style. And early on, I decided that I want to focus all of my game-development on a style that is low-resolution and pixelated, similar to classic 8-bit games. It's really important that the entire application uses a consistent style. So, after this week, I should actually be done futzing (for the most part) with getting GUI layouts just right! Phew.
Since this original size information is configured separately, it won't be contaminated by changes to underlying font or stylebox sizes. Use custom Scaffolder widgets which can be configured with the "original" size information. Disable almost all of the dumb GUI-element auto-scaling. When I try to record "original" GUI element sizes at scaled windows, it uses incorrect values, since underlying font and stylebox sizes have already changed separately. An epiphany!įortunately, I finally took the time to think-through why my mental model for scaling hasn’t been working.
Unfortunately, this auto-scaling has been a recurring pain-point, and I've periodically had to re-fix scaling problems for the same set of problematic widgets.
"Styleboxes," which are a concept Godot invented for configuring properties of a panel, like color, border width, corner radius, shadow dimensions, etc. Additionally, some types of things are scaled independently. But any GUI element can define a `update_gui_scale` method if it needs more custom control for size calculations. This automatic scaling works by looking at the element's original size and the viewport's new scale factor, and assigning a new element size based-off of the two. It makes an attempt to automatically scale some properties (like `rect_size`, `rect_min_size`, `rect_scale`). It's pretty powerful, and extremely handy-when it works!īasically, the scaling works by registering all scalable GUIs elements in a central place, listening for viewport-size-change events, and then recursively looking at each registered GUI element and updating it's size for the current viewport size. My Scaffolder framework includes a system for automatically adjusting the size of all GUIs and screen layouts to match the current screen size. Scaffolder's magical automatic GUI-scaling Tl dr: I refactored Scaffolder's GUI-scaling system, and I made a custom pixelated font.