Skip to content
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

Main menu overhaul (Part 1.5): mouse control fixes & improvements #58142

Merged
merged 9 commits into from
Jun 10, 2022

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Jun 4, 2022

Summary

None

Purpose of change

Fixes #58086 (except the scrolling issue which is addressed by #58140).

Describe the solution

  1. Trigger the "menu_move" sounds when mousing over main menu options.
  2. Modify external UI elements to be mouse-aware (for prompts and popups).
  3. Add a mouse-accessible method of exiting tertiary menus.
  4. In general, right-click can act as ESC if there are no visible buttons for exiting a window.

2022-06-04 04-13-38

Changes to uilist/query_popup:

  • Highlight list items when mousing over

Changes to Settings/World/Help menus:

  • Full mouse control

Example - creating a world using only the mouse:

2022-06-05.03-41-54.mp4

Example - navigating settings and help menus in-game:

2022-06-05.19-38-47.mp4

Additional testing

2022-06-04 04-01-56
2022-06-04 04-00-46

Additional context

TODO:

  • Mouse-ify all remaining sub-menu items:
    • New Character
    • Load Character
    • World
    • Settings
    • Help

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jun 4, 2022
src/popup.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the [JSON] Changes (can be) made in JSON label Jun 5, 2022
@dseguin dseguin force-pushed the main_menu_overhaul2 branch 2 times, most recently from 9479416 to a0d529f Compare June 5, 2022 07:50
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 5, 2022
@Night-Pryanik
Copy link
Contributor

Is it possible to move mods up and down in world creation menu using only mouse?

@dseguin
Copy link
Member Author

dseguin commented Jun 5, 2022

Is it possible to move mods up and down in world creation menu using only mouse?

No, sorry. As far as I know click-and-drag is not possible.

@Night-Pryanik
Copy link
Contributor

Maybe we should add separate up and down buttons which will move highlighted mod up and down. Just a thought.

@leemuar
Copy link
Contributor

leemuar commented Jun 5, 2022

Is it possible to move mods up and down in world creation menu using only mouse?

No, sorry. As far as I know click-and-drag is not possible.

Why not?

@leemuar
Copy link
Contributor

leemuar commented Jun 5, 2022

Please note I did a help window scrolling here: #58145

@leemuar
Copy link
Contributor

leemuar commented Jun 5, 2022

I did some research, SELECT mouse action currently triggers when user release left mouse button. To make drag possible we only need to add tracking for the event of pressing mouse button. I'll make another PR for dragging support when Im done with my research

@dseguin dseguin marked this pull request as ready for review June 5, 2022 23:33
@dseguin dseguin force-pushed the main_menu_overhaul2 branch 2 times, most recently from bad4935 to b944f21 Compare June 6, 2022 02:53
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 6, 2022
src/options.cpp Outdated Show resolved Hide resolved
src/output.cpp Outdated Show resolved Hide resolved
data/raw/keybindings.json Outdated Show resolved Hide resolved
src/main_menu.cpp Outdated Show resolved Hide resolved
src/options.cpp Show resolved Hide resolved
src/popup.cpp Outdated Show resolved Hide resolved
src/ui.cpp Outdated Show resolved Hide resolved
src/worldfactory.cpp Show resolved Hide resolved
src/worldfactory.cpp Outdated Show resolved Hide resolved
@dseguin dseguin marked this pull request as draft June 6, 2022 15:21
@dseguin dseguin marked this pull request as ready for review June 6, 2022 19:57
@dseguin
Copy link
Member Author

dseguin commented Jun 6, 2022

Cheers for the feedback. New changes:

  • Redo mouse control for query_popup, only register "SELECT" and "MOUSE_MOVE" when options exist
  • Do not check for "MOUSE_MOVE" in uilist when using an external loop
  • Undo changes to query_yn and popup (ie: PF_MOUSECTRL)
  • Recalc scroll position when resizing
  • Remove prefixes from QUIT keybindings
  • Use run_for_point_in to process button rectangle logic

@leemuar
Copy link
Contributor

leemuar commented Jun 6, 2022

run_for_point_in() is a nice thing, Ill definitely reuse it

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 6, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 7, 2022
@leemuar
Copy link
Contributor

leemuar commented Jun 7, 2022

@dseguin, run_for_point_in() iterates over all items in collection, even if it already found a rectangle.
Do you think it is OK? In my cases all rectangles in the collection do not overlap, so finding first is enough to end iteration early.

I can easily copy run_for_point_in() and modify it to be like run_for_first_point_in(), I just want to know you opinion on that. Maybe Im missing some cases where iterating over all rectangles and counting all hits is actually required

Co-authored-by: BevapDin <tho_ki@gmx.de>
@dseguin
Copy link
Member Author

dseguin commented Jun 7, 2022

No problem. I've added a default parameter to return early after the first match. These are intended to be general purpose functions so I do want the option to run for any element, but for UI buttons you can just leave first_only as 'true'.

@kevingranade kevingranade merged commit 1e56d2a into CleverRaven:master Jun 10, 2022
@leemuar
Copy link
Contributor

leemuar commented Jun 10, 2022

image

Finally merged!
It's time to reuse those helper functions!

@dseguin dseguin deleted the main_menu_overhaul2 branch June 10, 2022 15:42
@leemuar
Copy link
Contributor

leemuar commented Jun 16, 2022

Is it possible to move mods up and down in world creation menu using only mouse?

I figured out how to implement it, see #58214 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with new main menu
6 participants