GGUI::PointerRouter class

PointerRouter: does the UI take this input, or does the game?

Decided from a published snapshot only, so it can run on the input thread without touching the document: a hit test plus a little state (which buttons went down on the UI). One router per surface, used by one thread.

The UI takes: a press on something that blocks the pointer; everything until those buttons are released, wherever the pointer goes; and moves and wheel over something that blocks. Everything else is the game's. A press on the scene while the UI has focus goes to the game and is also forwarded to the document, so focus leaves the UI.

Public types

struct Decision
What to do with an input.

Public functions

auto Route(const GGSnapshot* snapshot, const InputEvent& event) -> Decision
snapshot is the surface's latest; null if nothing has been published.
auto HasCapture() const -> bool
True while a press the UI took is held.
void Reset()
Call when the surface's document changes or the pointer is taken away.