API Reference › Screen — drawing › Screen.pixel
method

Screen.pixel

Screen.pixel(x, y) -> int

Reads the colour of the framebuffer pixel at screen (x, y) as 0x00RRGGBB, or 0 if the coordinate is off-screen. Unlike drawing, it ignores the camera — it reports the actual screen. Handy for colour-based collision or hit-testing against what was rendered, and for pixel-exact tests.

Example

program Demo {
  handler DrawWorld phase Render {
    Screen.put_pixel(x: 10, y: 10, color: Color.Red)
    if Screen.pixel(10, 10) == Color.Red { Screen.status("hit") }
    Screen.show()
  }
}
← All symbols