afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
987 stars 68 forks source link

Text rendering redesign #216

Closed afritz1 closed 3 years ago

afritz1 commented 3 years ago

TextRenderUtils adds several tools for determining texture size of a text box and drawing text to a buffer.

TextBox and ListBox are now much more convenient and versatile. They have been switched to a dirty boolean pattern so they only attempt to re-draw their underlying texture when it is about to be rendered on-screen. The limitation of having to allocate them on the heap has been removed as well.

Additional text alignment options were also added to support various cases like the orange trigger text in the game world being aligned to the bottom of its text box.

Future work would include changing the on-screen position to vector space and decoupling geometry dimensions from texture dimensions so that high-resolution fonts can be used.