Package net.openosrs.api.input
Class InputRouter
- java.lang.Object
-
- net.openosrs.api.input.InputRouter
-
@Singleton public class InputRouter extends java.lang.ObjectChooses which backend delivers an interaction.Precedence is deliberate and narrow: a thread-pinned
InputScopealways wins, otherwise the configured default applies. A cursor backend is only consulted when one has been registered and reports itself available, so an install with no cursor support behaves exactly as it did before.Fallback is opt-in. When a cursor request cannot be served and fallback is disabled, the rejection reaches the caller instead of quietly becoming a different kind of interaction.
-
-
Constructor Summary
Constructors Constructor Description InputRouter(PacketInputBackend packets, InputSettings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidanticipate(MenuRequest request)voidcancelPreparation()java.util.Optional<InputBackend>cursorBackend()MouseDrivergetMouseDriver()booleanisCursorAvailable()booleanprepare(HoverIntent intent)InputModeresolveMode(MenuRequest request)The mode that would be used right now for a request of this shape.InputModeselectedMode()Requested mode before target support or fallback is considered.voidsetCursorBackend(InputBackend backend)Install the cursor backend.voidsetMouseDriver(MouseDriver driver)SubmissionResultsubmit(MenuRequest request)
-
-
-
Constructor Detail
-
InputRouter
@Inject public InputRouter(PacketInputBackend packets, InputSettings settings)
-
-
Method Detail
-
setCursorBackend
public void setCursorBackend(InputBackend backend)
Install the cursor backend. Kept as registration rather than injection so that openosrs-api does not depend on the canvas layer that implements it.
-
cursorBackend
public java.util.Optional<InputBackend> cursorBackend()
-
setMouseDriver
public void setMouseDriver(MouseDriver driver)
-
getMouseDriver
public MouseDriver getMouseDriver()
-
isCursorAvailable
public boolean isCursorAvailable()
-
selectedMode
public InputMode selectedMode()
Requested mode before target support or fallback is considered.
-
resolveMode
public InputMode resolveMode(MenuRequest request)
The mode that would be used right now for a request of this shape.
-
submit
public SubmissionResult submit(MenuRequest request)
-
prepare
public boolean prepare(HoverIntent intent)
-
cancelPreparation
public void cancelPreparation()
-
anticipate
public void anticipate(MenuRequest request)
-
-