Esempio n. 1
0
        //----------------------------------------------------------------------
        // Apply the specified ScreenMode
        private static void ApplyScreenMode(GraphicsDeviceManager _graphics, ScreenMode _mode, bool _bFullscreen)
        {
            Mode = _mode;
            _graphics.PreferredBackBufferWidth  = Mode.Width;
            _graphics.PreferredBackBufferHeight = Mode.Height;
            _graphics.PreferMultiSampling       = true;
            _graphics.IsFullScreen = _bFullscreen;
            _graphics.ApplyChanges();

            ScaleFactor = (float)(Mode.Width * 9 / 16) / (float)InternalMode.Height;
            Scale       = Matrix.CreateScale(ScaleFactor);

            DefaultViewport = _graphics.GraphicsDevice.Viewport;

            mViewport        = new Viewport();
            mViewport.X      = 0;
            mViewport.Y      = (Mode.Height - (Mode.Width * 9 / 16)) / 2;
            mViewport.Width  = Mode.Width;
            mViewport.Height = Mode.Width * 9 / 16;
            _graphics.GraphicsDevice.Viewport = mViewport;
        }
Esempio n. 2
0
        static Resolution()
        {
            ScaleFactor  = 1f;
            InternalMode = new ScreenMode(1920, 1080);

            SortedScreenModes = new List <ScreenMode>();

            foreach (DisplayMode displayMode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if (displayMode.AspectRatio > 1f && displayMode.Width >= 800f && displayMode.Width <= InternalMode.Width && displayMode.Height <= InternalMode.Height)
                {
                    ScreenMode screenMode = new ScreenMode(displayMode.Width, displayMode.Height);
                    if (!SortedScreenModes.Contains(screenMode))
                    {
                        SortedScreenModes.Add(screenMode);
                    }
                }
            }

            SortedScreenModes.Sort();
        }
Esempio n. 3
0
 //----------------------------------------------------------------------
 // Initialize the Resolution using the specified ScreenMode
 public static bool Initialize(GraphicsDeviceManager _graphics, ScreenMode _mode, bool _bFullscreen)
 {
     InternalMode = new ScreenMode(1920, 1080);
     return(SetScreenMode(_graphics, _mode, _bFullscreen));
 }