示例#1
0
        public void StartEyeTracking()
        {
            using (var eyeXHost = new EyeXHost())
            {
                // Create a data stream: lightly filtered gaze point data.
                // Other choices of data streams include EyePositionDataStream and FixationDataStream.
                using (var fixationGazeDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Slow))
                {
                    // Start the EyeX host.
                    eyeXHost.Start();
                    eyeXHost.EyeTrackingDeviceStatusChanged += EyeXHost_EyeTrackingDeviceStatusChanged;
                    eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged;
                    //eyeXHost.CreateEyePositionDataStream
                    double smoothX = 0;
                    double smoothY = 0;
                    double box = 35;

                    // Write the data to the console.
                    fixationGazeDataStream.Next += (s, e) =>
                    {
                        if (e.X > smoothX + box || e.X < smoothX - box || e.Y > smoothY + box || e.Y < smoothY - box)
                        {
                            Cursor.Position = new Point(Convert.ToInt32(e.X), Convert.ToInt32(e.Y));
                            smoothX = e.X;
                            smoothY = e.Y;
                        }
                        else
                        {
                            Cursor.Position = new Point(Convert.ToInt32(smoothX), Convert.ToInt32(smoothY));
                        }
                    };
                    while (cantStopDontStop) { Thread.Sleep(1000); }
                }
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            using (var eyeXHost = new EyeXHost())
            {
                Run(eyeXHost);
            }

            Console.ResetColor();
            Console.WriteLine();
            Console.WriteLine("Press ANY key to quit");
            Console.ReadKey(true);
        }
示例#3
0
        public static void Main(string[] args)
        {
            switch (EyeXHost.EyeXAvailability)
            {
                case EyeXAvailability.NotAvailable:
                    Console.WriteLine("This sample requires the EyeX Engine, but it isn't available.");
                    Console.WriteLine("Please install the EyeX Engine and try again.");
                    return;

                case EyeXAvailability.NotRunning:
                    Console.WriteLine("This sample requires the EyeX Engine, but it isn't rnning.");
                    Console.WriteLine("Please make sure that the EyeX Engine is started.");
                    break;
            }

            using (var eyeXHost = new EyeXHost())
            {
                // Listen to state-changed events.
                eyeXHost.ScreenBoundsChanged += (s, e) => Console.WriteLine("Screen Bounds in pixels (state-changed event): {0}", e);
                eyeXHost.DisplaySizeChanged += (s, e) => Console.WriteLine("Display Size in millimeters (state-changed event): {0}", e);
                eyeXHost.EyeTrackingDeviceStatusChanged += (s, e) => Console.WriteLine("Eye tracking device status (state-changed event): {0}", e);
                eyeXHost.UserPresenceChanged += (s, e) => Console.WriteLine("User presence (state-changed event): {0}", e);
                eyeXHost.UserProfileNameChanged += (s, e) => Console.WriteLine("Active profile name (state-changed event): {0}", e);

                // This state-changed event required EyeX Engine 1.4.
                eyeXHost.UserProfilesChanged += (s, e) => Console.WriteLine("User profile names (state-changed event): {0}", e);
                eyeXHost.GazeTrackingChanged += (s, e) => Console.WriteLine("Gaze tracking (state-changed event): {0}", e);

                // Start the EyeX host.
                eyeXHost.Start();
                eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5));

                // First, let's display the current engine state. Because we're still in the
                // process of connecting to the engine, we might not get any valid state
                // information at this point.
                Console.WriteLine("Screen Bounds in pixels (initial value): {0}", eyeXHost.ScreenBounds);
                Console.WriteLine("Display Size in millimeters (initial value): {0}", eyeXHost.DisplaySize);
                Console.WriteLine("Eye tracking device status (initial value): {0}", eyeXHost.EyeTrackingDeviceStatus);
                Console.WriteLine("User presence (initial value): {0}", eyeXHost.UserPresence);
                Console.WriteLine("Active profile name (initial value): {0}", eyeXHost.UserProfileName);

                // This state requires EyeX Engine 1.4.
                Console.WriteLine("User profile names (initial value): {0}", eyeXHost.UserProfiles);
                Console.WriteLine("Gaze tracking (initial value): {0}", eyeXHost.GazeTracking);

                // Wait for the user to exit the application.
                Console.WriteLine("Listening for state changes, press any key to exit...");
                Console.ReadKey(true);
            }
        }
        public TobiiEyeXPointService()
        {
            EyeXHost = new EyeXHost();

            //Disconnect (deactivate) from the TET server on shutdown - otherwise the process can hang
            Application.Current.Exit += (sender, args) =>
            {
                if (EyeXHost != null)
                {
                    Log.Info("Disposing of the EyeXHost.");
                    EyeXHost.Dispose();
                }
            };
        }
        private void setup()
        {
            host_ = new EyeXHost();
            {
                stream_ = host_.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
                {
                    host_.Start();

                    stream_.Next += (s, e) => {
                        gazeX_ = e.X;
                        gazeY_ = e.Y;
                    };
                }
            }
        }
