Skip to content

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Feb 22, 2020

Summary

SUMMARY: Interface "Properly refresh and resize main menu and related menus"

Purpose of change

Requires #37894. Migrate main menu and related menus to ui_adaptor to properly refresh and resize the menus. Fixes one of the items (world creation menu) in #8514.

Describe the solution

Separate display code from input code and use ui_adaptor to refresh the menus. Instead of erasing the background throughout the code, it now uses ui_adaptor to redraw the background when another menu invalidates the background after being closed. Also, instead of refreshing the main menu every second to handle resizing, it now uses the resizing callback of ui_adaptor to handle resizing responsively. Finally, it now only disables the IME once when entering the main menu.

Testing

Tested in game and refreshing and resizing were working as intended.

Additional context

The diff is best viewed with ignore whitespace mode on, since it moves and re-idents a lot of code.

@KorGgenT KorGgenT added Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Info / User Interface Game - player communication, menus, etc. labels Feb 22, 2020
@Qrox Qrox force-pushed the main-menu branch 2 times, most recently from ab8ff99 to 749da43 Compare February 24, 2020 17:50
@Qrox Qrox changed the title Use ui_manager in main menu Use ui_manager in main menu and related menus Feb 24, 2020
@Qrox Qrox marked this pull request as ready for review February 24, 2020 20:18
@Qrox
Copy link
Contributor Author

Qrox commented Feb 24, 2020

Somehow github is showing the commits in a different order from my local commit history. Might be a github bug with rebased commits.

@ZhilkinSerg ZhilkinSerg changed the base branch from master to dev March 16, 2020 11:25
@ZhilkinSerg ZhilkinSerg merged commit 63d8f55 into CleverRaven:dev Mar 16, 2020
@ZhilkinSerg ZhilkinSerg mentioned this pull request Mar 16, 2020
13 tasks
@ZhilkinSerg
Copy link
Contributor

This is absolutely amazing change.

Found a few glitches after merging to dev branch and playing with it:

  1. Go to any tab in World Creation menu and press Escape, so abort World Generation Cancel query would be displayed. Tab contents (and current tab highlight) will be cleared and only tab headers and borders would be displayed.

image

If you remove wrefresh( wf_win ); call on line 160 in worldfactory.cpp - tab contents would not be cleared when World Generation Cancel query is displayed, but if you try to resize game window - world creation menu disappears.

image

image

  1. World Creation menu artifacts appear on main screen after you leave this menu if you have resized game window when in that menu:

image

  1. If you click Create Custom Character and switch to other app while game is loading this menu, then switch back to game, it would display title screen (and a bit of character creation menu if you press some keys):

image

After pressing Down once:

image

  1. Character creation menu disappears after you press ? once, leave keybindings menu with Escape, then press ? second time:

image

image

  1. Character creation menu visually disappears and title screen is displayed after you switch to other app with Alt-Tab. It can return back if you enter some commands.

@Qrox
Copy link
Contributor Author

Qrox commented Mar 18, 2020

Thanks for doing the test! I'll look into these issues.

Tab contents (and current tab highlight) will be cleared and only tab headers and borders would be displayed.

I was aware of this one, but due to the way world creation menu's code was arranged I couldn't find a easy fix for it, so I decided to clear the tab content when canceling the menu for now.

@Qrox Qrox deleted the main-menu branch March 18, 2020 14:39
@Qrox
Copy link
Contributor Author

Qrox commented Mar 18, 2020

  1. I could not reproduce it. Maybe there are some condition for it to happen?
    3-5. Well... seems I forgot to migrate the custom character menu. Will do it in another PR.

@ZhilkinSerg
Copy link
Contributor

1. I could not reproduce it. Maybe there are some condition for it to happen?
   3-5. Well... seems I forgot to migrate the custom character menu. Will do it in another PR.

Yes, most probably. I cannot reproduce it now, but it also happened with Options menu too yesterday once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Info / User Interface Game - player communication, menus, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants