afritz1 / OpenTESArena

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

UI draw call registration #220

Closed afritz1 closed 2 years ago

afritz1 commented 2 years ago

Previously, all UI panels that wanted to draw something implemented a virtual render() or renderSecondary() function. Now all UI rendering is done with UI draw calls that are registered with various logic functions in the Panel's init() function. This makes each panel less hardcoded, more configurable, and more data-driven because the draw calls are put into a list and executed by the Game loop. Future work could involve certain panels being replaced with reusable UI collections of some kind, but right now I am pretty tired of refactoring.

This branch took three months because I've been busy with work lately, but I'm glad it is getting merged now.

Edit: this branch also includes all the UiTextureID work - all UI textures are referenced by an allocated UiTextureID handle. The UI texture can have its texels locked and written to for updating. Wish I would've known to do this a long time ago.

afritz1 commented 2 years ago

Works fine on Windows and Raspberry Pi.

Thunderforge commented 2 years ago

Seems to work fine on macOS too!