示例#6
0
        private void Eye()
        {
            using (var eyeXHost = new EyeXHost())
            {
                eyeXHost.Start();

                using (var stream = eyeXHost.CreateEyePositionDataStream())
                {
                    stream.Next += (s, e) =>
                    {
                        Console.SetCursorPosition(0, 0);

                        // Output information about the left eye.
                        Console.WriteLine("LEFT EYE");
                        Console.WriteLine("========");
                        Console.WriteLine("3D Position: ({0:0.0}, {1:0.0}, {2:0.0})                   ",
                            e.LeftEye.X, e.LeftEye.Y, e.LeftEye.Z);
                        Console.WriteLine("Normalized : ({0:0.0}, {1:0.0}, {2:0.0})                   ",
                            e.LeftEyeNormalized.X, e.LeftEyeNormalized.Y, e.LeftEyeNormalized.Z);

                        // Output information about the right eye.
                        Console.WriteLine();
                        Console.WriteLine("RIGHT EYE");
                        Console.WriteLine("=========");
                        Console.WriteLine("3D Position: {0:0.0}, {1:0.0}, {2:0.0}                   ",
                            e.RightEye.X, e.RightEye.Y, e.RightEye.Z);
                        Console.WriteLine("Normalized : {0:0.0}, {1:0.0}, {2:0.0}                   ",
                            e.RightEyeNormalized.X, e.RightEyeNormalized.Y, e.RightEyeNormalized.Z);
                    };

                    Console.SetCursorPosition(0, 12);
                    Console.WriteLine("");
                    Console.WriteLine("The 3D position consists of X,Y,Z coordinates expressed in millimeters");
                    Console.WriteLine("in relation to the center of the screen where the eye tracker is mounted.");
                    Console.WriteLine("\n");
                    Console.WriteLine("The normalized coordinates are expressed in relation to the track box,");
                    Console.WriteLine("i.e. the volume in which the eye tracker is theoretically able to track eyes.");
                    Console.WriteLine("- (0,0,0) represents the upper, right corner closest to the eye tracker.");
                    Console.WriteLine("- (1,1,1) represents the lower, left corner furthest away from the eye tracker.");
                    Console.WriteLine();
                    Console.WriteLine("---------------------------------------------------------");
                    Console.WriteLine("Listening for eye position data, press any key to exit...");

                    Console.In.Read();
                }
            }
        }
