Example #1
0
        /// <summary>
        /// Gets the Game View window's top left Position.
        /// </summary>
        /// <remarks>Overridden in test project. Do not remove without updating tests.</remarks>
        protected virtual Vector2 GetWindowPosition()
        {
            var windowPosition = new Win32Helpers.POINT();

            Win32Helpers.ClientToScreen(_hwnd, ref windowPosition);
            return(new Vector2(windowPosition.x, windowPosition.y));
        }
Example #2
0
        /// <summary>
        /// Gets the Game View window's bottom right corner Position.
        /// </summary>
        /// <remarks>Overridden in test project. Do not remove without updating tests.</remarks>
        protected virtual Vector2 GetWindowBottomRight()
        {
            var clientRect = new Win32Helpers.RECT();

            Win32Helpers.GetClientRect(_hwnd, ref clientRect);

            var bottomRight = new Win32Helpers.POINT {
                x = clientRect.right, y = clientRect.bottom
            };

            Win32Helpers.ClientToScreen(_hwnd, ref bottomRight);

            return(new Vector2(bottomRight.x, bottomRight.y));
        }
Example #3
0
        /// <summary>
        /// Maps from logical pixels to physical desktop pixels.
        /// </summary>
        /// <param name="rect">Rectangle to be transformed.</param>
        /// <returns>Transformed rectangle.</returns>
        protected virtual Rect LogicalToPhysical(Rect rect)
        {
            var topLeft = new Win32Helpers.POINT {
                x = (int)rect.x, y = (int)rect.y
            };

            Win32Helpers.LogicalToPhysicalPoint(_hwnd, ref topLeft);

            var bottomRight = new Win32Helpers.POINT {
                x = (int)(rect.x + rect.width), y = (int)(rect.y + rect.height)
            };

            Win32Helpers.LogicalToPhysicalPoint(_hwnd, ref bottomRight);

            return(new Rect(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y));
        }