Пример #1
0
 public static bool IsValidPlayWindowResolution(ResolutionProperty resolution)
 {
     foreach (ResolutionProperty res in PlayWindowResolutionsList)
         if (resolution.Width == res.Width && resolution.Height == res.Height)
             return true;
     return false;
 }
Пример #2
0
        public static void SetWindowSize(GameWindow window)
        {
            Rectangle game;
            System.Drawing.Rectangle screen;

            if (window != null)
            {
                game = window.ClientBounds;
                screen = Screen.GetWorkingArea(new System.Drawing.Rectangle(game.X, game.Y, game.Width, game.Height));
            }
            else
            {
                screen = Screen.GetWorkingArea(new System.Drawing.Point(0, 0));
            }

            foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            {
                if (mode.Format != SurfaceFormat.Color)
                    continue;
                ResolutionProperty res = new ResolutionProperty(mode.Width, mode.Height);
                if (!FullScreenResolutionsList.Contains(res))
                {
                    FullScreenResolutionsList.Add(res);
                }
            }

            foreach (ResolutionProperty res in FullScreenResolutionsList)
            {
                if (!PlayWindowResolutionsList.Contains(res) && res.Width <= screen.Width && res.Height <= screen.Height)
                {
                    PlayWindowResolutionsList.Add(res);
                }
            }
        }
Пример #3
0
 public UserInterfaceSettings()
 {
     FullScreenResolution = new ResolutionProperty();
     WindowResolution = new ResolutionProperty();
     PlayWindowGumpResolution = new ResolutionProperty();
     m_PlayWindowPixelDoubling = false;
     IsMaximized = false;
     Mouse = new MouseProperty();
     AlwaysRun = false;
     MenuBarDisabled = false;
 }
Пример #4
0
 public void SaveResolution()
 {
     if (IsMaximized)
     {
         Settings.UserInterface.IsMaximized = true;
     }
     else
     {
         ResolutionProperty res = new ResolutionProperty(DeviceManager.PreferredBackBufferWidth, DeviceManager.PreferredBackBufferHeight);
         Settings.UserInterface.WindowResolution = res;
     }
 }
Пример #5
0
 protected void CheckWindowSize(int minWidth, int minHeight)
 {
     GameWindow window = Window; // (sender as GameWindow);
     ResolutionProperty resolution = new ResolutionProperty(window.ClientBounds.Width, window.ClientBounds.Height);
     // this only occurs when the world is active. Make sure that we don't reduce the window size
     // smaller than the world gump size.
     if (resolution.Width < minWidth)
         resolution.Width = minWidth;
     if (resolution.Height < minHeight)
         resolution.Height = minHeight;
     if (resolution.Width != window.ClientBounds.Width || resolution.Height != window.ClientBounds.Height)
         SetGraphicsDeviceWidthHeight(resolution);
 }
Пример #6
0
 protected void SetGraphicsDeviceWidthHeight(ResolutionProperty resolution)
 {
     DeviceManager.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
     DeviceManager.PreferredBackBufferWidth = resolution.Width;
     DeviceManager.PreferredBackBufferHeight = resolution.Height;
     DeviceManager.SynchronizeWithVerticalRetrace = Settings.Engine.IsVSyncEnabled;
     DeviceManager.ApplyChanges();
 }
Пример #7
0
 private void SetGraphicsDeviceWidthHeight(ResolutionProperty resolution)
 {
     GraphicsDeviceManager.PreferredBackBufferWidth = resolution.Width;
     GraphicsDeviceManager.PreferredBackBufferHeight = resolution.Height;
     GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Settings.Engine.IsVSyncEnabled;
     GraphicsDeviceManager.ApplyChanges();
 }