示例#7
0
        private static void Run(EyeXHost eyeXHost)
        {
            Console.CursorVisible = false;
            Console.WriteLine("AVAILABLE EYEX PROFILES");
            Console.WriteLine("=======================");
            Console.WriteLine();

            // Start the EyeX host.
            Version engineVersion;
            if (!StartHost(eyeXHost, out engineVersion))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Could not connect to EyeX Engine.");
                return;
            }

            // Too old EyeX Engine installed?
            if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("This sample requires EyeX Engine 1.4.");
                return;
            }

            // Create key bindings from the profiles.
            var keyBindings = CreateKeyBindings(eyeXHost.UserProfiles);
            foreach (var keyBinding in keyBindings)
            {
                Console.WriteLine("[{0}] {1}", keyBinding.Key, keyBinding.Value);
            }

            Console.WriteLine();
            Console.WriteLine("Select a profile to set it as the current one.");
            Console.WriteLine("Press ESC to abort.");

            // Read input from the user.
            var result = Console.ReadKey(true);
            if (result.Key != ConsoleKey.Escape)
            {
                if (keyBindings.ContainsKey(result.Key))
                {
                    // Change the profile.
                    var profile = keyBindings[result.Key];
                    eyeXHost.SetCurrentUserProfile(profile);
                }
            }
        }
示例#8
0
        public Gta5EyeTracking()
        {
            Util.Log("Begin Initialize");
            _shutDownRequestedEvent = new ManualResetEvent(false);
            _aspectRatio = 1;
            _host = new EyeXHost();
            _host.Start();
            _lightlyFilteredGazePointDataProvider = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

            _menuPool = new MenuPool();

            LoadSettings();
            _settingsMenu = new SettingsMenu(_menuPool, _settings);
            _deadzoneEditor = new DeadzoneEditor(_settings,_settingsMenu);

            _settingsMenu.ShutDownRequested += SettingsMenuOnShutDownRequested;

            _gazeVisualization = new GazeVisualization();
            _debugOutput = new DebugOutput();

            _aiming = new Aiming(_settings);

            _mouseEmulation = new MouseEmulation();
            _controllerEmulation = new ControllerEmulation();
            _controllerEmulation.OnModifyState += OnModifyControllerState;
            _freelook = new Freelook(_controllerEmulation, _mouseEmulation, _settings);
            _pedestrianInteraction = new PedestrianInteraction();
            _radialMenu = new RadialMenu(_controllerEmulation);

            _gazeStopwatch = new Stopwatch();
            _gazeStopwatch.Restart();

            _tickStopwatch = new Stopwatch();

            _foregroundWindowWatcher = new ForegroundWindowWatcher();
            _foregroundWindowWatcher.ForegroundWindowChanged += ForegroundWindowWatcherOnForegroundWindowChanged;
            _isWindowForeground = _foregroundWindowWatcher.IsWindowForeground();

            KeyDown += OnKeyDown;

            Tick += OnTick;
            Util.Log("End Initialize");
        }
        protected EventSingleton()
        {
            //Setting up and starting the timers
            updateTimer.Interval = UPDATEINTERVAL;
            updateTimer.Start();

            drawTimer.Interval = DRAWINTERVAL;
            drawTimer.Start();

            //keyboardHook = new Hook("Global Action Hook");
            //systemHook = new Hook();

            fixationEvent += EventSingleton_fixationEvent;

            //Instantiating and starting the eye tracker host
            eyex = new EyeXHost();
            eyex.CreateFixationDataStream(FixationDataMode.Sensitive).Next += (s, e) => fixationEvent(CreateFixation(e.EventType, (int)e.X, (int)e.Y));
            eyex.Start();
        }
        public MainEngine()
        {
            sharedData = SharedDataSingleton.Instance();
            _settingsList = SettingsSingleton.Instance();
            inputSimulator = sharedData.inputSimulator;

            controlState = new ControlContext();
            controlState.changedState += StateChanged;
            controlState.ControlState = new CommandState(inputSimulator, controlState);

            //System.Diagnostics.Process.Start("C:/Program Files (x86)/Nuance/NaturallySpeaking13/Program/natspeak.exe");

            SetupSpeechRecognition();

            //Instantiating and starting the eye tracker host
            eyex = new EyeXHost();
            eyex.CreateFixationDataStream(FixationDataMode.Sensitive).Next += (s, e) => Fixation(e.EventType, (int)e.X, (int)e.Y, e.Timestamp);
            eyex.Start();
        }
