Scaling to every Circumstance: UI Layouts


UI Scaling at 1600 x 900

Incorrect UI Scaling at 1600 x 900 and Inventory Layout woes
Over the last few weeks, a lot of new UI elements have been added to the Game which came with the challenge of having it be accessible via the Input methods being offered. Salvager was first envisioned with a Controller/Gamepad in mind, which is not common for ARPG games, due to the ease in implementing it and being faster to get to a place where other significant features could be tested with a basic Input system.

But this hasn't mapped well to implementing UI Input Handling so far, partly because the library that we use to handle UI drawing, Nuklear, was designed to support Keyboard + Mouse as the primary Input devices and does not have higher level abstractions that make it easier to interface with a Gamepad/Controller, and also because of the way our UI implementation currently is, where each Menu/Window is treated as a single entity with the system not being granular enough to recognize individual widgets within them leading to brittle UI layouts.

The current plan to fix these is to allow more fine-grained control over UI elements within the code. The entities that represent a full menu with the current UIComponent will be changed to UICanvasComponent that controls Visibility and adaptive scaling to screen size while acting as a container for the Widgets within it, which will be represented by a UIWidgetComponent that holds information about the actual screen area it occupies to help better interact with Input like Mouse Hover and also Layout information so that they are more responsive to other elements drawn alongside them.

The major change this enables is that drawing a single menu will no longer be one static function that's been hard-coded to give  a best-approximation across different UI conditions. It'll be more dynamic and will also store more relevant state to help the Input System know exactly what it should be interacting with. This will be implemented in the coming weeks along with the Rendering changes that will be implemented that should help with cleanly organizing UI texture resources as well.