all-is-cubes icon indicating copy to clipboard operation
all-is-cubes copied to clipboard

Improve mouselook/pause UX and state transitions

Open kpreid opened this issue 2 years ago • 1 comments

Right now, mouselook is handled in a weird way where it's not the default and you have to push a button, and then it's kind of sticky. Most games that use mouselook instead arrange to have two states:

  • In game, unpaused, mouselook active.
  • In a menu, paused, mouselook inactive.

And if pointer lock (in web terms, or cursor grab in winit terms) is lost (externally imposed focus loss etc), then the game should enter the pause mode.

There are at least two reasons why I haven't just ended up there already:

  • I want the interface to be usable under conditions where pointer lock is unsupported.
  • I want launching the application to not demand focus + mouselook in order to be able to look at the world — this is mostly a developer workflow thing.

I think that a reasonable solution for the latter is to have a “pause” (may or may not actually pause) screen which frames the world rather than obscuring it with a central dialog-box style display. Then, clicking anywhere in the world would by default activate mouselook.

kpreid avatar Dec 20 '23 16:12 kpreid

Commit cf775e738547aff022fb4354f74d52dc0cb93433 implements the easier half of the mouselook problem: mouselook is now automatically turned off whenever the UI is displaying a page that wants interaction, such as the paused page.

Remaining is to optionally activate mouselook when unpaused.

kpreid avatar Jul 23 '24 03:07 kpreid