示例#11
0
        public static void Main(string[] args)
        {
            using (var eyeXHost = new EyeXHost())
            {
                // Create a data stream: lightly filtered gaze point data.
                // Other choices of data streams include EyePositionDataStream and FixationDataStream.
                using (var lightlyFilteredGazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered))
                {
                    // Start the EyeX host.
                    eyeXHost.Start();

                    // Write the data to the console.
                    lightlyFilteredGazeDataStream.Next += (s, e) => Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp);

                    // Let it run until a key is pressed.
                    Console.WriteLine("Listening for gaze data, press any key to exit...");
                    Console.In.Read();
                }
            }
        }
示例#12
0
        public static void Main(string[] args)
        {
            using (var eyeXHost = new EyeXHost())
            {
                eyeXHost.Start();

                Console.WriteLine("EYEX CONFIGURATION TOOLS");
                Console.WriteLine("========================");
                Console.WriteLine();
                Console.WriteLine("T) Test calibration");
                Console.WriteLine("G) Guest calibration");
                Console.WriteLine("R) Recalibrate");
                Console.WriteLine("D) Display Setup");
                Console.WriteLine("P) Create Profile");

                var key = Console.ReadKey(true).Key;
                switch (key)
                {
                    case ConsoleKey.T:
                        eyeXHost.LaunchCalibrationTesting();
                        break;
                    case ConsoleKey.G:
                        eyeXHost.LaunchGuestCalibration();
                        break;
                    case ConsoleKey.R:
                        eyeXHost.LaunchRecalibration();
                        break;
                    case ConsoleKey.D:
                        eyeXHost.LaunchDisplaySetup();
                        break;
                    case ConsoleKey.P:
                        eyeXHost.LaunchProfileCreation();
                        break;
                }
            }
        }
示例#13
0
        public void StartServer()
        {
            this.eyeXHost = new EyeXHost();
            this.eyeXHost.Start();
            this.gazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            this.gazeDataStream.Next += new System.EventHandler<EyeXFramework.GazePointEventArgs>(this.HandleEyeGazeEvent);

            this.fixationDataStream = eyeXHost.CreateFixationDataStream(FixationDataMode.Slow);
            this.fixationDataStream.Next += new System.EventHandler<EyeXFramework.FixationEventArgs>(this.HandleEyeFixationEvent);

            try
            {
                IPAddress ipAddr = IPAddress.Parse(host);
                tcpServer = new TcpClient();
                tcpServer.Connect(ipAddr, port);
                swSender = new StreamWriter(tcpServer.GetStream());
            }
            catch
            {
                this.StopServer();
            }
        }
