private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; // Draw snake foreach (Point p in mBody) { if (InBounds(p)) { greengrid[p.X, p.Y] = ButtonBrightness.Full; } } if (InBounds(mBody[0])) { redgrid[mBody[0].X, mBody[0].Y] = ButtonBrightness.Full; } // Draw food if (mFoodActive) { redgrid[mFood.X, mFood.Y] = ButtonBrightness.Full; } // Invalidate for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); } } mLaunchpadDevice.Refresh(); }
public void ToggleLight(LaunchpadButton button) { ButtonBrightness red = button.RedBrightness != ButtonBrightness.Off ? ButtonBrightness.Off : ButtonBrightness.Full; ButtonBrightness green = button.GreenBrightness != ButtonBrightness.Off ? ButtonBrightness.Off : ButtonBrightness.Full; button.SetBrightness(red, green); }
public void SetBrightness(ButtonBrightness red, ButtonBrightness green) { if (mRedBrightness == red && mGreenBrightness == green) return; mRedBrightness = red; mGreenBrightness = green; int vel = ((int)mGreenBrightness << 4) | (int)mRedBrightness; if (!mLaunchpadDevice.DoubleBuffered) vel |= 12; SetLED(vel); }
public void SetBrightness(ButtonBrightness red, ButtonBrightness green) { if (this.mRedBrightness == red && this.mGreenBrightness == green) { return; } this.mRedBrightness = red; this.mGreenBrightness = green; int num = (int)((ButtonBrightness)((int)this.mGreenBrightness << 4) | this.mRedBrightness); if (!this.mLaunchpadDevice.DoubleBuffered) { num |= 12; } this.SetLED(num); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; mDogs.ForEach(d => { if (!(d.X >= 0 && d.X < 8 && d.Y >= 0 && d.Y < 8)) return; redgrid[(int)d.X, (int)d.Y] = ButtonBrightness.Full; greengrid[(int)d.X, (int)d.Y] = ButtonBrightness.Full; }); for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); mLaunchpadDevice.Refresh(); }
public void SetBrightness(ButtonBrightness red, ButtonBrightness green) { if (mRedBrightness == red && mGreenBrightness == green) { return; } mRedBrightness = red; mGreenBrightness = green; int vel = ((int)mGreenBrightness << 4) | (int)mRedBrightness; if (!mLaunchpadDevice.DoubleBuffered) { vel |= 12; } SetLED(vel); }
public void SetColor(LaunchpadButton btn, ButtonColor color) { ButtonBrightness green = ButtonBrightness.Off; ButtonBrightness red = ButtonBrightness.Off; switch (color) { case ButtonColor.Off: break; case ButtonColor.Green: green = ButtonBrightness.Full; break; case ButtonColor.GreenMid: green = ButtonBrightness.Medium; break; case ButtonColor.GreenLow: green = ButtonBrightness.Low; break; case ButtonColor.Red: red = ButtonBrightness.Full; break; case ButtonColor.RedMid: red = ButtonBrightness.Medium; break; case ButtonColor.RedLow: red = ButtonBrightness.Low; break; case ButtonColor.Mix_HighHigh: red = ButtonBrightness.Full; green = ButtonBrightness.Full; break; case ButtonColor.Mix_HighMedium: red = ButtonBrightness.Full; green = ButtonBrightness.Medium; break; case ButtonColor.Mix_HighLow: red = ButtonBrightness.Full; green = ButtonBrightness.Low; break; case ButtonColor.Mix_MediumHigh: red = ButtonBrightness.Medium; green = ButtonBrightness.Full; break; case ButtonColor.Mix_MediumMedium: red = ButtonBrightness.Medium; green = ButtonBrightness.Medium; break; case ButtonColor.Mix_MediumLow: red = ButtonBrightness.Medium; green = ButtonBrightness.Low; break; case ButtonColor.Mix_LowHigh: red = ButtonBrightness.Low; green = ButtonBrightness.Full; break; case ButtonColor.Mix_LowMedium: red = ButtonBrightness.Low; green = ButtonBrightness.Medium; break; case ButtonColor.Mix_LowLow: red = ButtonBrightness.Low; green = ButtonBrightness.Low; break; } btn.SetBrightness(red, green); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; mDogs.ForEach(d => { if (!(d.X >= 0 && d.X < 8 && d.Y >= 0 && d.Y < 8)) { return; } redgrid[(int)d.X, (int)d.Y] = ButtonBrightness.Full; greengrid[(int)d.X, (int)d.Y] = ButtonBrightness.Full; }); for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); } } mLaunchpadDevice.Refresh(); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; for (int y = 0; y < 7; y++) for (int x = 0; x < 8; x++) if (mSequence[ButtonXtoColX(x), ButtonYtoSeqY(y)]) redgrid[x, y] = greengrid[x, y] = ButtonBrightness.Full; for (int x = 0; x < 8; x++) { ButtonBrightness brightness = (mSequence[ButtonXtoColX(x), ButtonYtoSeqY(7)] ? ButtonBrightness.Full : ButtonBrightness.Low); if (!mRemove[ButtonXtoColX(x)]) greengrid[x, 7] = brightness; else redgrid[x, 7] = brightness; } for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); if (mConfirmTime > 0) mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOnLight(); else mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOffLight(); if (mMode == 1) mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); else mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); if (mSoundType == 0) { mLaunchpadDevice.GetButton(SideButton.SoundA).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.SoundB).TurnOffLight(); } else { mLaunchpadDevice.GetButton(SideButton.SoundA).TurnOffLight(); mLaunchpadDevice.GetButton(SideButton.SoundB).TurnOnLight(); } mLaunchpadDevice.GetButton(ToolbarButton.Up).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Down).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Left).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Right).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Volume).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Pan).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Arm).TurnOnLight(); mLaunchpadDevice.Refresh(); Console.SetCursorPosition(0, 0); for (int y = 0; y < NumRows; y++) { for (int x = 0; x < NumCols; x++) { if (mSequence[x, y]) Console.Write("X"); else Console.Write("."); } Console.WriteLine(); } }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; for (int y = 0; y < 7; y++) { for (int x = 0; x < 8; x++) { if (mSequence[ButtonXtoColX(x), ButtonYtoSeqY(y)]) { redgrid[x, y] = greengrid[x, y] = ButtonBrightness.Full; } } } for (int x = 0; x < 8; x++) { ButtonBrightness brightness = (mSequence[ButtonXtoColX(x), ButtonYtoSeqY(7)] ? ButtonBrightness.Full : ButtonBrightness.Low); if (!mRemove[ButtonXtoColX(x)]) { greengrid[x, 7] = brightness; } else { redgrid[x, 7] = brightness; } } for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); } } if (mConfirmTime > 0) { mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOnLight(); } else { mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOffLight(); } if (mMode == 1) { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); } else { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); } if (mSoundType == 0) { mLaunchpadDevice.GetButton(SideButton.SoundA).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.SoundB).TurnOffLight(); } else { mLaunchpadDevice.GetButton(SideButton.SoundA).TurnOffLight(); mLaunchpadDevice.GetButton(SideButton.SoundB).TurnOnLight(); } mLaunchpadDevice.GetButton(ToolbarButton.Up).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Down).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Left).TurnOnLight(); mLaunchpadDevice.GetButton(ToolbarButton.Right).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Volume).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Pan).TurnOnLight(); mLaunchpadDevice.GetButton(SideButton.Arm).TurnOnLight(); mLaunchpadDevice.Refresh(); Console.SetCursorPosition(0, 0); for (int y = 0; y < NumRows; y++) { for (int x = 0; x < NumCols; x++) { if (mSequence[x, y]) { Console.Write("X"); } else { Console.Write("."); } } Console.WriteLine(); } }
public ButtonColor GetColor(ButtonBrightness red, ButtonBrightness green) { if (red == ButtonBrightness.Off) { if (green == ButtonBrightness.Full) { return(ButtonColor.Green); } if (green == ButtonBrightness.Medium) { return(ButtonColor.GreenMid); } if (green == ButtonBrightness.Low) { return(ButtonColor.GreenLow); } if (green == ButtonBrightness.Off) { return(ButtonColor.Off); } } else if (red == ButtonBrightness.Low) { if (green == ButtonBrightness.Full) { return(ButtonColor.Mix_LowHigh); } if (green == ButtonBrightness.Medium) { return(ButtonColor.Mix_LowMedium); } if (green == ButtonBrightness.Low) { return(ButtonColor.Mix_LowLow); } if (green == ButtonBrightness.Off) { return(ButtonColor.RedLow); } } else if (red == ButtonBrightness.Medium) { if (green == ButtonBrightness.Full) { return(ButtonColor.Mix_MediumHigh); } if (green == ButtonBrightness.Medium) { return(ButtonColor.Mix_MediumMedium); } if (green == ButtonBrightness.Low) { return(ButtonColor.Mix_MediumLow); } if (green == ButtonBrightness.Off) { return(ButtonColor.RedMid); } } else if (red == ButtonBrightness.Full) { if (green == ButtonBrightness.Full) { return(ButtonColor.Mix_HighHigh); } if (green == ButtonBrightness.Medium) { return(ButtonColor.Mix_HighMedium); } if (green == ButtonBrightness.Low) { return(ButtonColor.Mix_HighLow); } if (green == ButtonBrightness.Off) { return(ButtonColor.Red); } } return(ButtonColor.Off); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { if (mGrid[x, y] == 1) { redgrid[x, y] = ButtonBrightness.Full; } else if (mGrid[x, y] == 2) { greengrid[x, y] = ButtonBrightness.Full; } else if (mShowPossibleMoves && mFlashCounter < 10) { if (mPossiblePlaces.Exists(p => p.Item1 == x && p.Item2 == y)) { redgrid[x, y] = ButtonBrightness.Low; greengrid[x, y] = ButtonBrightness.Low; } } } } for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); if (mPlayerTurn == 1) { mLaunchpadDevice.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); mLaunchpadDevice.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } else if (mPlayerTurn == 2) { mLaunchpadDevice.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); mLaunchpadDevice.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); } if (mPlayerWinning == 1) { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); } else if (mPlayerWinning == 2) { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); } else { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } if (mShowPossibleMoves) mLaunchpadDevice.GetButton(SideButton.TrackOn).TurnOnLight(); else mLaunchpadDevice.GetButton(SideButton.TrackOn).TurnOffLight(); if (mConfirmTime > 0) mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOnLight(); else mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOffLight(); if (mSolo) mLaunchpadDevice.GetButton(SideButton.Solo).TurnOnLight(); else mLaunchpadDevice.GetButton(SideButton.Solo).TurnOffLight(); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; // Draw snake foreach (Point p in mBody) if (InBounds(p)) greengrid[p.X, p.Y] = ButtonBrightness.Full; if (InBounds(mBody[0])) redgrid[mBody[0].X, mBody[0].Y] = ButtonBrightness.Full; // Draw food if (mFoodActive) redgrid[mFood.X, mFood.Y] = ButtonBrightness.Full; // Invalidate for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); mLaunchpadDevice.Refresh(); }
public void SetButtonBrightness(LaunchpadButton button, ButtonBrightness redBrightness, ButtonBrightness greenBrightness) { button.SetBrightness(redBrightness, greenBrightness); }
private void Draw() { ButtonBrightness[,] redgrid = new ButtonBrightness[8, 8]; ButtonBrightness[,] greengrid = new ButtonBrightness[8, 8]; for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { if (mGrid[x, y] == 1) { redgrid[x, y] = ButtonBrightness.Full; } else if (mGrid[x, y] == 2) { greengrid[x, y] = ButtonBrightness.Full; } else if (mShowPossibleMoves && mFlashCounter < 10) { if (mPossiblePlaces.Exists(p => p.Item1 == x && p.Item2 == y)) { redgrid[x, y] = ButtonBrightness.Low; greengrid[x, y] = ButtonBrightness.Low; } } } } for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { mLaunchpadDevice[x, y].SetBrightness(redgrid[x, y], greengrid[x, y]); } } if (mPlayerTurn == 1) { mLaunchpadDevice.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); mLaunchpadDevice.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } else if (mPlayerTurn == 2) { mLaunchpadDevice.GetButton(ToolbarButton.User1).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); mLaunchpadDevice.GetButton(ToolbarButton.User2).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); } if (mPlayerWinning == 1) { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off); } else if (mPlayerWinning == 2) { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); } else { mLaunchpadDevice.GetButton(ToolbarButton.Mixer).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off); } if (mShowPossibleMoves) { mLaunchpadDevice.GetButton(SideButton.TrackOn).TurnOnLight(); } else { mLaunchpadDevice.GetButton(SideButton.TrackOn).TurnOffLight(); } if (mConfirmTime > 0) { mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOnLight(); } else { mLaunchpadDevice.GetButton(ToolbarButton.Session).TurnOffLight(); } if (mSolo) { mLaunchpadDevice.GetButton(SideButton.Solo).TurnOnLight(); } else { mLaunchpadDevice.GetButton(SideButton.Solo).TurnOffLight(); } }