Make textures on widgets not lose their aspect ratio when resizing the viewport
No more oddly sized text on widgets:
Ramblings about hobbyist game development
Make textures on widgets not lose their aspect ratio when resizing the viewport
No more oddly sized text on widgets:
Improve the widget hashing function: make it more unique and take a potential text item into consideration
Without that, we could not simply change the text item/label on a widget and force it to re-render automatically.
– only make text textures as wide as necessary
– cache the bounding boxes for different font sizes instead of re-calculating every time
Makes things look less weird and quicker. Also, it becomes painfully apparent how weird it is to type “text textures”.
properly position and and draw text textures on widgets. more WiP.
It is rendered more readable now:
Add most of the new code to the widget and UI pipeline to actually show text labels on top of widgets. This is still very much WiP and to be seen as a proof of concept
The text is rendered in a broken way, we cannot yet show textures and text on the same widget, but it renders:
add more logic on the widget to place a text item (with an optional background). minor renaming of variables on the tile shader. temporarily add a very distinct background colour on the bottom bar main buttons
This brings us even closer to properly render text on widgets: amongst other things it is properly generating the ModelData structure for widgets with text rendering in mind.
add the possiblity to add text labels to the widget class
This is fleshing out the text-on-widgets support started in the previous commit.
Also, this is technically already used for the game mode buttons, but not quite working yet.
add members, getters and setters for text rendering to the widget class
Does exactly what it says! The UI widget base class gets a whole lot of extra boilerplate code, it is not used yet however.
Make the text manager capable of creating and caching an arbitrary number of text renderings
This adds the concept of TextItems, which is a wrapper around the bitmap data of rendered text and its dimensions. The TextItems can be requested from the TextManager, which will also cache previously requested renderings.
Add a basic free type wrapper that can render arbitrary strings into in-memory bitmaps
Next to the TextureManager, we also have the TextManager, which is fortunately hardly confusing. It does the actual rendering, but the data has no usage yet.