示例#14
0
        public static void Main(string[] args)
        {
            tcpServer = new JsonTcpServer(6555);
            frameData = new FrameData();

            switch (EyeXHost.EyeXAvailability)
            {
                case EyeXAvailability.NotAvailable:
                    Console.WriteLine("This server requires the EyeX Engine, but it isn't available.");
                    Console.WriteLine("Please install the EyeX Engine and try again.");
                    return;

                case EyeXAvailability.NotRunning:
                    Console.WriteLine("This server requires the EyeX Engine, but it isn't running.");
                    Console.WriteLine("Please make sure that the EyeX Engine is started.");
                    break;
            }

            Thread clientUpdateThread = new Thread(new ThreadStart(StartUpdatingToClients));

            using (var eyeXHost = new EyeXHost())
            {
                
                eyeXHost.Start();
                Console.WriteLine("SERVER: eyeXHost started");

                // Create a data stream: lightly filtered gaze point data.
                // Other choices of data streams include EyePositionDataStream and FixationDataStream.

                eyeXHost.ScreenBoundsChanged += (s, e) =>
                {
                    Console.WriteLine("[EVENT] Screen Bounds in pixels (state-changed event): {0}", e);
                };

                eyeXHost.DisplaySizeChanged += (s, e) => {
                    Console.WriteLine("[EVENT] Display Size in millimeters (state-changed event): {0}", e);
                };

                eyeXHost.EyeTrackingDeviceStatusChanged += (s, e) => {
                    Console.WriteLine("[EVENT] Eye tracking device status (state-changed event): {0}", e);
                    EyeXAPIEvent message = new EyeXAPIEvent();
                    message.eventType = "device_state_changed";
                    tcpServer.sendToAllClients(message.toJson());
                    Thread.Sleep(60);
                };

                eyeXHost.UserPresenceChanged += (s, e) => {
                    Console.WriteLine("[EVENT] User presence (state-changed event): {0}", e);
                    //TODO save it to send in frame
                };

                eyeXHost.UserProfileNameChanged += (s, e) =>
                {
                    Console.WriteLine("[EVENT] Active profile name (state-changed event): {0}", e);
                };
                
                // This state-changed event required EyeX Engine 1.4.
                eyeXHost.UserProfilesChanged += (s, e) =>
                {
                    Console.WriteLine("[EVENT] User profile names (state-changed event): {0}", e);
                };

                eyeXHost.GazeTrackingChanged += (s, e) =>
                {
                    Console.WriteLine("[EVENT] Gaze tracking (state-changed event): {0}", e);
                    //TODO save it to send in frame
                };

                using (var gazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered))
                {

                    Console.WriteLine("[EYEX]: GazeDataStream started");
                    using (var eyePositionStream = eyeXHost.CreateEyePositionDataStream())
                    {

                        Console.WriteLine("[EYEX]: EyePositionStream started");

                        // Write the data to the console.
                        gazeDataStream.Next += (s, e) => {

                            //Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp);

                            frameData.Gaze = e;
                            frameData.userPresence = eyeXHost.UserPresence;

                        };
                    
                        eyePositionStream.Next += (s, e) =>
                        {
                            //Console.WriteLine("3D Position: ({0:0.0}, {1:0.0}, {2:0.0})                   ",
                            //   e.LeftEye.X, e.LeftEye.Y, e.LeftEye.Z);

                            frameData.updateEyePosition(e);
                            frameData.userPresence = eyeXHost.UserPresence;
                            
                        };

                        tcpServer.ClientMessageReceieved += (TcpClient client,JObject json) =>
                        {
                            if (json["type"].ToString() == "request")
                            {
                                int requestId = (int)json["requestId"];
                                if (json["resource"].ToString() == "calibration" && json["path"].ToString() == "start")
                                {
                                    Console.WriteLine("[Client] Calibration requested");
                                    EyeXAPIResponse response = new EyeXAPIResponse();
                                    response.statusCode = 200;
                                    response.requestId = requestId;
                                    tcpServer.sendToClient(client, response.toJson());
                                    eyeXHost.LaunchGuestCalibration();

                                }

                                if (json["resource"].ToString() == "tracker")
                                {

                                    if (json["path"].ToString() == "get.basic_info")
                                    {

                                        EyeXAPIResponse response = new EyeXAPIResponse();
                                        response.statusCode = 200;
                                        response.requestId = requestId;
                                        Dictionary<string, object> result = new Dictionary<string, object>();
                                        result.Add("screen_bounds", eyeXHost.ScreenBounds.Value);
                                        result.Add("display_size", eyeXHost.DisplaySize.Value);
                                        response.results = result;
                                        tcpServer.sendToClient(client, response.toJson());

                                    }
                                    else
                                    {
                                        //TODO return api error: unknown method
                                    }
                                }
                            }
                            else if (json["type"].ToString() == "event")
                            {
                                // Client side events is not supported yet
                            }
                        };

                        clientUpdateThread.Start();

                        Console.WriteLine("Listening for gaze data, press any key to exit...");
                        Console.In.Read();

                    } // using EyePositionDataStream
                } // using GazeDataStream
                
                
            } // using eyeXHost
   
        }
