Exemple #1
0
        public void AddViewRect(ViewRect viewRect)
        {
            ViewRect v = GetViewRect();

            v.Add(viewRect);
            SetViewRect(v);
        }
Exemple #2
0
        static ViewRect()
        {
            ViewRect empty = new ViewRect();

            empty.IsEmpty = true;
            Empty         = empty;
        }
Exemple #3
0
        public void Add(ViewRect v)
        {
            int smallestRight  = v.Width + v.X < Width + X ? v.Width + v.X : Width + X;
            int smallestBottom = v.Height + v.Y < Height + Y ? v.Height + v.Y : Height + Y;

            X      = v.X > X ? v.X : X;
            Y      = v.Y > Y ? v.Y : Y;
            Width  = smallestRight - X;
            Height = smallestBottom - Y;
        }
Exemple #4
0
        public void SetViewRect(ViewRect viewRect)
        {
            Viewport vp = GraphicsDevice.Viewport;

            vp.X      = viewRect.X;
            vp.Y      = viewRect.Y;
            vp.Width  = viewRect.Width;
            vp.Height = viewRect.Height;

            if (vp.X < 0)
            {
                vp.X = 0;
            }
            if (vp.Y < 0)
            {
                vp.Y = 0;
            }

            if (vp.X >= graphicsManager.ScreenWidth)
            {
                vp.X     = graphicsManager.ScreenWidth - 2;
                vp.Width = 1;
            }
            if (vp.Y >= graphicsManager.ScreenHeight)
            {
                vp.Y      = graphicsManager.ScreenHeight - 2;
                vp.Height = 1;
            }

            if (vp.X + vp.Width >= graphicsManager.ScreenWidth)
            {
                vp.Width = graphicsManager.ScreenWidth - vp.X - 1;
            }
            if (vp.Y + vp.Height >= graphicsManager.ScreenHeight)
            {
                vp.Height = graphicsManager.ScreenHeight - vp.Y - 1;
            }

            if (vp.Width < 1)
            {
                vp.Width          = 1;
                ViewportIsInvalid = true;
            }
            if (vp.Height < 1)
            {
                vp.Height         = 1;
                ViewportIsInvalid = true;
            }

            GraphicsDevice.Viewport = vp;
        }
Exemple #5
0
        public ViewRect AddGet(ViewRect v)
        {
            v.Add(this);

            return(v);
        }