示例#1
0
        protected void SetWindowRectangle(WindowVerticalAlignment alignment, int x, int width, int height)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point     windowCenterPoint          = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
            case WindowVerticalAlignment.Top:
                windowRectangle = new Rectangle(x, 0, width, height);
                break;

            case WindowVerticalAlignment.Center:
                windowRectangle = new Rectangle(x, windowCenterPoint.Y - (height / 2), width, height);
                break;

            case WindowVerticalAlignment.Bottom:
                windowRectangle = new Rectangle(x, windowDestinationRectangle.Bottom - height, width, height);
                break;

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

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

            switch (alignment)
            {
            case WindowVerticalAlignment.Top:
                windowRectangle = new Rectangle(windowX, 0, windowWidth, windowHeight);
                break;

            case WindowVerticalAlignment.Center:
                windowRectangle = new Rectangle(windowX, windowCenterPoint.Y - (windowHeight / 2), windowWidth, windowHeight);
                break;

            case WindowVerticalAlignment.Bottom:
                windowRectangle = new Rectangle(windowX, windowDestinationRectangle.Bottom - windowHeight, windowWidth, windowHeight);
                break;

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

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

            switch (alignment)
            {
                case WindowVerticalAlignment.Top:
                    windowRectangle = new Rectangle(windowX, 0, windowWidth, windowHeight);
                    break;
                case WindowVerticalAlignment.Center:
                    windowRectangle = new Rectangle(windowX, windowCenterPoint.Y - (windowHeight / 2), windowWidth, windowHeight);
                    break;
                case WindowVerticalAlignment.Bottom:
                    windowRectangle = new Rectangle(windowX, windowDestinationRectangle.Bottom - windowHeight, windowWidth, windowHeight);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new BorderedWindow(windowRectangle, padding);
        }
 protected void SetWindowRectangleUsingWindowXAndClientSize(WindowVerticalAlignment alignment, int windowX, int clientWidth, int clientHeight, Padding padding)
 {
     SetWindowRectangleUsingWindowXAndWindowSize(alignment, windowX, clientWidth + padding.X, clientHeight + padding.Y, padding);
 }
        protected void SetWindowRectangle(WindowVerticalAlignment alignment, int x, int width, int height)
        {
            Rectangle windowDestinationRectangle = Constants.GameWindow.DestinationRectangle;
            Point windowCenterPoint = windowDestinationRectangle.Center;
            Rectangle windowRectangle;

            switch (alignment)
            {
                case WindowVerticalAlignment.Top:
                    windowRectangle = new Rectangle(x, 0, width, height);
                    break;
                case WindowVerticalAlignment.Center:
                    windowRectangle = new Rectangle(x, windowCenterPoint.Y - (height / 2), width, height);
                    break;
                case WindowVerticalAlignment.Bottom:
                    windowRectangle = new Rectangle(x, windowDestinationRectangle.Bottom - height, width, height);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("alignment");
            }

            Window = new Window(windowRectangle);
        }
 protected void SetWindowRectangleUsingWindowXAndClientSize(WindowVerticalAlignment alignment, int windowX, int clientWidth, int clientHeight, Padding padding)
 {
     SetWindowRectangleUsingWindowXAndWindowSize(alignment, windowX, clientWidth + padding.X, clientHeight + padding.Y, padding);
 }