-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Migrate remaining menus to ui_adaptor and clean up redundant drawing code #41112
Conversation
…ng code from reach_attack()
Heck yeah, 32 PRs later. Nice job. Should finally put the nail in the coffin for #8514 if you want to add that to the description. |
Nice work! Now that you've completed this migration, do you play to somehow enforce this for future UI code, or do you think it's sufficient that people will just copy the code that's there already? |
It'll likely be hard to tell whether a piece of code should be wrapped in ui_adaptor or not, so I don't think there's a very practical way to enforce it automatically. The best approach I can think of so far is to tag functions with attributes (redraw only, event loop, etc) and mandate that event loop functions do not contain non-encapsulated UI code and redraw functions do not contain input code, but I'm not sure how practical is that. I do plan to write some documentation for |
Summary
SUMMARY: Interface "All UIs now use the ui_adaptor system for refreshing and resizing"
Purpose of change
I did an extensive search of characteristic UI functions used in the game's UIs (for example
wrefresh
,draw_ter
,refresh_display
etc) and migrated all menus I could find that has yet been migrated. In the mean time I removed a bunch of redundant drawing code, which was there to refresh underlying menus but is no longer needed because refreshing is now handled entirely byui_adaptor
. I also fixed a few UI issues that I encountered during the migration process.There might still be menus that I missed, but their implemention have to be extremely peculiar for me to not have found them.
Closes #8514.
Describe the solution
Encapsulate UI code with
ui_adptor
callbacks andgame::draw_callback_t
, and remove UI code that is no longer needed.Testing
I tested every menu affected by this PR, and they were working as expected.