Anchoring a display to a monitor
In this guide, you will detect a monitor and create a display anchored at its position.
Requirements
Section titled “Requirements”Before starting, make sure you have:
- CC:Tweaked installed
- DirectGPU installed
- A computer with a DirectGPU peripheral attached
Detecting a monitor
Section titled “Detecting a monitor”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")Creating the display
Section titled “Creating the display”Use the returned position with createDisplayAt:
local displayId = gpu.createDisplayAt(x, y, z)Adjusting opacity
Section titled “Adjusting opacity”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.