示例#15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            bm = new Bitmap((int)(PCM * FW), (int)(PCM * FH), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            gr = Graphics.FromImage(bm);
            p = new Pen(Color.Black);           // задали цвет для карандаша
            fon = new SolidBrush(Color.White); // и для заливки
            fig = new SolidBrush(Color.Black);
            gr.FillRectangle(fon, 0, 0, (int)(PCM * FW), (int)(PCM * FH));
            cP = pointCM(0, 0);
            drawDot(cP.X, cP.Y);

            eyeX = new EyeXHost();
            eyeX.Start();

            gazeData = new List<Point>();
            /*
            gazeData.Add(new Point(50, 50));
            gazeData.Add(new Point(500, 150));
            for (var i = 1; i < gazeData.Count; i++)
            {
                gr.DrawLine(p, gazeData[i - 1].X, gazeData[i - 1].Y, gazeData[i].X, gazeData[i].Y);
            }
            gazeData.Clear();
            */

            Invalidate();
        }
示例#16
0
 private void Eyetracking()
 {
     Console.WriteLine("eyetracking");
     using (var eyeXHost = new EyeXHost())
     {
         eyeXHost.Start();
         using (var lightlyFilteredGazeDataStream = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered))
         {
             lightlyFilteredGazeDataStream.Next += (s, e) =>
             {
                 Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp);
                 eyex = e.X;
                 eyey = e.Y;
             };
             Console.In.Read();
         }
     }
 }
        private void StartEyeStream()
        {
            _eyeXHost = new EyeXHost();
            _lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _eyeXHost.Start();

                    // Write the data to the console.
            _lightlyFilteredGazeDataStream.Next += gazeDataStreamNext;
            Console.WriteLine("Eyex setup");
        }
示例#18
0
        /// <summary>
        /// Starts the EyeX host and waits for all profiles to become available.
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="version">The engine version.</param>
        private static bool StartHost(EyeXHost host, out Version version)
        {
            // Start the host.
            host.Start();

            // Wait for the client to connect.
            if (!host.WaitUntilConnected(TimeSpan.FromSeconds(5)))
            {
                version = null;
                return false;
            }

            // Get the engine version number.
            version = host.GetEngineVersion().Result;
            return true;
        }
示例#19
-1
        public Gta5EyeTracking()
        {
            _aspectRatio = 1;
            _host = new EyeXHost();
            _host.Start();
            _lightlyFilteredGazePointDataProvider = _host.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            _lightlyFilteredGazePointDataProvider.Next += NewGazePoint;

            _menuPool = new MenuPool();

            LoadSettings();
            _settingsMenu = new SettingsMenu(_menuPool, _settings);
            _settingsMenu.DeadzoneMenu.OnItemSelect += (m, item, indx) =>
            {
                if (indx == 0)
                {
                    _isDrawingDeadzone = true;
                }
                else
                {
                    _settings.Deadzones.RemoveAt(indx - 1);
                    _settingsMenu.DeadzoneMenu.RemoveItemAt(indx);
                    _settingsMenu.DeadzoneMenu.RefreshIndex();
                }
            };

            _gazeVisualization = new GazeVisualization();
            _debugOutput = new DebugOutput();

            _aiming = new Aiming(_settings);

            _mouseEmulation = new MouseEmulation();
            _controllerEmulation = new ControllerEmulation();
            _controllerEmulation.OnModifyState += OnModifyControllerState;
            _freelook = new Freelook(_controllerEmulation, _mouseEmulation, _settings);
            _pedestrianInteraction = new PedestrianInteraction();
            _radialMenu = new RadialMenu(_controllerEmulation);

            _gazeStopwatch = new Stopwatch();
            _gazeStopwatch.Restart();

            _tickStopwatch = new Stopwatch();

            _foregroundWindowWatcher = new ForegroundWindowWatcher();
            _foregroundWindowWatcher.ForegroundWindowChanged += ForegroundWindowWatcherOnForegroundWindowChanged;
            _isWindowForeground = _foregroundWindowWatcher.IsWindowForeground();

            View.MenuTransitions = true;

            KeyDown += OnKeyDown;

            Tick += OnTick;
        }