コード例 #1
0
 public void InitiateReactiveBackground()
 {
     for (int i = 0; i < 144; i++)
     {
         if (Program.StaticKeyColors[i] == Color.Transparent)
         {
             keyMatrix[i] = new SingleKeyFade(
                 20,
                 (byte)0,
                 (byte)0,
                 (byte)0,
                 (byte)0,
                 (byte)0,
                 (byte)0);
         }
         else
         {
             keyMatrix[i] = new SingleKeyFade(
                 20,
                 (byte)0,
                 (byte)0,
                 (byte)0,
                 (byte)Program.StaticKeyColors[i].R,
                 (byte)Program.StaticKeyColors[i].G,
                 (byte)Program.StaticKeyColors[i].B);
         }
         sendMatrix[i] = new StaticColorCollection();
     }
 }
コード例 #2
0
        public void KeyboardControl()
        {
            if (Program.RunKeyboardThread != 11)
            {
                return;
            }
            ;

            UpdateStatusMessage.ShowStatusMessage(2, "Starting Heatmap");

            // Raw Input Hook
            // http://www.codeproject.com/Articles/558413/Minimal-Key-Logger-Using-RAWINPUT
            //Program.InputHook = new RawInputHook();
            Program.InputHook.OnRawInputFromKeyboard += InputFromKeyboard_Heatmap;

            KeyboardWriter keyWriter = new KeyboardWriter();

            int sR = 0; int sG = 0; int sB = 0;
            int eR = 0; int eG = 0; int eB = 0;

            sR = Program.HeatmapColors.StartR;
            sG = Program.HeatmapColors.StartG;
            sB = Program.HeatmapColors.StartB;

            eR = Program.HeatmapColors.EndR;
            eG = Program.HeatmapColors.EndG;
            eB = Program.HeatmapColors.EndB;

            for (int i = 0; i < 144; i++)
            {
                keyMatrix[i] = new HeatmapKey(
                    (byte)sR,
                    (byte)sG,
                    (byte)sB,
                    (byte)eR,
                    (byte)eG,
                    (byte)eB);
                sendMatrix[i] = new StaticColorCollection();
            }


            while (Program.RunKeyboardThread == 11)
            {
                for (int i = 0; i < 144; i++)
                {
                    sendMatrix[i].SetD(keyMatrix[i].KeyColor);
                }

                keyWriter.Write(sendMatrix, true);

                Thread.Sleep(100);
            }

            Program.InputHook.OnRawInputFromKeyboard -= InputFromKeyboard_Heatmap;

            UpdateStatusMessage.ShowStatusMessage(2, "Stopping Heatmap");
        }
