SetMouseCapture: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document upcoming 0.1.4 weapon confirmation and mouse camera APIs
 
Document Map Editor, saved maps, static scene deployment and Lua APIs since 0.1.4
Line 2: Line 2:
'''Since 0.1.4 (in development; not in public 0.1.3).'''
'''Since 0.1.4 (in development; not in public 0.1.3).'''


Client function: boolean setMouseCapture(boolean enabled).
Client function: boolean setMouseCapture(boolean enabled [, boolean exclusiveInput = false]).


See [[Mouse capture]] for the full contract, return values, lifecycle, limitations and examples.
See [[Mouse capture]] for the full contract, return values, lifecycle, limitations and examples.
Line 8: Line 8:
[[Category:Client Functions]]
[[Category:Client Functions]]
[[Category:Lua Functions]]
[[Category:Lua Functions]]
<!-- map-editor014:start -->
== Exclusive input for freecam (since 0.1.4, in development) ==
Use <code>setMouseCapture(true, true)</code> to request continuous character-input suppression together with relative mouse capture. The default second argument is false: existing <code>setMouseCapture(true)</code> calls remain look-only.
Exclusive mode stops pre-existing character movement and holds this feature's own balanced movement/look locks plus viewport gate for the capture lease. It does not itself move a camera: acquire a scripted camera and use [[UpdateCameraPose]]. Bound keys owned by the mouse-owning resource can operate together (for example W+D+Shift); another resource's held keys, interactive GUI, native menus, loss of focus or readiness still suspend input. Wait for active state, clear held-key state on suspension and release with <code>setMouseCapture(false)</code>. Stop/disconnect/lease expiry release owned locks without resetting foreign locks. See [[Map editor]] for a complete resource using this mode.
<!-- map-editor014:end -->

Revision as of 18:19, 20 September 2026

setMouseCapture

Since 0.1.4 (in development; not in public 0.1.3).

Client function: boolean setMouseCapture(boolean enabled [, boolean exclusiveInput = false]).

See Mouse capture for the full contract, return values, lifecycle, limitations and examples.

Exclusive input for freecam (since 0.1.4, in development)

Use setMouseCapture(true, true) to request continuous character-input suppression together with relative mouse capture. The default second argument is false: existing setMouseCapture(true) calls remain look-only.

Exclusive mode stops pre-existing character movement and holds this feature's own balanced movement/look locks plus viewport gate for the capture lease. It does not itself move a camera: acquire a scripted camera and use UpdateCameraPose. Bound keys owned by the mouse-owning resource can operate together (for example W+D+Shift); another resource's held keys, interactive GUI, native menus, loss of focus or readiness still suspend input. Wait for active state, clear held-key state on suspension and release with setMouseCapture(false). Stop/disconnect/lease expiry release owned locks without resetting foreign locks. See Map editor for a complete resource using this mode.