protected override SimpleInputSnapshot GetAvailableSnapshot()
        {
            _snapshotBackBuffer.Clear();
            SimpleInputSnapshot snapshot = Interlocked.Exchange(ref CurrentSnapshot, _snapshotBackBuffer);

            _snapshotBackBuffer = snapshot;
            return(snapshot);
        }
Exemple #2
0
        private SimpleInputSnapshot GetAvailableSnapshot()
        {
            _snapshotBackBuffer.Clear();
            SimpleInputSnapshot snapshot = Interlocked.Exchange(ref CurrentSnapshot, _snapshotBackBuffer);

            snapshot.MousePosition = _currentPointerPosition.ToVector2();
            _snapshotBackBuffer    = snapshot;
            return(snapshot);
        }
Exemple #3
0
        /// <summary>Gets an InputSnapshot containing input information gatheres since the
        /// last time GetInputSnapshot was called.</summary>
        public InputSnapshot GetInputSnapshot()
        {
            SimpleInputSnapshot snapshot = GetAvailableSnapshot();

            if (NativeWindow.Exists)
            {
                MouseState cursorState = Mouse.GetCursorState();
                if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Point windowPoint = NativeWindow.PointToClient(new Point(cursorState.X, cursorState.Y));
                    snapshot.MousePosition = new System.Numerics.Vector2(
                        windowPoint.X,
                        windowPoint.Y) / ScaleFactor;
                }
                else
                {
                    snapshot.MousePosition = new System.Numerics.Vector2(
                        cursorState.X,
                        cursorState.Y) / ScaleFactor;
                }
            }
            _mouseDown.CopyTo(snapshot.MouseDown, 0);
            return(snapshot);
        }
Exemple #4
0
        public InputSnapshot GetInputSnapshot()
        {
            SimpleInputSnapshot snapshot = GetAvailableSnapshot();

            return(snapshot);
        }