コード例 #3
0
        public static void KeyboardControl()
        {
            if (Program.RunKeyboardThread != 3)
            {
                return;
            }
            ;

            UpdateStatusMessage.ShowStatusMessage(2, "Starting Effects");

            KeyboardWriter keyWriter = new KeyboardWriter();

            SingleKeyFade[]         keyMatrix  = new SingleKeyFade[148];
            StaticColorCollection[] sendMatrix = new StaticColorCollection[144];

            MouseWriter mouseWriter = new MouseWriter();

            MouseColorCollection[] mouseMatrix = new MouseColorCollection[4];

            Random rnd = new Random();

            for (int i = 0; i < 144; i++)
            {
                keyMatrix[i]  = new SingleKeyFade(Program.EfSettings.Duration, 0, 0, 0);
                sendMatrix[i] = new StaticColorCollection();
            }
            for (int i = 144; i < 148; i++)
            {
                keyMatrix[i]         = new SingleKeyFade(Program.EfSettings.Duration, 0, 0, 0);
                mouseMatrix[i - 144] = new MouseColorCollection();
            }

            while (Program.RunKeyboardThread == 3)
            {
                int keyToLight = rnd.Next(0, 148);

                // Try 20 times to find a key that is finished its animation.
                // If a key can't be found, give up and run another cycle.
                for (int r = 0; r < 20; r++)
                {
                    if (keyMatrix[keyToLight].EffectInProgress == false)
                    {
                        switch (Program.EfColors.Mode)
                        {
                        case 1:
                            keyMatrix[keyToLight] = new SingleKeyFade(
                                Program.EfSettings.Duration,
                                (byte)Program.EfColors.StartR,
                                (byte)Program.EfColors.StartG,
                                (byte)Program.EfColors.StartB,
                                (byte)Program.EfColors.EndR,
                                (byte)Program.EfColors.EndG,
                                (byte)Program.EfColors.EndB);
                            break;

                        case 2:
                            keyMatrix[keyToLight] = new SingleKeyFade(
                                Program.EfSettings.Duration,
                                (byte)rnd.Next(Program.EfColors.SRandRLow, Program.EfColors.SRandRHigh),
                                (byte)rnd.Next(Program.EfColors.SRandGLow, Program.EfColors.SRandGHigh),
                                (byte)rnd.Next(Program.EfColors.SRandBLow, Program.EfColors.SRandBHigh),
                                (byte)Program.EfColors.EndR,
                                (byte)Program.EfColors.EndG,
                                (byte)Program.EfColors.EndB);
                            break;

                        case 3:
                            keyMatrix[keyToLight] = new SingleKeyFade(
                                Program.EfSettings.Duration,
                                (byte)Program.EfColors.StartR,
                                (byte)Program.EfColors.StartG,
                                (byte)Program.EfColors.StartB,
                                (byte)rnd.Next(Program.EfColors.ERandRLow, Program.EfColors.ERandRHigh),
                                (byte)rnd.Next(Program.EfColors.ERandGLow, Program.EfColors.ERandGHigh),
                                (byte)rnd.Next(Program.EfColors.ERandBLow, Program.EfColors.ERandBHigh));
                            break;

                        case 4:
                            keyMatrix[keyToLight] = new SingleKeyFade(
                                Program.EfSettings.Duration,
                                (byte)rnd.Next(Program.EfColors.SRandRLow, Program.EfColors.SRandRHigh),
                                (byte)rnd.Next(Program.EfColors.SRandGLow, Program.EfColors.SRandGHigh),
                                (byte)rnd.Next(Program.EfColors.SRandBLow, Program.EfColors.SRandBHigh),
                                (byte)rnd.Next(Program.EfColors.ERandRLow, Program.EfColors.ERandRHigh),
                                (byte)rnd.Next(Program.EfColors.ERandGLow, Program.EfColors.ERandGHigh),
                                (byte)rnd.Next(Program.EfColors.ERandBLow, Program.EfColors.ERandBHigh));
                            break;
                        }
                        break;
                    }
                }

                for (int i = 0; i < 144; i++)
                {
                    if (Program.AnimationsUseStaticKeys == true && Program.StaticKeyColorsBytes[i].Transparent == false)
                    {
                        sendMatrix[i].Set(Program.StaticKeyColorsBytes[i].KeyColor);
                    }
                    else
                    {
                        sendMatrix[i].SetD(keyMatrix[i].KeyColor);
                    }
                    keyMatrix[i].IncrementStep();
                }

                for (int i = 144; i < 148; i++)
                {
                    mouseMatrix[i - 144].Set(keyMatrix[i].KeyColor);
                    keyMatrix[i].IncrementStep();
                }

                keyWriter.Write(sendMatrix, true);
                if (Program.IncludeMouseInEffects)
                {
                    if (!Program.AnimationsUseStaticKeys)
                    {
                        mouseWriter.Write(mouseMatrix, true);
                    }
                    else
                    {
                        mouseWriter.Write(Program.MouseColors, true);
                    };
                }
                ;
                Thread.Sleep(Program.EfSettings.Frequency);
            }

            UpdateStatusMessage.ShowStatusMessage(2, "Stopping Effects");
        }