Skip to content

Anchoring a display to a monitor

In this guide, you will detect a monitor and create a display anchored at its position.

Before starting, make sure you have:

  • CC:Tweaked installed
  • DirectGPU installed
  • A computer with a DirectGPU peripheral attached

Get the DirectGPU peripheral and detect a monitor:

local gpu = peripheral.wrap("directgpu_1") or peripheral.find("directgpu")
local x, y, z = gpu.autoDetectMonitor("top")

Use the returned position with createDisplayAt:

local displayId = gpu.createDisplayAt(x, y, z)

Configure the display opacity and background opacity:

gpu.setOpacity(displayId, 100)
gpu.setBackgroundOpacity(displayId, 0)

The display is now anchored to the detected monitor with full foreground opacity and a transparent background.