예제 #1
0
        public void Run()
        {
            var gg = new GamesenseClient("PERKEY_EXAMPLE", "Per Key Example", (int)IconColor.Red);

            // Register game
            Util.Print($"# Registering game: {gg.Game.GameDisplayName} ({gg.Game.GameName})");
            Util.Input(gg.RegisterGame());

            // Bind event
            Util.Print("# Binding events");
            Util.Input(gg.BindEvent("MOVEMENT_KEYS", 0, 1, (int)EventIcon.Compass, new System.Collections.Generic.List <BaseHandler>
            {
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_PER_KEY_W, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 255, 255)),
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_PER_KEY_A, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 255, 255)),
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_PER_KEY_S, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 255, 255)),
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_PER_KEY_D, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 255, 255)),
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_PER_KEY_R, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 0, 0))
            }));

            // Update event
            Util.Print("# Sending key bindigs");
            Util.Input(gg.SendGameEvent("MOVEMENT_KEYS", new System.Collections.Generic.Dictionary <string, object>
            {
                { "value", 1 }
            }));

            ReadKey(true);

            // Remove event
            Util.Print("# 4. Removing registrations");

            // Remove game
            Util.Input(gg.RemoveGame());
            ReadKey(true);
        }
예제 #2
0
        public void Run()
        {
            var gg = new GamesenseClient("FPS_SAMPLE", "Full Color Example", IconColor.Red);

            // Register game
            Util.Print($"# Registering game: {gg.Game.GameDisplayName} ({gg.Game.GameName})");
            Util.Input(gg.RegisterGame());

            // Bind event
            Util.Print("# Binding events");
            Util.Input(gg.BindEvent("TEST_EVENT", 0, 20, EventIcon.Ammo, new List <BaseHandler>
            {
                new GradientHandler(Constants.DEVICE_TYPE_KEYBOARD, Constants.ZONE_KEYBOARD_FKEYS, Constants.ILLUMINATION_MODE_PERCENT,
                                    new Gradient(new RGB(255, 0, 0), new RGB(0, 255, 0)),
                                    new RateRange(new List <Frequency>
                {
                    new Frequency(0, 10, 10),
                    new Frequency(11, 20, 5),
                    new Frequency(21, 50, 1),
                    new Frequency(51, 100, 0)
                },
                                                  new List <RepeatLimit>()
                                                  ))
            }));

            // Update event
            var osc         = new NumberOscilator(0, 100);
            var updateTimer = new Timer(50);

            updateTimer.Elapsed += (s, e) =>
            {
                osc.Update();
                Util.Input(gg.SendGameEvent("TEST_EVENT", new System.Collections.Generic.Dictionary <string, object>
                {
                    { "value", osc.Current }
                }));
            };
            updateTimer.Start();

            ReadKey(true);
            updateTimer.Stop();

            // Remove event
            Util.Print("# 4. Removing registrations");
            Util.Input(gg.RemoveEvent("TEST_EVENT"));
            // Remove game
            Util.Input(gg.RemoveGame());
            ReadKey(true);
        }
예제 #3
0
        public void Run()
        {
            var gg = new GamesenseClient("PERKEY_CUST_ZONE_EXAMPLE", "Per-Key example with custom zones", (int)IconColor.Red);

            // Register game
            Util.Print($"# Registering game: {gg.Game.GameDisplayName} ({gg.Game.GameName})");
            Util.Input(gg.RegisterGame());

            // Bind event
            Util.Print("# Binding events");
            Util.Input(gg.BindEvent("MOVEMENT_KEYS", 0, 1, (int)EventIcon.Compass, new List <BaseHandler>
            {
                // WASD
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, new List <int> {
                    HIDKeys.W,
                    HIDKeys.A,
                    HIDKeys.S,
                    HIDKeys.D
                }, Constants.ILLUMINATION_MODE_COLOR, new RGB(0, 255, 0)),

                // R, F, LShift
                new StaticColorHandler(Constants.DEVICE_TYPE_KEYBOARD, new List <int>
                {
                    HIDKeys.R,
                    HIDKeys.F,
                    HIDKeys.LSHIFT
                }, Constants.ILLUMINATION_MODE_COLOR, new RGB(255, 0, 255))
            }));

            // Update event
            Util.Print("# Sending key bindigs");
            Util.Input(gg.SendGameEvent("MOVEMENT_KEYS", new Dictionary <string, object>
            {
                { "value", 1 }
            }));

            ReadKey(true);

            // Remove event
            Util.Print("# 4. Removing registrations");

            // Remove game
            Util.Input(gg.RemoveGame());
            ReadKey(true);
        }
예제 #4
0
        public void Run()
        {
            var gg = new GamesenseClient("FPS_SAMPLE", "FPS Sample", IconColor.Red);

            // Register game
            Util.Print($"# Registering game: {gg.Game.GameDisplayName} ({gg.Game.GameName})");
            Util.Input(gg.RegisterGame());

            // Bind event
            Util.Print("# Binding events");
            Util.Input(gg.BindEvent("TEST_EVENT", 0, 100, EventIcon.Backpack, new List <BaseHandler>
            {
                new GradientHandler(Constants.DEVICE_TYPE_KEYBOARD, new List <int> {
                    HIDKeys.W,
                    HIDKeys.A,
                    HIDKeys.S,
                    HIDKeys.D
                }, Constants.ILLUMINATION_MODE_COLOR, new Gradient(new RGB(255, 0, 0), new RGB(0, 255, 0)))
            }));

            // Update event
            var osc         = new NumberOscilator(0, 100);
            var updateTimer = new Timer(10);

            updateTimer.Elapsed += (s, e) =>
            {
                osc.Update();
                Util.Input(gg.SendGameEvent("TEST_EVENT", new System.Collections.Generic.Dictionary <string, object>
                {
                    { "value", osc.Current }
                }));
            };
            updateTimer.Start();

            ReadKey(true);
            updateTimer.Stop();

            // Remove event
            Util.Print("# 4. Removing registrations");
            Util.Input(gg.RemoveEvent("TEST_EVENT"));
            // Remove game
            Util.Input(gg.RemoveGame());
            ReadKey(true);
        }