コード例 #1
0
ファイル: Led.cs プロジェクト: jonathanpotts/Spectral
        /// <summary>Sets the color of the specified LED on enabled devices to the specified color.</summary>
        /// <param name="ledName">The LED Name value for the LED to be set.</param>
        /// <param name="color">The color to set. On monochromatic devices, only the highest channel value is used.</param>
        /// <returns>True if specified LED on any enabled device was successfully set.</returns>
        public static bool SetColorForLed(LedName ledName, Color color)
        {
#if UNITY_STANDALONE_WIN
            byte red   = (byte)Mathf.Round(color.r * byte.MaxValue);
            byte green = (byte)Mathf.Round(color.g * byte.MaxValue);
            byte blue  = (byte)Mathf.Round(color.b * byte.MaxValue);

            try
            {
                return(SpectralSetColorForLed(ledName, red, green, blue));
            }
            catch (System.DllNotFoundException)
            {
                Debug.LogError("The Spectral library could not be loaded. Is the Corsair CUE SDK missing (see setup guide)?");
                return(false);
            }
            catch (System.EntryPointNotFoundException)
            {
                Debug.LogError("The Spectral library could not be loaded. Is the Corsair CUE SDK missing (see setup guide)?");
                return(false);
            }
#else
            return(false);
#endif
        }
コード例 #2
0
ファイル: Led.cs プロジェクト: jonathanpotts/Spectral
 /// <summary>Sets the color of the specified LED on enabled devices to the specified color.</summary>
 /// <param name="ledName">The LED Name value for the LED to be set.</param>
 /// <param name="red">The red channel value for the color to set. On monochromatic devices, only the highest channel value is used.</param>
 /// <param name="green">The green channel value for the color to set. On monochromatic devices, only the highest channel value is used.</param>
 /// <param name="blue">The blue channel value for the color to set. On monochromatic devices, only the highest channel value is used.</param>
 /// <returns>True if specified LED on any enabled device was successfully set.</returns>
 public static bool SetColorForLed(LedName ledName, byte red, byte green, byte blue)
 {
     try
     {
         return(SpectralSetColorForLed(ledName, red, green, blue));
     }
     catch (DllNotFoundException)
     {
         return(false);
     }
     catch (EntryPointNotFoundException)
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: Led.cs プロジェクト: jonathanpotts/Spectral
 private extern static bool SpectralSetColorForLed(LedName ledName, byte red, byte green, byte blue);
コード例 #4
0
        private void comboLedName_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedLed = (LedName)comboLedName.SelectedItem;

            buttonSetColor.Text = $"Set Color for {selectedLed.ToString()}";
        }
コード例 #5
0
ファイル: Led.cs プロジェクト: jonathanpotts/Spectral
 /// <summary>Sets the color of the specified LED on enabled devices to the specified color.</summary>
 /// <param name="ledName">The LED Name value for the LED to be set.</param>
 /// <param name="color">The color to set. On monochromatic devices, only the highest channel value is used.</param>
 /// <returns>True if specified LED on any enabled device was successfully set.</returns>
 public static bool SetColorForLed(LedName ledName, Color color)
 {
     return(SetColorForLed(ledName, color.R, color.G, color.B));
 }