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.
1396 lines
61 KiB
C#
1396 lines
61 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using IntelOrca.Launchpad;
|
|
|
|
namespace IntelOrca.LaunchpadTests
|
|
{
|
|
|
|
class GeometrischeTests
|
|
{
|
|
private LaunchpadDevice mLaunchpadDevice;
|
|
private long mCurrentTicks = 0;
|
|
|
|
//Default speed is 4, valid speed frame is 1 - 9
|
|
private int speed = 4;
|
|
long delay;
|
|
private List<Point[]> availablePointGroups = new List<Point[]>();
|
|
private int activeGroup = -1;
|
|
|
|
private bool paused = false;
|
|
private bool gameEnd = false;
|
|
|
|
// Rects for centerbased Animation (only 4 max possible)
|
|
private Point[] Rect_center;
|
|
private Point[] Rect_inner;
|
|
private Point[] Rect_outer;
|
|
private Point[] Rect_edge;
|
|
|
|
// Lines for Horizontal based animation (8 Lines)
|
|
private Point[] Line_Top;
|
|
private Point[] Line_Upper;
|
|
private Point[] Line_UpperMid;
|
|
private Point[] Line_MidTop;
|
|
private Point[] Line_MidBot;
|
|
private Point[] Line_LowerMid;
|
|
private Point[] Line_Lower;
|
|
private Point[] Line_Bottom;
|
|
|
|
// Lines for Vertical based animation (8 Lines)
|
|
private Point[] Line_LeftEdge;
|
|
private Point[] Line_LeftOuter;
|
|
private Point[] Line_LeftInner;
|
|
private Point[] Line_MidLeft;
|
|
private Point[] Line_MidRight;
|
|
private Point[] Line_RightInner;
|
|
private Point[] Line_RightOuter;
|
|
private Point[] Line_RightEdge;
|
|
|
|
Random Randomizer;
|
|
|
|
//Specialty Groups
|
|
Point[] refreshGroup;
|
|
Point[] decayGroup;
|
|
int refreshIndexer;
|
|
int decayIndexer;
|
|
int raisingIndexer;
|
|
List<Point> currentActiveGroup ;
|
|
List<Point> currentRaisingActiveGroup = new List<Point>();
|
|
|
|
|
|
public enum animationColorMode { Green2Red, Red2Green, Green2Green, Red2Red };
|
|
animationColorMode currentMode = animationColorMode.Green2Green;
|
|
|
|
public enum animationStyle { CenteredIn, CenteredOut, HorizontalDown, HorizontalUp, VerticalRight, VerticalLeft, Noise, SmoothNoise, Matrix, WaveHorizontal, WaveVertical };
|
|
animationStyle currentStyle = animationStyle.VerticalRight;
|
|
public GeometrischeTests(LaunchpadDevice device)
|
|
{
|
|
mLaunchpadDevice = device;
|
|
|
|
//Add Buttonpress-Handler
|
|
mLaunchpadDevice.ButtonPressed += mLaunchpadDevice_ButtonPressed;
|
|
|
|
mLaunchpadDevice.GetButton(SideButton.Arm).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
mLaunchpadDevice.GetButton(SideButton.Solo).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
|
|
|
|
mLaunchpadDevice.GetButton(SideButton.Volume).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
mLaunchpadDevice.GetButton(SideButton.Pan).SetBrightness(ButtonBrightness.Off, ButtonBrightness.Medium);
|
|
|
|
mLaunchpadDevice.GetButton(SideButton.SoundA).SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full);
|
|
mLaunchpadDevice.GetButton(SideButton.SoundB).SetBrightness(ButtonBrightness.Low, ButtonBrightness.Low);
|
|
|
|
//Randomizer with always different Timestamp
|
|
Randomizer = new Random(Convert.ToInt32((new TimeSpan(DateTime.UtcNow.Ticks - new DateTime(2013, 06, 08).Ticks).TotalMinutes)));
|
|
|
|
Init();
|
|
}
|
|
|
|
private void mLaunchpadDevice_ButtonPressed(object sender, ButtonPressEventArgs e)
|
|
{
|
|
// If gridbutton was pressed
|
|
if (e.Type == ButtonType.Grid)
|
|
{
|
|
|
|
}
|
|
|
|
// If SNDA button is pressed -> Cycle to next Style
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.SoundA)
|
|
{
|
|
Init();
|
|
}
|
|
}
|
|
|
|
// If SNDB button is pressed -> Cycle to next Colormode
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.SoundB)
|
|
{
|
|
switch (currentMode)
|
|
{
|
|
case animationColorMode.Green2Green:
|
|
currentMode = animationColorMode.Green2Red;
|
|
break;
|
|
case animationColorMode.Red2Red:
|
|
currentMode = animationColorMode.Red2Green;
|
|
break;
|
|
case animationColorMode.Green2Red:
|
|
currentMode = animationColorMode.Red2Red;
|
|
break;
|
|
case animationColorMode.Red2Green:
|
|
currentMode = animationColorMode.Green2Green;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// If Volume button is pressed -> accelerate animation
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.Volume)
|
|
{
|
|
if (speed > 1)
|
|
{
|
|
speed--;
|
|
}
|
|
}
|
|
}
|
|
|
|
// If Pan button is pressed -> decelerate animation
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.Pan)
|
|
{
|
|
if (speed < 9)
|
|
{
|
|
speed++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// if Solobutton is pressed -> toggle pause animation
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.Solo)
|
|
{
|
|
if (paused)
|
|
paused = false;
|
|
else
|
|
paused = true;
|
|
}
|
|
}
|
|
|
|
//if armbutton is pressed -> end the loop
|
|
if (e.Type == ButtonType.Side)
|
|
{
|
|
if (e.SidebarButton == SideButton.Arm)
|
|
{
|
|
mLaunchpadDevice.Reset();
|
|
gameEnd = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void Init()
|
|
{
|
|
|
|
// Set the different styles and modes
|
|
switch (currentStyle)
|
|
{
|
|
case animationStyle.CenteredIn:
|
|
currentStyle = animationStyle.CenteredOut;
|
|
break;
|
|
case animationStyle.CenteredOut:
|
|
currentStyle = animationStyle.HorizontalDown;
|
|
break;
|
|
case animationStyle.HorizontalDown:
|
|
currentStyle = animationStyle.HorizontalUp;
|
|
break;
|
|
case animationStyle.HorizontalUp:
|
|
currentStyle = animationStyle.VerticalLeft;
|
|
break;
|
|
case animationStyle.Noise:
|
|
currentStyle = animationStyle.SmoothNoise;
|
|
break;
|
|
case animationStyle.VerticalLeft:
|
|
currentStyle = animationStyle.VerticalRight;
|
|
break;
|
|
case animationStyle.VerticalRight:
|
|
currentStyle = animationStyle.Noise;
|
|
break;
|
|
case animationStyle.WaveHorizontal:
|
|
break;
|
|
case animationStyle.WaveVertical:
|
|
break;
|
|
case animationStyle.SmoothNoise:
|
|
currentStyle = animationStyle.CenteredIn;
|
|
break;
|
|
case animationStyle.Matrix:
|
|
currentStyle = animationStyle.CenteredIn;
|
|
break;
|
|
}
|
|
|
|
//Reset Group indexer
|
|
activeGroup = 0;
|
|
|
|
|
|
#region CenteredIn/Out
|
|
// Fill valid Points of all rectangles
|
|
if (currentStyle == animationStyle.CenteredIn || currentStyle == animationStyle.CenteredOut)
|
|
{
|
|
Rect_center = null;
|
|
Rect_center = new Point[4];
|
|
Rect_center[0] = new Point(3, 3);
|
|
Rect_center[1] = new Point(3, 4);
|
|
Rect_center[2] = new Point(4, 3);
|
|
Rect_center[3] = new Point(4, 4);
|
|
|
|
Rect_inner = null;
|
|
Rect_inner = new Point[12];
|
|
Rect_inner[0] = new Point(2, 2);
|
|
Rect_inner[1] = new Point(3, 2);
|
|
Rect_inner[2] = new Point(4, 2);
|
|
Rect_inner[3] = new Point(5, 2);
|
|
Rect_inner[4] = new Point(2, 3);
|
|
Rect_inner[5] = new Point(5, 3);
|
|
Rect_inner[6] = new Point(2, 4);
|
|
Rect_inner[7] = new Point(5, 4);
|
|
Rect_inner[8] = new Point(2, 5);
|
|
Rect_inner[9] = new Point(3, 5);
|
|
Rect_inner[10] = new Point(4, 5);
|
|
Rect_inner[11] = new Point(5, 5);
|
|
|
|
Rect_outer = null;
|
|
Rect_outer = new Point[20];
|
|
Rect_outer[0] = new Point(1, 1);
|
|
Rect_outer[1] = new Point(1, 2);
|
|
Rect_outer[2] = new Point(1, 3);
|
|
Rect_outer[3] = new Point(1, 4);
|
|
Rect_outer[4] = new Point(1, 5);
|
|
Rect_outer[5] = new Point(1, 6);
|
|
Rect_outer[6] = new Point(2, 1);
|
|
Rect_outer[7] = new Point(2, 6);
|
|
Rect_outer[8] = new Point(3, 1);
|
|
Rect_outer[9] = new Point(3, 6);
|
|
Rect_outer[10] = new Point(4, 1);
|
|
Rect_outer[11] = new Point(4, 6);
|
|
Rect_outer[12] = new Point(5, 1);
|
|
Rect_outer[13] = new Point(5, 6);
|
|
Rect_outer[14] = new Point(6, 1);
|
|
Rect_outer[15] = new Point(6, 2);
|
|
Rect_outer[16] = new Point(6, 3);
|
|
Rect_outer[17] = new Point(6, 4);
|
|
Rect_outer[18] = new Point(6, 5);
|
|
Rect_outer[19] = new Point(6, 6);
|
|
|
|
Rect_edge = null;
|
|
Rect_edge = new Point[28];
|
|
Rect_edge[0] = new Point(0, 0);
|
|
Rect_edge[1] = new Point(1, 0);
|
|
Rect_edge[2] = new Point(2, 0);
|
|
Rect_edge[3] = new Point(3, 0);
|
|
Rect_edge[4] = new Point(4, 0);
|
|
Rect_edge[5] = new Point(5, 0);
|
|
Rect_edge[6] = new Point(6, 0);
|
|
Rect_edge[7] = new Point(7, 0);
|
|
Rect_edge[8] = new Point(0, 1);
|
|
Rect_edge[9] = new Point(7, 1);
|
|
Rect_edge[10] = new Point(0, 2);
|
|
Rect_edge[11] = new Point(7, 2);
|
|
Rect_edge[12] = new Point(0, 3);
|
|
Rect_edge[13] = new Point(7, 3);
|
|
Rect_edge[14] = new Point(0, 4);
|
|
Rect_edge[15] = new Point(7, 4);
|
|
Rect_edge[16] = new Point(0, 5);
|
|
Rect_edge[17] = new Point(7, 5);
|
|
Rect_edge[18] = new Point(0, 6);
|
|
Rect_edge[19] = new Point(7, 6);
|
|
Rect_edge[20] = new Point(0, 7);
|
|
Rect_edge[21] = new Point(1, 7);
|
|
Rect_edge[22] = new Point(2, 7);
|
|
Rect_edge[23] = new Point(3, 7);
|
|
Rect_edge[24] = new Point(4, 7);
|
|
Rect_edge[25] = new Point(5, 7);
|
|
Rect_edge[26] = new Point(6, 7);
|
|
Rect_edge[27] = new Point(7, 7);
|
|
|
|
// Clear all remaining groups to prevent overload of unassagned point groups
|
|
availablePointGroups.Clear();
|
|
if (currentStyle == animationStyle.CenteredOut)
|
|
{
|
|
|
|
availablePointGroups.Add(Rect_center);
|
|
availablePointGroups.Add(Rect_inner);
|
|
availablePointGroups.Add(Rect_outer);
|
|
availablePointGroups.Add(Rect_edge);
|
|
}
|
|
else
|
|
{
|
|
availablePointGroups.Add(Rect_edge);
|
|
availablePointGroups.Add(Rect_outer);
|
|
availablePointGroups.Add(Rect_inner);
|
|
availablePointGroups.Add(Rect_center);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Horizontal Up/Down
|
|
// Fill valid Points of all rectangles
|
|
if (currentStyle == animationStyle.HorizontalUp || currentStyle == animationStyle.HorizontalDown)
|
|
{
|
|
|
|
Line_Top = null;
|
|
Line_Top = new Point[8];
|
|
Line_Top[0] = new Point(0, 0);
|
|
Line_Top[1] = new Point(1, 0);
|
|
Line_Top[2] = new Point(2, 0);
|
|
Line_Top[3] = new Point(3, 0);
|
|
Line_Top[4] = new Point(4, 0);
|
|
Line_Top[5] = new Point(5, 0);
|
|
Line_Top[6] = new Point(6, 0);
|
|
Line_Top[7] = new Point(7, 0);
|
|
|
|
Line_Upper = null;
|
|
Line_Upper = new Point[8];
|
|
Line_Upper[0] = new Point(0, 1);
|
|
Line_Upper[1] = new Point(1, 1);
|
|
Line_Upper[2] = new Point(2, 1);
|
|
Line_Upper[3] = new Point(3, 1);
|
|
Line_Upper[4] = new Point(4, 1);
|
|
Line_Upper[5] = new Point(5, 1);
|
|
Line_Upper[6] = new Point(6, 1);
|
|
Line_Upper[7] = new Point(7, 1);
|
|
|
|
|
|
Line_UpperMid = null;
|
|
Line_UpperMid = new Point[8];
|
|
Line_UpperMid[0] = new Point(0, 2);
|
|
Line_UpperMid[1] = new Point(1, 2);
|
|
Line_UpperMid[2] = new Point(2, 2);
|
|
Line_UpperMid[3] = new Point(3, 2);
|
|
Line_UpperMid[4] = new Point(4, 2);
|
|
Line_UpperMid[5] = new Point(5, 2);
|
|
Line_UpperMid[6] = new Point(6, 2);
|
|
Line_UpperMid[7] = new Point(7, 2);
|
|
|
|
|
|
Line_MidTop = null;
|
|
Line_MidTop = new Point[8];
|
|
Line_MidTop[0] = new Point(0, 3);
|
|
Line_MidTop[1] = new Point(1, 3);
|
|
Line_MidTop[2] = new Point(2, 3);
|
|
Line_MidTop[3] = new Point(3, 3);
|
|
Line_MidTop[4] = new Point(4, 3);
|
|
Line_MidTop[5] = new Point(5, 3);
|
|
Line_MidTop[6] = new Point(6, 3);
|
|
Line_MidTop[7] = new Point(7, 3);
|
|
|
|
Line_MidBot = null;
|
|
Line_MidBot = new Point[8];
|
|
Line_MidBot[0] = new Point(0, 4);
|
|
Line_MidBot[1] = new Point(1, 4);
|
|
Line_MidBot[2] = new Point(2, 4);
|
|
Line_MidBot[3] = new Point(3, 4);
|
|
Line_MidBot[4] = new Point(4, 4);
|
|
Line_MidBot[5] = new Point(5, 4);
|
|
Line_MidBot[6] = new Point(6, 4);
|
|
Line_MidBot[7] = new Point(7, 4);
|
|
|
|
Line_LowerMid = null;
|
|
Line_LowerMid = new Point[8];
|
|
Line_LowerMid[0] = new Point(0, 5);
|
|
Line_LowerMid[1] = new Point(1, 5);
|
|
Line_LowerMid[2] = new Point(2, 5);
|
|
Line_LowerMid[3] = new Point(3, 5);
|
|
Line_LowerMid[4] = new Point(4, 5);
|
|
Line_LowerMid[5] = new Point(5, 5);
|
|
Line_LowerMid[6] = new Point(6, 5);
|
|
Line_LowerMid[7] = new Point(7, 5);
|
|
|
|
Line_Lower = null;
|
|
Line_Lower = new Point[8];
|
|
Line_Lower[0] = new Point(0, 6);
|
|
Line_Lower[1] = new Point(1, 6);
|
|
Line_Lower[2] = new Point(2, 6);
|
|
Line_Lower[3] = new Point(3, 6);
|
|
Line_Lower[4] = new Point(4, 6);
|
|
Line_Lower[5] = new Point(5, 6);
|
|
Line_Lower[6] = new Point(6, 6);
|
|
Line_Lower[7] = new Point(7, 6);
|
|
|
|
Line_Bottom = null;
|
|
Line_Bottom = new Point[8];
|
|
Line_Bottom[0] = new Point(0, 7);
|
|
Line_Bottom[1] = new Point(1, 7);
|
|
Line_Bottom[2] = new Point(2, 7);
|
|
Line_Bottom[3] = new Point(3, 7);
|
|
Line_Bottom[4] = new Point(4, 7);
|
|
Line_Bottom[5] = new Point(5, 7);
|
|
Line_Bottom[6] = new Point(6, 7);
|
|
Line_Bottom[7] = new Point(7, 7);
|
|
|
|
|
|
// Clear all remaining groups to prevent overload of unassagned point groups
|
|
availablePointGroups.Clear();
|
|
if (currentStyle == animationStyle.HorizontalDown)
|
|
{
|
|
|
|
availablePointGroups.Add(Line_Top);
|
|
availablePointGroups.Add(Line_Upper);
|
|
availablePointGroups.Add(Line_UpperMid);
|
|
availablePointGroups.Add(Line_MidTop);
|
|
availablePointGroups.Add(Line_MidBot);
|
|
availablePointGroups.Add(Line_LowerMid);
|
|
availablePointGroups.Add(Line_Lower);
|
|
availablePointGroups.Add(Line_Bottom);
|
|
|
|
}
|
|
else
|
|
{
|
|
availablePointGroups.Add(Line_Bottom);
|
|
availablePointGroups.Add(Line_Lower);
|
|
availablePointGroups.Add(Line_LowerMid);
|
|
availablePointGroups.Add(Line_MidBot);
|
|
availablePointGroups.Add(Line_MidTop);
|
|
availablePointGroups.Add(Line_UpperMid);
|
|
availablePointGroups.Add(Line_Upper);
|
|
availablePointGroups.Add(Line_Top);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Vertical Left/Right
|
|
if (currentStyle == animationStyle.HorizontalUp || currentStyle == animationStyle.HorizontalDown)
|
|
{
|
|
|
|
|
|
Line_LeftEdge = null;
|
|
Line_LeftEdge = new Point[8];
|
|
Line_LeftEdge[0] = new Point(0, 0);
|
|
Line_LeftEdge[1] = new Point(0, 1);
|
|
Line_LeftEdge[2] = new Point(0, 2);
|
|
Line_LeftEdge[3] = new Point(0, 3);
|
|
Line_LeftEdge[4] = new Point(0, 4);
|
|
Line_LeftEdge[5] = new Point(0, 5);
|
|
Line_LeftEdge[6] = new Point(0, 6);
|
|
Line_LeftEdge[7] = new Point(0, 7);
|
|
|
|
Line_LeftOuter = null;
|
|
Line_LeftOuter = new Point[8];
|
|
Line_LeftOuter[0] = new Point(1, 0);
|
|
Line_LeftOuter[1] = new Point(1, 1);
|
|
Line_LeftOuter[2] = new Point(1, 2);
|
|
Line_LeftOuter[3] = new Point(1, 3);
|
|
Line_LeftOuter[4] = new Point(1, 4);
|
|
Line_LeftOuter[5] = new Point(1, 5);
|
|
Line_LeftOuter[6] = new Point(1, 6);
|
|
Line_LeftOuter[7] = new Point(1, 7);
|
|
|
|
|
|
Line_LeftInner = null;
|
|
Line_LeftInner = new Point[8];
|
|
Line_LeftInner[0] = new Point(2, 0);
|
|
Line_LeftInner[1] = new Point(2, 1);
|
|
Line_LeftInner[2] = new Point(2, 2);
|
|
Line_LeftInner[3] = new Point(2, 3);
|
|
Line_LeftInner[4] = new Point(2, 4);
|
|
Line_LeftInner[5] = new Point(2, 5);
|
|
Line_LeftInner[6] = new Point(2, 6);
|
|
Line_LeftInner[7] = new Point(2, 7);
|
|
|
|
|
|
Line_MidLeft = null;
|
|
Line_MidLeft = new Point[8];
|
|
Line_MidLeft[0] = new Point(3, 0);
|
|
Line_MidLeft[1] = new Point(3, 1);
|
|
Line_MidLeft[2] = new Point(3, 2);
|
|
Line_MidLeft[3] = new Point(3, 3);
|
|
Line_MidLeft[4] = new Point(3, 4);
|
|
Line_MidLeft[5] = new Point(3, 5);
|
|
Line_MidLeft[6] = new Point(3, 6);
|
|
Line_MidLeft[7] = new Point(3, 7);
|
|
|
|
Line_MidRight = null;
|
|
Line_MidRight = new Point[8];
|
|
Line_MidRight[0] = new Point(4, 0);
|
|
Line_MidRight[1] = new Point(4, 1);
|
|
Line_MidRight[2] = new Point(4, 2);
|
|
Line_MidRight[3] = new Point(4, 3);
|
|
Line_MidRight[4] = new Point(4, 4);
|
|
Line_MidRight[5] = new Point(4, 5);
|
|
Line_MidRight[6] = new Point(4, 6);
|
|
Line_MidRight[7] = new Point(4, 7);
|
|
|
|
Line_RightInner = null;
|
|
Line_RightInner = new Point[8];
|
|
Line_RightInner[0] = new Point(5, 0);
|
|
Line_RightInner[1] = new Point(5, 1);
|
|
Line_RightInner[2] = new Point(5, 2);
|
|
Line_RightInner[3] = new Point(5, 3);
|
|
Line_RightInner[4] = new Point(5, 4);
|
|
Line_RightInner[5] = new Point(5, 5);
|
|
Line_RightInner[6] = new Point(5, 6);
|
|
Line_RightInner[7] = new Point(5, 7);
|
|
|
|
Line_RightOuter = null;
|
|
Line_RightOuter = new Point[8];
|
|
Line_RightOuter[0] = new Point(6, 0);
|
|
Line_RightOuter[1] = new Point(6, 1);
|
|
Line_RightOuter[2] = new Point(6, 2);
|
|
Line_RightOuter[3] = new Point(6, 3);
|
|
Line_RightOuter[4] = new Point(6, 4);
|
|
Line_RightOuter[5] = new Point(6, 5);
|
|
Line_RightOuter[6] = new Point(6, 6);
|
|
Line_RightOuter[7] = new Point(6, 7);
|
|
|
|
Line_RightEdge = null;
|
|
Line_RightEdge = new Point[8];
|
|
Line_RightEdge[0] = new Point(7, 0);
|
|
Line_RightEdge[1] = new Point(7, 1);
|
|
Line_RightEdge[2] = new Point(7, 2);
|
|
Line_RightEdge[3] = new Point(7, 3);
|
|
Line_RightEdge[4] = new Point(7, 4);
|
|
Line_RightEdge[5] = new Point(7, 5);
|
|
Line_RightEdge[6] = new Point(7, 6);
|
|
Line_RightEdge[7] = new Point(7, 7);
|
|
|
|
|
|
// Clear all remaining groups to prevent overload of unassagned point groups
|
|
availablePointGroups.Clear();
|
|
if (currentStyle == animationStyle.VerticalRight)
|
|
{
|
|
|
|
availablePointGroups.Add(Line_LeftEdge);
|
|
availablePointGroups.Add(Line_LeftOuter);
|
|
availablePointGroups.Add(Line_LeftInner);
|
|
availablePointGroups.Add(Line_MidLeft);
|
|
availablePointGroups.Add(Line_MidRight);
|
|
availablePointGroups.Add(Line_RightInner);
|
|
availablePointGroups.Add(Line_RightOuter);
|
|
availablePointGroups.Add(Line_RightEdge);
|
|
|
|
}
|
|
else
|
|
{
|
|
availablePointGroups.Add(Line_RightEdge);
|
|
availablePointGroups.Add(Line_RightOuter);
|
|
availablePointGroups.Add(Line_RightInner);
|
|
availablePointGroups.Add(Line_MidRight);
|
|
availablePointGroups.Add(Line_MidLeft);
|
|
availablePointGroups.Add(Line_LeftInner);
|
|
availablePointGroups.Add(Line_LeftOuter);
|
|
availablePointGroups.Add(Line_LeftEdge);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
public void Run()
|
|
{
|
|
// Control of internal ticks (6*12 Frames are skipped to simulate a propper time pass)
|
|
long last_tick = Environment.TickCount;
|
|
|
|
|
|
// GameLoop
|
|
while (true && !gameEnd)
|
|
{
|
|
delay = 24 * speed;
|
|
if (Environment.TickCount - last_tick < delay)
|
|
continue;
|
|
mCurrentTicks += Environment.TickCount - last_tick;
|
|
last_tick = Environment.TickCount;
|
|
|
|
// Possibility to freeze the animation)
|
|
if (!paused)
|
|
{
|
|
// Update of all rect-colors
|
|
Update();
|
|
// redraw the new information on the board
|
|
Draw();
|
|
}
|
|
|
|
}
|
|
}
|
|
private void Update()
|
|
{
|
|
|
|
//Rotate to next group of points (restart at first at the end)
|
|
// potential inserting point of Rebounce cycling (start2end -> end2start instead of start2end->start2end)
|
|
if (activeGroup >= availablePointGroups.Count() - 1)
|
|
{
|
|
activeGroup = 0;
|
|
}
|
|
else
|
|
{
|
|
activeGroup++;
|
|
}
|
|
|
|
// only refresh active rect -> other ones "decay into next phase"
|
|
switch (currentStyle)
|
|
{
|
|
#region CenteredIn
|
|
case animationStyle.CenteredIn:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
decayGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
refreshGroupColors(Rect_edge);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
refreshGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Rect_center);
|
|
refreshGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
case 3:
|
|
refreshGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
#endregion
|
|
#region CenteredOut
|
|
case animationStyle.CenteredOut:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
refreshGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Rect_center);
|
|
refreshGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
refreshGroupColors(Rect_outer);
|
|
decayGroupColors(Rect_edge);
|
|
break;
|
|
case 3:
|
|
decayGroupColors(Rect_center);
|
|
decayGroupColors(Rect_inner);
|
|
decayGroupColors(Rect_outer);
|
|
refreshGroupColors(Rect_edge);
|
|
break;
|
|
|
|
}
|
|
break;
|
|
#endregion
|
|
#region HorizontalDown
|
|
case animationStyle.HorizontalDown:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
refreshGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Line_Top);
|
|
refreshGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
refreshGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 3:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
refreshGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 4:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
refreshGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 5:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
refreshGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 6:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
refreshGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 7:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
refreshGroupColors(Line_Bottom);
|
|
break;
|
|
|
|
}
|
|
break;
|
|
#endregion
|
|
#region HorizontalUp
|
|
case animationStyle.HorizontalUp:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
refreshGroupColors(Line_Bottom);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
refreshGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
refreshGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 3:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
refreshGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 4:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
refreshGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 5:
|
|
decayGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
refreshGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 6:
|
|
decayGroupColors(Line_Top);
|
|
refreshGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
case 7:
|
|
refreshGroupColors(Line_Top);
|
|
decayGroupColors(Line_Upper);
|
|
decayGroupColors(Line_UpperMid);
|
|
decayGroupColors(Line_MidTop);
|
|
decayGroupColors(Line_MidBot);
|
|
decayGroupColors(Line_LowerMid);
|
|
decayGroupColors(Line_Lower);
|
|
decayGroupColors(Line_Bottom);
|
|
break;
|
|
|
|
}
|
|
break;
|
|
#endregion
|
|
#region Noise
|
|
case animationStyle.Noise:
|
|
//Pick certain amount of cells randomly and decay the rest
|
|
currentActiveGroup = new List<Point>();
|
|
|
|
while (currentActiveGroup.Count() < 8)
|
|
{
|
|
//create new Random point
|
|
Point TempPoint = new Point(Randomizer.Next(0, 8), Randomizer.Next(0, 8));
|
|
|
|
//check if new Point is allready in the current group
|
|
if (currentActiveGroup.Contains(TempPoint))
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
//if its not in the activeGroup it must be added
|
|
currentActiveGroup.Add(TempPoint);
|
|
}
|
|
}
|
|
|
|
Point[] refreshGroup = new Point[8];
|
|
int refreshIndexer = 0;
|
|
|
|
Point[] decayGroup = new Point[56];
|
|
int decayIndexer = 0;
|
|
|
|
//When the new group is picked, they shall be refreshed while the rest decays
|
|
for (int yPos = 0; yPos < 8; yPos++)
|
|
{
|
|
for (int xPos = 0; xPos < 8; xPos++)
|
|
{
|
|
Point TempPoint = new Point(xPos, yPos);
|
|
if (currentActiveGroup.Contains(TempPoint))
|
|
{
|
|
refreshGroup[refreshIndexer++] = new Point(TempPoint.X, TempPoint.Y);
|
|
}
|
|
else
|
|
{
|
|
decayGroup[decayIndexer++] = new Point(TempPoint.X, TempPoint.Y);
|
|
}
|
|
}
|
|
}
|
|
|
|
//after groups are sorted update their lightinformation
|
|
refreshGroupColors(refreshGroup);
|
|
decayGroupColors(decayGroup);
|
|
|
|
break;
|
|
#endregion
|
|
#region SmoothNoise
|
|
case animationStyle.SmoothNoise:
|
|
//Pick certain amount of cells randomly from the decaying group
|
|
|
|
while (currentRaisingActiveGroup.Count() < 32)
|
|
{
|
|
//create new Random point
|
|
Point TempPoint = new Point(Randomizer.Next(0, 8), Randomizer.Next(0, 8));
|
|
|
|
//check if new Point is allready in the current group
|
|
if (currentRaisingActiveGroup.Contains(TempPoint))
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
//if its not in the activeGroup it must be added
|
|
currentRaisingActiveGroup.Add(TempPoint);
|
|
}
|
|
}
|
|
|
|
//check if maxed ListEntries need to be put to decay again
|
|
List<Point> RemoveList = new List<Point>();
|
|
foreach (Point P in currentRaisingActiveGroup)
|
|
{
|
|
if (checkIfMaxedPoint(P))
|
|
{
|
|
RemoveList.Add(P);
|
|
}
|
|
}
|
|
|
|
foreach (Point P in RemoveList)
|
|
{
|
|
currentRaisingActiveGroup.Remove(P);
|
|
}
|
|
|
|
//technicly no Tiles are directly refreshed-> all will first be set to increase slowly
|
|
refreshGroup = new Point[currentRaisingActiveGroup.Count()];
|
|
refreshIndexer = 0;
|
|
|
|
//An Point not in the List of RaisingPoints will decay
|
|
decayGroup = new Point[64 - currentRaisingActiveGroup.Count()];
|
|
decayIndexer = 0;
|
|
|
|
//When the new group is picked, they shall be refreshed while the rest decays
|
|
for (int yPos = 0; yPos < 8; yPos++)
|
|
{
|
|
for (int xPos = 0; xPos < 8; xPos++)
|
|
{
|
|
Point TempPoint = new Point(xPos, yPos);
|
|
if (currentRaisingActiveGroup.Contains(TempPoint))
|
|
{
|
|
refreshGroup[refreshIndexer++] = new Point(TempPoint.X, TempPoint.Y);
|
|
}
|
|
else
|
|
{
|
|
decayGroup[decayIndexer++] = new Point(TempPoint.X, TempPoint.Y);
|
|
}
|
|
}
|
|
}
|
|
|
|
//after groups are sorted update their lightinformation
|
|
increaseGroupColors(refreshGroup);
|
|
decayGroupColors(decayGroup);
|
|
|
|
|
|
break;
|
|
#endregion
|
|
#region VerticalLeft
|
|
case animationStyle.VerticalLeft:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
refreshGroupColors(Line_RightEdge);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
refreshGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
refreshGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 3:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
refreshGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 4:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
refreshGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 5:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
refreshGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 6:
|
|
decayGroupColors(Line_LeftEdge);
|
|
refreshGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 7:
|
|
refreshGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
}
|
|
break;
|
|
#endregion
|
|
#region VerticalRight
|
|
case animationStyle.VerticalRight:
|
|
switch (activeGroup)
|
|
{
|
|
case 0:
|
|
refreshGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 1:
|
|
decayGroupColors(Line_LeftEdge);
|
|
refreshGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 2:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
refreshGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 3:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
refreshGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 4:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
refreshGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 5:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
refreshGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 6:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
refreshGroupColors(Line_RightOuter);
|
|
decayGroupColors(Line_RightEdge);
|
|
break;
|
|
case 7:
|
|
decayGroupColors(Line_LeftEdge);
|
|
decayGroupColors(Line_LeftOuter);
|
|
decayGroupColors(Line_LeftInner);
|
|
decayGroupColors(Line_MidLeft);
|
|
decayGroupColors(Line_MidRight);
|
|
decayGroupColors(Line_RightInner);
|
|
decayGroupColors(Line_RightOuter);
|
|
refreshGroupColors(Line_RightEdge);
|
|
break;
|
|
}
|
|
break;
|
|
#endregion
|
|
case animationStyle.WaveHorizontal:
|
|
break;
|
|
case animationStyle.WaveVertical:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
private bool checkIfMaxedPoint(Point p)
|
|
{
|
|
switch (currentMode)
|
|
{
|
|
case animationColorMode.Green2Green:
|
|
if (mLaunchpadDevice[p.X, p.Y].GreenBrightness == ButtonBrightness.Full)
|
|
return true;
|
|
else
|
|
return false;
|
|
case animationColorMode.Green2Red:
|
|
if (mLaunchpadDevice[p.X, p.Y].GreenBrightness == ButtonBrightness.Full)
|
|
return true;
|
|
else
|
|
return false;
|
|
case animationColorMode.Red2Red:
|
|
if (mLaunchpadDevice[p.X, p.Y].RedBrightness == ButtonBrightness.Full)
|
|
return true;
|
|
else
|
|
return false;
|
|
case animationColorMode.Red2Green:
|
|
if (mLaunchpadDevice[p.X, p.Y].RedBrightness == ButtonBrightness.Full)
|
|
return true;
|
|
else
|
|
return false;
|
|
default:
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
private void refreshGroupColors(Point[] currentGroup)
|
|
{
|
|
//Depending on Colormode refresh the Brightness of that button group
|
|
switch (currentMode)
|
|
{
|
|
case animationColorMode.Green2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
}
|
|
break;
|
|
case animationColorMode.Green2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
private void increaseGroupColors(Point[] currentGroup)
|
|
{
|
|
// Depending on colormode decay
|
|
|
|
switch (currentMode)
|
|
{
|
|
case animationColorMode.Green2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].GreenBrightness)
|
|
{
|
|
case ButtonBrightness.Off:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Low);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Medium);
|
|
break;
|
|
|
|
}
|
|
}
|
|
break;
|
|
case animationColorMode.Green2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].GreenBrightness)
|
|
{
|
|
case ButtonBrightness.Off:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Low);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Medium);
|
|
break;
|
|
|
|
}
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].RedBrightness)
|
|
{
|
|
case ButtonBrightness.Off:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Medium);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Low);
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].RedBrightness)
|
|
{
|
|
case ButtonBrightness.Off:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Off);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Off);
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void decayGroupColors(Point[] currentGroup)
|
|
{
|
|
// Depending on colormode decay
|
|
|
|
switch (currentMode)
|
|
{
|
|
case animationColorMode.Green2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].GreenBrightness)
|
|
{
|
|
case ButtonBrightness.Full:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Medium);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Low);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off);
|
|
break;
|
|
|
|
}
|
|
}
|
|
break;
|
|
case animationColorMode.Green2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].GreenBrightness)
|
|
{
|
|
case ButtonBrightness.Full:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Medium);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Low);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Full, ButtonBrightness.Off);
|
|
break;
|
|
|
|
}
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Green:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].RedBrightness)
|
|
{
|
|
case ButtonBrightness.Full:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Low);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Medium);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full);
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
break;
|
|
case animationColorMode.Red2Red:
|
|
foreach (Point Tile in currentGroup)
|
|
{
|
|
switch (mLaunchpadDevice[Tile.X, Tile.Y].RedBrightness)
|
|
{
|
|
case ButtonBrightness.Full:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Medium, ButtonBrightness.Off);
|
|
break;
|
|
case ButtonBrightness.Medium:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Low, ButtonBrightness.Off);
|
|
break;
|
|
case ButtonBrightness.Low:
|
|
mLaunchpadDevice[Tile.X, Tile.Y].SetBrightness(ButtonBrightness.Off, ButtonBrightness.Off);
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
private void Draw()
|
|
{
|
|
|
|
// Refresh devices light information
|
|
mLaunchpadDevice.Refresh();
|
|
}
|
|
}
|
|
}
|