ludic/docs/language/app/app-window_hide.md
Orkuncakilkaya 43d5eb5b88 feat(launcher): Process.*, Http.save_to/received/expected, App.window_hide/show
Process.spawn/poll/kill/free - non-blocking child processes with no shell: posix_spawn on
macOS (process.ll), CreateProcessW with MSVC-quoted arguments and no console window on
Windows (process_win.ll), linked only when a program uses Process.*.

Http.save_to streams a response body into a file (NSURLSession with a run-time delegate
class on macOS, the WinHTTP read loop on Windows); Http.received / Http.expected report
progress while it is pending. Freeing a pending request cancels it and parks the slot
until the worker has finished.

App.window_hide / App.window_show take the game's window off the screen and back without
closing it; the run goes on while hidden. Docs, examples, tests and a changeset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 13:32:23 +03:00

1.5 KiB

id name category kind tokens sig tip order ns member
app-window_hide App.window_hide app namespace-method App.window_hide App.window_hide() -> void Take the game's window off the screen. 3 App window_hide

Takes the game's window off the screen without closing it: its GL context or Vulkan surface, its size and its contents are kept, and the program goes on running — a hidden window does not end the run. App.window_show brings it back. It is how a launcher steps aside while the game it started with Process.spawn runs.

Keep the frame loop going while hidden so the child can be polled, but there is nothing to see: skip the drawing, and throttle the loop yourself — a hidden window is not paced by the display, so an unthrottled loop spins. It does not touch the boot splash (App.splash_hide does). Safe to call when there is no window yet, and twice. Headless there is no window and the call lowers to nothing.

program Launcher {
  var game: int = -1
  function play() -> void {
    game = Process.spawn(game_path(), new []string)
    if game >= 0 { App.window_hide() }
  }
  handler Watch phase Update {
    if game >= 0 and Process.poll(game) != -1 {
      Process.free(game)
      game = -1
      App.window_show()
    }
  }
}

orderOut: on macOS; ShowWindow(SW_HIDE) on Windows, which also forgets any key held as the window went.