Пример #1
0
        private void HandleGameResolutionChange(GameResolutions oldResolution, GameResolutions newResolution)
        {
            if ((newResolution == GameResolutions.R800x600) ||
                (newResolution == GameResolutions.R1024x768))
            {
                if (Factory.GUIController.ShowQuestion("Are you sure you need to use this resolution? High resolutions like 800x600 and 1024x768 increase the file size of your game and increase the system requirements needed to play it. Are your graphics really detailed enough to need this?") == DialogResult.No)
                {
                    Factory.AGSEditor.CurrentGame.Settings.Resolution = oldResolution;
                    return;
                }
            }

            string oldResolutionText = GetEnumValueDescription <GameResolutions>(oldResolution);
            string newResolutionText = GetEnumValueDescription <GameResolutions>(newResolution);

            if (Factory.GUIController.ShowQuestion(string.Format("You've changed your game resolution from {0} to {1}.{2}You will need to import a new background of the correct size for all your rooms.{2}{2}Would you like AGS to automatically resize all your GUIs to the new resolution?", oldResolutionText, newResolutionText, Environment.NewLine)) == DialogResult.Yes)
            {
                ResizeAllGUIs(oldResolution, newResolution);
            }

            if ((newResolution == GameResolutions.R320x240) ||
                (newResolution == GameResolutions.R640x480))
            {
                Factory.AGSEditor.CurrentGame.Settings.LetterboxMode = true;
            }
            else
            {
                Factory.AGSEditor.CurrentGame.Settings.LetterboxMode = false;
            }
            Factory.Events.OnGameSettingsChanged();
        }
Пример #2
0
        private void ResizeAllGUIs(GameResolutions oldResolution, GameResolutions newResolution)
        {
            int oldWidth  = AGS.Types.Utilities.GetGameResolutionWidth(oldResolution);
            int oldHeight = AGS.Types.Utilities.GetGameResolutionHeight(oldResolution);
            int newWidth  = AGS.Types.Utilities.GetGameResolutionWidth(newResolution);
            int newHeight = AGS.Types.Utilities.GetGameResolutionHeight(newResolution);

            foreach (GUI gui in Factory.AGSEditor.CurrentGame.RootGUIFolder.AllItemsFlat)
            {
                NormalGUI theGui = gui as NormalGUI;
                if (theGui != null)
                {
                    theGui.Width  = Math.Max((theGui.Width * newWidth) / oldWidth, 1);
                    theGui.Height = Math.Max((theGui.Height * newHeight) / oldHeight, 1);
                    theGui.Left   = (theGui.Left * newWidth) / oldWidth;
                    theGui.Top    = (theGui.Top * newHeight) / oldHeight;

                    foreach (GUIControl control in theGui.Controls)
                    {
                        control.Width  = Math.Max((control.Width * newWidth) / oldWidth, 1);
                        control.Height = Math.Max((control.Height * newHeight) / oldHeight, 1);
                        control.Left   = (control.Left * newWidth) / oldWidth;
                        control.Top    = (control.Top * newHeight) / oldHeight;
                    }
                }
            }
        }
Пример #3
0
 public static int GetGameResolutionWidth(GameResolutions resolution)
 {
     switch (resolution)
     {
         case GameResolutions.R320x200:
         case GameResolutions.R320x240:
             return 320;
         case GameResolutions.R640x400:
         case GameResolutions.R640x480:
             return 640;
         case GameResolutions.R800x600:
             return 800;
         case GameResolutions.R1024x768:
             return 1024;
     }
     throw new InvalidDataException("Invalid game resolution: " + resolution.ToString());
 }
Пример #4
0
        public static int GetGameResolutionWidth(GameResolutions resolution)
        {
            switch (resolution)
            {
            case GameResolutions.R320x200:
            case GameResolutions.R320x240:
                return(320);

            case GameResolutions.R640x400:
            case GameResolutions.R640x480:
                return(640);

            case GameResolutions.R800x600:
                return(800);

            case GameResolutions.R1024x768:
                return(1024);
            }
            throw new InvalidDataException("Invalid game resolution: " + resolution.ToString());
        }