ludic/docs/language/screen/screen-status.md

1.2 KiB

id name category kind tokens sig tip order ns member
screen-status Screen.status screen namespace-method Screen.status Screen.status(text) Set the persistent one-line status/HUD string shown by the runtime. 9 Screen status

Sets a single persistent line of status text that the runtime displays outside your normal drawing — a lightweight HUD line for debugging or a title-bar style message. Unlike Screen.draw_text, it is not part of the framebuffer you clear and present each frame: you set it once (or whenever it changes) and it persists until you set it again. Use it for coarse status such as the current level, connection state, or a frame-rate readout while iterating. It takes a single string argument.

Parameters:

  • text — the status line to display
program StatusLine {
  state StatusLineState {
    elapsed_frames: int = 0
  }

  handler UpdateStatus(status_line_st: mut StatusLineState) phase Update {
    status_line_st.elapsed_frames = status_line_st.elapsed_frames + 1
    Screen.status(text: `frame {status_line_st.elapsed_frames}`)
  }

  handler DrawWorld phase Render {
    Screen.clear(Color.MidnightBlue)
    Screen.show()
  }
}