using System; using RGB.NET.Core; namespace RGB.NET.Devices.Novation { /// /// /// Represents a Novation launchpad. /// public class NovationLaunchpadRGBDevice : NovationRGBDevice { #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by Novation for the launchpad internal NovationLaunchpadRGBDevice(NovationLaunchpadRGBDeviceInfo info) : base(info) { } #endregion #region Methods /// protected override void InitializeLayout() { //TODO DarthAffe 15.08.2017: Check if all launchpads are using the same basic layout const int BUTTON_SIZE = 20; foreach (NovationLedIds ledId in Enum.GetValues(typeof(NovationLedIds))) { Rectangle rectangle; if (ledId.IsCustom()) rectangle = new Rectangle(BUTTON_SIZE * (ledId.GetId() - 0x68), 0, BUTTON_SIZE, BUTTON_SIZE); else if (ledId.IsScene()) rectangle = new Rectangle(8 * BUTTON_SIZE, BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE); else if (ledId.IsGrid()) rectangle = new Rectangle(BUTTON_SIZE * ((int)ledId.GetId() % 0x10), BUTTON_SIZE * (((int)ledId.GetId() / 0x10) + 1), BUTTON_SIZE, BUTTON_SIZE); else continue; InitializeLed(new NovationLedId(this, ledId), rectangle); } string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper(); ApplyLayoutFromFile(PathHelper.GetAbsolutePath( $@"Layouts\Novation\Launchpads\{model.ToUpper()}.xml"), "Default", PathHelper.GetAbsolutePath(@"Images\Novation\Launchpads")); } #endregion } }