-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI draw call registration #220
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Not drawing anything yet but it will eventually become the primary way for panel draw calls to be processed.
Need to eventually move all UI texture code over to UiTextureID instead of relying on TextureAssetReference in the renderer.
Thinking it would be less work in the long run to start converting all the panel textures over to UiTextureID now instead of later.
Need to implement more PivotType cases in Game::render() and update TextBox and ListBox to use UiTextureID so the automap title can be drawn with the new way.
Also added lock/unlock texture functions for updating a UiTextureID's content.
Will probably need to do the 0.50 math at some point. Not sure if I'll ever use the SDL_RectF in later SDL versions; only will if it makes a difference.
Forgot that these functions were needed when working with integer resource handles.
Trying to reduce sword cursor boilerplate code.
Removed generate/select button tooltips since they weren't that important.
Also converted tooltip to help text at the bottom of the screen.
Can't test it visually since WorldMapPanel is still using legacy rendering, so the sub-panel gets covered currently.
Also split fast travel UI functions into their own namespace.
Need to re-add debug profiler and button tooltips. Commented out part of PauseMenuPanel since it depends on game world UI internals that changed. Added game world render callback since I'm considering it a special case and not something that can be handled by UI rendering.
Should be about ready to remove support for the old Panel render() functions.
All UI panels and sub-panels are registering their draw calls now. This makes the things they are drawing more like data to be manipulated instead of only being hardcoded functions.
Works fine on Windows and Raspberry Pi. |
Seems to work fine on macOS too! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, all UI panels that wanted to draw something implemented a virtual
render()
orrenderSecondary()
function. Now all UI rendering is done with UI draw calls that are registered with various logic functions in the Panel'sinit()
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.