Pixel perfect GUI example

I’ve been struggling with how to handle a pixel perfect GUI that doesn’t stretch, deform, or go blurry. Using @Pkeod’s example from an old thread I whipped up a very simple example.

In this project, I have a couple of pixel GUI nodes that get scaled in integer intervals as the width of the screen changes. Because it still uses adjust modes, gui.pick_node() still works. The way scale is handled can definitely be improved - it currently just assumes a static default scale and so would override any scaling you apply yourself (e.g. in animations). Should be easy to do.

I was also experimenting with text but that is less important I think. Even for a pixel perfect game I might be tempted to use a regular DF font.

Project in action:

Here’s the project:

pixel_GUI_test.zip (54.1 KB)

For those of you less experienced than me:
Hope this helps!

For those of you more experienced than me:
Anything silly I’m doing here that could be improved? I’ll happily update the example project if so.

8 Likes