You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using IntelOrca.Launchpad;
|
|
|
|
namespace IntelOrca.LaunchpadTests
|
|
{
|
|
class ToggleGrid
|
|
{
|
|
private LaunchpadDevice mLaunchpadDevice;
|
|
|
|
public ToggleGrid(LaunchpadDevice device)
|
|
{
|
|
mLaunchpadDevice = device;
|
|
|
|
mLaunchpadDevice.DoubleBuffered = false;
|
|
mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed;
|
|
|
|
mLaunchpadDevice.GetButton(ToolbarButton.Session).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
|
|
|
|
|
|
for (int y = 0; y < 4; y++) {
|
|
for (int x = 0; x < 4; x++) {
|
|
mLaunchpadDevice[x, y].SetBrightness((ButtonBrightness)x, (ButtonBrightness)y);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void mLaunchpadDevice_ButtonPressed(object sender, ButtonPressEventArgs e)
|
|
{
|
|
if (e.Type == ButtonType.Grid) {
|
|
LaunchpadButton button = mLaunchpadDevice[e.X, e.Y];
|
|
if (button.RedBrightness == ButtonBrightness.Off && button.GreenBrightness == ButtonBrightness.Off)
|
|
button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
|
|
else
|
|
button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off);
|
|
|
|
/*
|
|
if (button.RedBrightness == ButtonBrightness.Off && button.GreenBrightness == ButtonBrightness.Off)
|
|
button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
else if (button.RedBrightness == ButtonBrightness.Full && button.GreenBrightness == ButtonBrightness.Off)
|
|
button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
else if (button.RedBrightness == ButtonBrightness.Off && button.GreenBrightness == ButtonBrightness.Full)
|
|
button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
|
|
else
|
|
button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off);
|
|
*/
|
|
} else if (e.Type == ButtonType.Toolbar) {
|
|
if (e.ToolbarButton == ToolbarButton.Session) {
|
|
for (int y = 0; y < 8; y++)
|
|
for (int x = 0; x < 8; x++)
|
|
mLaunchpadDevice[x, y].TurnOffLight();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Run()
|
|
{
|
|
while (true) ;
|
|
}
|
|
}
|
|
}
|