A windowed action game can hide the OS cursor and lock/confine the mouse to the window. Input.cursor_mode(mode): 0 normal, 1 hidden (draw your own reticle), 2 locked (hidden + dissociated — the mouse feeds relative motion via Input.mouse_dx/dy and Input.mouse_x/y is a clamped virtual cursor, FPS/twin-stick aim), 3 confined (dissociated but visible; the mouse can't leave the window). The platform auto-releases (shows + reconnects) while the window is not key (Cmd-Tab) and on close, so the cursor is never left captured. Headless it is a no-op (DCE'd). Native macOS impl in cocoa.ll: [NSCursor hide]/[unhide] (ref-counted, toggled only on change so the count stays balanced across focus changes), CGAssociateMouseAndMouseCursorPosition, and CGGetLastMouseDelta for the relative virtual cursor, behind a new win_cursor_mode intrinsic. Windowed-only behaviour (not in the headless golden suite); example compiles headless and links windowed. Full suite 115/0, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3 lines
1,008 B
Markdown
3 lines
1,008 B
Markdown
bump: minor
|
|
type: feat
|
|
Cursor capture (#89) — `Input.cursor_mode(mode)` hides / locks / confines the OS mouse for a windowed game: `0` normal (visible, free), `1` hidden (hide the OS cursor while focused so a game draws its own reticle), `2` locked (hidden + dissociated — the mouse feeds *relative* motion through `Input.mouse_dx/dy`, and `Input.mouse_x/y` becomes a clamped virtual cursor, the FPS / twin-stick aim mode), `3` confined (dissociated but visible; the mouse cannot leave the window). The platform auto-releases (shows + reconnects the cursor) while the window is not key (Cmd-Tab) and on close, so the cursor is never left captured. Adds the native macOS implementation in `cocoa.ll` (`[NSCursor hide]/[unhide]`, ref-counted and toggled only on change; `CGAssociateMouseAndMouseCursorPosition`; `CGGetLastMouseDelta` for the relative virtual cursor) behind a new `win_cursor_mode` intrinsic; headless / non-windowed it is a no-op (DCE'd). Example: `examples/library/cursor_capture.ludic`.
|