Ejemplo n.º 1
0
        /// <summary>
        /// Executed when the user resizes the window (in the case of a window style hack).
        /// </summary>
        private static void WindowEventDelegateImpl(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
        {
            // Filter out non-HWND changes, e.g. items within a listbox.
            // Technically speaking shouldn't be necessary, though just in case.
            if (idObject != 0 || idChild != 0)
            {
                return;
            }

            // Set the size and location of the external overlay to match the game/target window.
            // Only if an object has changed location, shape, or size.
            if (eventType == 0x800B)
            {
                var resolution   = WindowProperties.GetClientAreaSize(GameProcess.Process.MainWindowHandle);
                *   _resolutionX = resolution.RightBorder;
                *   _resolutionY = resolution.BottomBorder;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the current aspect ratio obtained by calculating the width and height of the window.
        /// </summary>
        /// <returns>The aspect ratio of the current window.</returns>
        private static float GetCurrentAspectRatio()
        {
            var resolution = WindowProperties.GetClientAreaSize(GameProcess.Process.MainWindowHandle);

            return(resolution.RightBorder / (float)resolution.BottomBorder);
        }