Пример #1
0
        /// <summary>
        /// adds a camera and viewport.
        /// </summary>
        /// <param name="camera"></param>
        /// <param name="viewportRectangle"></param>
        public void Add(CameraBase camera, Rectangle? viewportRectangle)
        {
            this.camera.Add(camera);

            Viewport newViewport = FrameworkCore.Game.GraphicsDevice.Viewport;
            if (viewportRectangle == null)
            {
                newViewport.X = 0;
                newViewport.Y = 0;
                newViewport.Width = FrameworkCore.Game.GraphicsDevice.Viewport.Width;
                newViewport.Height = FrameworkCore.Game.GraphicsDevice.Viewport.Height;
            }
            else
            {
                newViewport.X = viewportRectangle.Value.X;
                newViewport.Y = viewportRectangle.Value.Y;
                newViewport.Width = viewportRectangle.Value.Width;
                newViewport.Height = viewportRectangle.Value.Height;
            }

            this.viewport.Add(newViewport);

            count++;
        }
Пример #2
0
 public ViewCamera(CameraBase camera, Rectangle? viewportRectangle)
 {
     Add(camera, viewportRectangle);
 }