TheOpenSpaceProgram / new-ospgl

A space exploration game in OpenGL. Devblog: https://tatjam.github.io/index.html
MIT License
42 stars 6 forks source link

GUI Scaling #53

Open tatjam opened 1 year ago

tatjam commented 1 year ago

Allow a setting on settings.toml that activates a high scale GUI for users with very big monitors. This behavior should be implemented in skins, and also accessible from lua to allow modders to specify sane default sizes.

tatjam commented 1 year ago

A complication to keep in mind is that the bitmap font must also be scaled. This may result in blurriness, so it seems like a better idea to implement two bitmap fonts, one for small scale and another one for big scale.

tigercoding56 commented 1 year ago

A complication to keep in mind is that the bitmap font must also be scaled. This may result in blurriness, so it seems like a better idea to implement two bitmap fonts, one for small scale and another one for big scale.

maybe it would be better to use 1 vector font

tatjam commented 1 year ago

maybe it would be better to use 1 vector font

The problem with this approach is that vector fonts are unable to achieve the "pixel font" style of the compact GUI. On the large GUI a vector font will work just fine, but on smaller screens even with FreeType vector fonts can be a bit blurry.

I've recently experimented with the nanovgXC library (https://github.com/styluslabs/nanovgXC) and it supports signed distance field fonts. These are supposedly very crisp, but I haven't tested it yet. This library would likely be a drop-in replacement (it has exactly the same API as nanovg, which is currently used) so that would be cool.

Another approach would be to simply replace the bitmap text with vectors on the large scale, as the blurryness associated with vector fonts disappears with more pixels.

EDIT: nanovgXC also supports another font rendering technique, both could be tested to see which one looks better at small font sizes.