Beispiel #1
0
        /// <summary>
        /// takes a process object and returns its the game screens x, y, width and height
        /// </summary>
        /// <param name="proc"></param>
        /// <returns></returns>
        public static Rectangle GetRect(Process proc)
        {
            var rect = new User32.Rect();//Rekt type object for parameter of WINAPI

            User32.GetWindowRect(proc.MainWindowHandle, ref rect);

            int width  = rect.right - rect.left;
            int height = rect.bottom - rect.top;

            Rectangle rectangle = new Rectangle(rect.left, rect.top, width, height);

            if (rectangle.Width != (1280 + rightBorder + leftBorder) | rectangle.Height != (720 + topBoarder + bottomBorder))
            {
                MainWindow.main.UpdateLog = proc.MainWindowTitle + " needs reset to 1280x720 or Nox player left and top borders have changed. " +
                                            "Window should be detected as " + (1280 + borderWidth) + "x" + (720 + borderHeight) +
                                            "your screen is " + rectangle.Width + "x" + rectangle.Height;
            }
            return(rectangle);
        }
Beispiel #2
0
        //Logic
        /// <summary>
        /// takes a process object and returns its the game screens x, y, width and height
        /// </summary>
        /// <param name="App"></param>
        /// <returns></returns>
        public Rectangle GetRect(Process App)
        {
            if (Emu == Emulator.None)
            {
                BuildBorders();
            }

            var RECT = new User32.Rect();

            User32.GetWindowRect(App.MainWindowHandle, ref RECT);

            int width = RECT.Right - RECT.Left;

            int height = RECT.Bottom - RECT.Top;

            Rectangle Screen = new Rectangle(RECT.Left, RECT.Top, width, height);

            CheckScreenSize(App);

            return(Screen);
        }
Beispiel #3
0
        private void CheckScreenSize(Process App)
        {
            var RECT = new User32.Rect();

            User32.GetWindowRect(App.MainWindowHandle, ref RECT);

            int width = RECT.Right - RECT.Left;

            int height = RECT.Bottom - RECT.Top;

            Rectangle Screen = new Rectangle(RECT.Left, RECT.Top, width, height);

            if (TopBorder + BottomBorder + LeftBorder + RightBorder != 0)//checks to see if boarders have been assigned values before spamming error.
            {
                if (Screen.Width != (1280 + RightBorder + LeftBorder) | Screen.Height != (720 + TopBorder + BottomBorder))
                {
                    MainWindow.main.UpdateLog = App.MainWindowTitle + " Incorrect game screen size detected. The visible game screen needs to be 1280x720, excluding any borders. Window detected at:" +
                                                width + "x" + height + ". It needs to be " + (1280 + RightBorder + LeftBorder) + "x" + (720 + TopBorder + BottomBorder) +
                                                ".";
                }
            }
        }