選用匯出旗標
DeviceMessage()
Section titled “DeviceMessage()”此匯出旗標用於在 SignalRGB 關聯裝置頁面上顯示訊息。您可以使用它向使用者顯示任何需要說明的特殊情況或描述。
返回值是一個包含 2 個字串的 1D 陣列。第一個是彈出視窗中顯示的文字,第二個是懸停提示。
export function DeviceMessage() { return ["This device has a weird quirk!", "The quirk is this!"]; }SupportsSubdevices()
Section titled “SupportsSubdevices()”此匯出旗標用於只支援子裝置且沒有板載 LED 可控制的燈光控制器。返回 true 時,此匯出將防止父裝置在佈局的畫布上顯示,並停用其位置設定的編輯。
export function SupportsSubdevices(){ return true; }on*Changed()
Section titled “on*Changed()”此匯出函式不被後端使用,而是在外掛程式內部作為回呼函式,用於在設定更改時通知。以下範例展示了每次使用者更改滑桿時使用它來設定滑鼠的 DPI,而不是在渲染迴圈中輪詢值並在那裡處理更改。
這些回呼在從畫布獲取 RGB 資料之後、當前渲染幀的渲染函式呼叫之前被呼叫。
// 設定匯出export function ControllableParameters(){ return [{ property: "dpi1", label: "DPI", step: "50", type: "number", min: "200", max: "18000", default: "800" }, ];}
// DPI 函式export function ondpi1Changed() { setDpi(dpi1);}
function setDpi(dpi) { if (!SettingControl) { return; } device.log(`Setting Dpi to ${dpi}`); Corsair_Set(CORSAIR_DPI_X, dpi); Corsair_Set(CORSAIR_DPI_Y, dpi);
device.log(`DPI x is now ${Corsair_Get(CORSAIR_DPI_X)}`); device.log(`DPI y is now ${Corsair_Get(CORSAIR_DPI_Y)}`);}