Created
April 13, 2021 14:50
-
-
Save saikyun/9e763b125640d89ccc34ef62b39df918 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
41.09 How to handle focus | |
Kinds of focus | |
- Mouse clicks | |
- Hover | |
- Drag | |
- Keyboard handling | |
- (Re)rendering | |
How to detect focus | |
- Mouse click / hover / drag | |
- “global” — assuming a single mouse | |
- Keyboard handling | |
- local, depends on current focus | |
I.e. mouse “events” should probably be handled globally, then “passed” to the correct place | |
Keyboard focus is different, though could perhaps also be globally handled | |
(Re)rendering is local | |
Ways to solve | |
- Mouse focus | |
- When mouse is colliding with an area, “a hitbox” of a ui element, that thing is focused | |
- Keyboard focus | |
- Actions trigger focusing for keyboard events, e.g. | |
- Clicking an element | |
- Using ctrl+tab (or similar) | |
- Possible M+e / M+g to switch between editor and game | |
- (Re)rendering | |
- This should be local, i.e. if the thing is “active” it should be rendered |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment