feat(input): #89 cursor capture — Input.cursor_mode (hide/lock/confine)
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>
This commit is contained in:
parent
f3f1336882
commit
3eb5447f74
11 changed files with 26543 additions and 26240 deletions
|
|
@ -68,6 +68,7 @@ function emit_header() -> void {
|
|||
emith("declare void @win_mouse(ptr)\n")
|
||||
emith("declare void @win_pad(ptr)\n")
|
||||
emith("declare void @win_touch(ptr)\n")
|
||||
emith("declare void @win_cursor_mode(i32)\n")
|
||||
emith("declare ptr @snd_load(ptr)\n") # #22 audio backend (audio.ll)
|
||||
emith("declare void @snd_play(ptr, i32, i32, i32)\n")
|
||||
emith("declare void @snd_stop(ptr)\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue