Esempio n. 1
0
        protected void SetWindowRectangle(WindowHorizontalAlignment alignment, int y, int width, int height)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point     windowCenterPoint          = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
            case WindowHorizontalAlignment.Left:
                windowRectangle = new Rectangle(0, y, width, height);
                break;

            case WindowHorizontalAlignment.Center:
                windowRectangle = new Rectangle(windowCenterPoint.X - (width / 2), y, width, height);
                break;

            case WindowHorizontalAlignment.Right:
                windowRectangle = new Rectangle(windowDestinationRectangle.Right - width, y, width, height);
                break;

            default:
                throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new Window(windowRectangle);
        }
        protected void SetWindowRectangleUsingWindowYAndWindowSize(WindowHorizontalAlignment alignment, int windowY, int windowWidth, int windowHeight, Padding padding)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point     windowCenterPoint          = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
            case WindowHorizontalAlignment.Left:
                windowRectangle = new Rectangle(0, windowY, windowWidth, windowHeight);
                break;

            case WindowHorizontalAlignment.Center:
                windowRectangle = new Rectangle(windowCenterPoint.X - (windowWidth / 2), windowY, windowWidth, windowHeight);
                break;

            case WindowHorizontalAlignment.Right:
                windowRectangle = new Rectangle(windowDestinationRectangle.Right - windowWidth, windowY, windowWidth, windowHeight);
                break;

            default:
                throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new BorderedWindow(windowRectangle, padding);
        }
        protected void SetWindowRectangleUsingWindowYAndWindowSize(WindowHorizontalAlignment alignment, int windowY, int windowWidth, int windowHeight, Padding padding)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point windowCenterPoint = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
                case WindowHorizontalAlignment.Left:
                    windowRectangle = new Rectangle(0, windowY, windowWidth, windowHeight);
                    break;
                case WindowHorizontalAlignment.Center:
                    windowRectangle = new Rectangle(windowCenterPoint.X - (windowWidth / 2), windowY, windowWidth, windowHeight);
                    break;
                case WindowHorizontalAlignment.Right:
                    windowRectangle = new Rectangle(windowDestinationRectangle.Right - windowWidth, windowY, windowWidth, windowHeight);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new BorderedWindow(windowRectangle, padding);
        }
 protected void SetWindowRectangleUsingWindowYAndClientSize(WindowHorizontalAlignment alignment, int windowY, int clientWidth, int clientHeight, Padding padding)
 {
     SetWindowRectangleUsingWindowYAndWindowSize(alignment, windowY, clientWidth + padding.X, clientHeight + padding.Y, padding);
 }
        protected void SetWindowRectangle(WindowHorizontalAlignment alignment, int y, int width, int height)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point windowCenterPoint = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
                case WindowHorizontalAlignment.Left:
                    windowRectangle = new Rectangle(0, y, width, height);
                    break;
                case WindowHorizontalAlignment.Center:
                    windowRectangle = new Rectangle(windowCenterPoint.X - (width / 2), y, width, height);
                    break;
                case WindowHorizontalAlignment.Right:
                    windowRectangle = new Rectangle(windowDestinationRectangle.Right - width, y, width, height);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new Window(windowRectangle);
        }
 protected void SetWindowRectangleUsingWindowYAndClientSize(WindowHorizontalAlignment alignment, int windowY, int clientWidth, int clientHeight, Padding padding)
 {
     SetWindowRectangleUsingWindowYAndWindowSize(alignment, windowY, clientWidth + padding.X, clientHeight + padding.Y, padding);
 }