コード例 #1
0
        private static async void ChromaUpdateAsync()
        {
            AllKeys.Remove(Key.Invalid); // no idea why this key is inside the enum?
            var opacity      = 0.5;
            var keyboardGrid = KeyboardCustom.Create();
            var mouseGrid    = MouseCustom.Create();
            var chroma       = await ColoreProvider.CreateNativeAsync();

            var bg_playing      = new ColoreColor((byte)Properties.Settings.Default.Background_Playing.R, (byte)Properties.Settings.Default.Background_Playing.G, (byte)Properties.Settings.Default.Background_Playing.B);
            var bg_pause        = new ColoreColor((byte)Properties.Settings.Default.Background_Pause.R, (byte)Properties.Settings.Default.Background_Pause.G, (byte)Properties.Settings.Default.Background_Pause.B);
            var pos_fore        = new ColoreColor((byte)Properties.Settings.Default.Position_Foreground.R, (byte)Properties.Settings.Default.Position_Foreground.G, (byte)Properties.Settings.Default.Position_Foreground.B);
            var pos_back        = new ColoreColor((byte)Properties.Settings.Default.Position_Background.R, (byte)Properties.Settings.Default.Position_Background.G, (byte)Properties.Settings.Default.Position_Background.B);
            var vol             = new ColoreColor((byte)Properties.Settings.Default.Volume.R, (byte)Properties.Settings.Default.Volume.G, (byte)Properties.Settings.Default.Volume.B);
            var backgroundColor = ColoreColor.Black;

            while (true)
            {
                var backgroundDetermine = player.PlayerEngine.PlayerState == ITPlayerState.ITPlayerStatePlaying ? bg_playing : bg_pause;
                backgroundColor = BackgroundColorDecision(ref opacity, Properties.Settings.Default.AdaptiveDensity ? ActiveDevice.AudioMeterInformation.MasterPeakValue : 1, backgroundDetermine);// (10 - Properties.Settings.Default.RefreshRate) + 1, backgroundDetermine);
                ColorsVariableDecision(ref bg_playing, ref bg_pause, ref pos_fore, ref pos_back, ref vol);
                try
                {
                    var currentTime = TimeSpan.FromSeconds(player.PlayerEngine.PlayerPosition);
                    var position    = player.CalculatedPosition;
                    keyboardGrid.Set(backgroundColor);
                    mouseGrid.Set(backgroundColor);
                    SetIndividualKeys(ref keyboardGrid);
                    SetPlayingTime(ref keyboardGrid, currentTime, ColoreColor.Red, ThisIsWhatCalledOrange, ColoreColor.Yellow);
                    SetPlayingPosition(ref keyboardGrid, position, FunctionKeys, pos_fore, pos_back);
                    SetPlayingPosition(ref mouseGrid, position, Properties.Settings.Default.ReverseLEDRender ? RightStrip : LeftStrip, pos_fore, pos_back);
                    SetVolumeScale(ref mouseGrid, Properties.Settings.Default.ReverseLEDRender ? LeftStrip : RightStrip, vol);
                    SetVolumeScale(ref keyboardGrid, DPadKeys, vol);
                }
                catch
                {
                    continue; //in case the music is not playing yet, the position is unobtainable.
                }
                finally
                {
                    await chroma.Keyboard.SetCustomAsync(keyboardGrid);

                    await chroma.Mouse.SetGridAsync(mouseGrid);

                    await chroma.Headset.SetAllAsync(backgroundColor);

                    await chroma.Mousepad.SetAllAsync(backgroundColor);

                    Thread.Sleep(500 * (Properties.Settings.Default.AdaptiveDensity ? Properties.Settings.Default.RefreshRate / 10 : 1));
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Fry2412/MicMute
        private void initChromaSkd()
        {
            var t = ColoreProvider.CreateNativeAsync();

            t.Wait();
            this.chroma = t.Result;

            this.muted = KeyboardCustom.Create();
            this.muted.Set(Colore.Data.Color.Red);
            this.muted[Key.Macro4] = Colore.Data.Color.Green;

            this.unmuted = KeyboardCustom.Create();
            this.unmuted.Set(Colore.Data.Color.Green);
            this.unmuted[Key.Macro4] = Colore.Data.Color.Red;
        }
コード例 #3
0
        public Task SetColors(IEnumerable <RGB> colors, CancellationToken token)
        {
            var nextColors = KeyboardCustom.Create();

            var i = 0;

            foreach (var color in colors)
            {
                var position = keyboardPositions[i];
                nextColors[position.Row, position.Column] = new Colore.Data.Color(
                    (byte)color.R, (byte)color.G, (byte)color.B);

                i++;
            }

            return(keyboard.SetCustomAsync(nextColors));
        }
コード例 #4
0
 public SnakeGrid()
 {
     Chroma.Instance.Keyboard.Clear();
     grid = KeyboardCustom.Create();
     initGrid();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: Desz01ate/rGEChroma
        static async Task MainAsync(string[] args)
        {
            string char1Name, char2Name, char3Name;
            int    char1CurrentHP, char1MaxHP, char1CurrentMP, char1MaxMP, char2CurrentHP, char2MaxHP, char2CurrentMP, char2MaxMP, char3CurrentHP, char3MaxHP, char3CurrentMP, char3MaxMP;
            int    familyLevel = 0;
            uint   bufferSize  = 255;
            var    keyboard    = KeyboardCustom.Create();
            var    chroma      = await ColoreProvider.CreateNativeAsync();

            await chroma.SetAllAsync(fadeRed);

WaitGame:
            try
            {
                Process  GameProcess = Process.GetProcessesByName("rGE").FirstOrDefault();
                VAMemory vam         = new VAMemory("rGE");
                vam.ReadInt32(GameProcess.MainModule.BaseAddress);
                while (true)
                {
                    Console.Clear();
                    //HP
                    char1CurrentHP = vam.ReadInt32((IntPtr)(vam.getBaseAddress + CurrentHP[0]));
                    char1MaxHP     = vam.ReadInt32((IntPtr)(vam.getBaseAddress + MaxHP[0]));
                    char2CurrentHP = vam.ReadInt32((IntPtr)(vam.getBaseAddress + CurrentHP[1]));
                    char2MaxHP     = vam.ReadInt32((IntPtr)(vam.getBaseAddress + MaxHP[1]));
                    char3CurrentHP = vam.ReadInt32((IntPtr)(vam.getBaseAddress + CurrentHP[2]));
                    char3MaxHP     = vam.ReadInt32((IntPtr)(vam.getBaseAddress + MaxHP[2]));
                    //MP
                    char1CurrentMP = vam.ReadInt16((IntPtr)(vam.getBaseAddress + CurrentMP[0]));
                    char1MaxMP     = vam.ReadInt16((IntPtr)(vam.getBaseAddress + MaxMP[0]));
                    char2CurrentMP = vam.ReadInt16((IntPtr)(vam.getBaseAddress + CurrentMP[1]));
                    char2MaxMP     = vam.ReadInt16((IntPtr)(vam.getBaseAddress + MaxMP[1]));
                    char3CurrentMP = vam.ReadInt16((IntPtr)(vam.getBaseAddress + CurrentMP[2]));
                    char3MaxMP     = vam.ReadInt16((IntPtr)(vam.getBaseAddress + MaxMP[2]));

                    var HP1Point = Math.Round((double)char1CurrentHP / char1MaxHP, 2);
                    var HP2Point = Math.Round((double)char2CurrentHP / char2MaxHP, 2);
                    var HP3Point = Math.Round((double)char3CurrentHP / char3MaxHP, 2);
                    var MP1Point = Math.Round((double)char1CurrentMP / char1MaxMP, 2);
                    var MP2Point = Math.Round((double)char2CurrentMP / char2MaxMP, 2);
                    var MP3Point = Math.Round((double)char3CurrentMP / char3MaxMP, 2);
                    RenderKeyboard(ref keyboard, new[] { (int)(HP1Point * 10), (int)(HP2Point * 10), (int)(HP3Point * 10) }, new[] { (int)(MP1Point * 10), (int)(MP2Point * 10), (int)(MP3Point * 10) });
                    await chroma.Keyboard.SetCustomAsync(keyboard);

                    //char1Name = vam.ReadStringASCII((IntPtr)(vam.getBaseAddress + Name[0]), bufferSize);
                    //char2Name = vam.ReadStringASCII((IntPtr)(vam.getBaseAddress + Name[1]), bufferSize);
                    //char3Name = vam.ReadStringASCII((IntPtr)(vam.getBaseAddress + Name[2]), bufferSize);
                    //char1Name = char1Name.Substring(0, char1Name.IndexOf("\0"));
                    //char2Name = char2Name.Substring(0, char2Name.IndexOf("\0"));
                    //char3Name = char3Name.Substring(0, char3Name.IndexOf("\0"));
                    //Console.WriteLine($"\rName : {char1Name} {char1CurrentMP}/{char1MaxMP}[{HP1Point * 100}]% ");
                    //Console.WriteLine($"\rName : {char2Name} {char2CurrentMP}/{char2MaxMP}[{HP2Point * 100}]% ");
                    //Console.WriteLine($"\rName : {char3Name} {char3CurrentMP}/{char3MaxMP}[{HP3Point * 100}]% ");
                    Thread.Sleep(500);
                }
            }

            catch
            {
                keyboard.Set(fadeRed);
                await chroma.Keyboard.SetCustomAsync(keyboard);

                Console.Write("\rWaiting for character info to allocate into memory...");
                Thread.Sleep(500);
                goto WaitGame;
            }
        }
コード例 #6
0
        static async Task <bool> SwitchColour(AppCall args, IChroma chroma)
        {
            if (args.invalid)
            {
                return(false);
            }

            var grid = KeyboardCustom.Create();

            if (args.addWeak || args.addStrong)
            {
                grid = currentKeyboard;
            }

            ColoreColor clr = ColoreColor.Black;

            foreach (string fline in File.ReadLines(args.filePath))
            {
                string line = fline;
                if (line.Contains(";"))
                {
                    line = line.Substring(0, line.IndexOf(";"));
                }
                line = line.Trim();
                if (line == "")
                {
                    continue;
                }


                if (line.ToLower().StartsWith("rgb"))
                {
                    var b = line.Remove(0, 3).Trim();

                    try
                    {
                        clr = ColoreColor.FromRgb(uint.Parse(b, System.Globalization.NumberStyles.HexNumber));
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("yo your color was invalid dude");
                        Console.WriteLine(e);
                        return(false);
                    }
                }

                if (line.ToLower().StartsWith("all"))
                {
                    grid.Set(clr);
                }

                if (!Enum.TryParse(line, true, out Key currKey) && !line.ToLower().StartsWith("rgb") && !line.ToLower().StartsWith("all")) // horrible code hours
                {
                    Console.WriteLine("thats not a valid key pls fix");
                    Console.WriteLine(currKey.ToString());
                    return(false);
                }


                if (args.addWeak)
                {
                    if (grid[currKey] == ColoreColor.Black)
                    {
                        grid[currKey] = clr;
                    }
                }
                else
                {
                    grid[currKey] = clr;
                }
            }

            currentKeyboard = grid;
            Console.WriteLine("bro");
            await chroma.Keyboard.SetCustomAsync(grid);

            return(true);
        }