Example #1
0
        public object Clone()
        {
            var newSettings = new OptionsSettings();

            newSettings.horzRez     = this.horzRez;
            newSettings.vertRez     = this.vertRez;
            newSettings.textSpeed   = this.textSpeed;
            newSettings.musVolume   = this.musVolume;
            newSettings.soundVolume = this.soundVolume;
            newSettings.fullScreen  = this.fullScreen;

            newSettings.mapKey       = this.mapKey;
            newSettings.statusKey    = this.statusKey;
            newSettings.inventoryKey = this.inventoryKey;
            newSettings.spellKey     = this.spellKey;
            newSettings.upKey        = this.upKey;
            newSettings.downKey      = this.downKey;
            newSettings.leftKey      = this.leftKey;
            newSettings.rightKey     = this.rightKey;
            newSettings.pauseKey     = this.pauseKey;
            newSettings.sneakKey     = this.sneakKey;
            newSettings.interactKey  = this.interactKey;
            newSettings.runKey       = this.runKey;

            newSettings.mutedMusic = this.mutedMusic;
            newSettings.mutedSound = this.mutedSound;

            newSettings.combatSpeed = this.combatSpeed;

            return(newSettings);
        }
Example #2
0
        public OptionsMenu(Game g)
            : base(g.Input, g.TextureLoader.RequestTexture("UI\\MainMenu\\Options"), 0.19f, new Point(g.GetScreenWidth() / 2 - 300, g.GetScreenHeight() / 2 - 245),
                   new Button(g.Audio, g.Input, g.TextureLoader.RequestTexture("UI\\Common\\BlankExitButton"), new Point((g.GetScreenWidth() / 2 - 300) + 531, (g.GetScreenHeight() / 2 - 300) + 497), "", g.TextureLoader.RequestTexture("UI\\Highlights\\ExitHighlight"), 0.01f))
        {
            game           = g;
            newSettings    = (OptionsSettings)game.settings.Clone();
            spriteFont     = game.mediumFont;
            titleFont      = game.largeFont;
            dragSquare     = game.debugSquare;
            checkBoxActive = game.TextureLoader.RequestTexture("UI\\Common\\CheckBoxActive");
            muted          = game.TextureLoader.RequestTexture("UI\\MainMenu\\muted");
            inputActive    = game.TextureLoader.RequestTexture("UI\\MainMenu\\inputActive");
            var baseOffset = new Vector2(TopLeft.X, TopLeft.Y);

            ConfirmChangesButton = new Button(g.Audio, g.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankExitButton"), new Point((g.GetScreenWidth() / 2 - 300) + 6, (g.GetScreenHeight() / 2 - 300) + 497), "", g.TextureLoader.RequestTexture("UI\\Highlights\\ExitHighlightMirrored"), 0.01f);

            strings[0]  = game.LoadString("UI", "OptionsVideo");
            strings[1]  = game.LoadString("UI", "OptionsTextSpeed");
            strings[2]  = game.LoadString("UI", "OptionsAudio");
            strings[3]  = game.LoadString("UI", "OptionsFullscreen");
            strings[4]  = game.LoadString("UI", "OptionsWindowed");
            strings[5]  = game.LoadString("UI", "OptionsSlow");
            strings[6]  = game.LoadString("UI", "OptionsMedium");
            strings[7]  = game.LoadString("UI", "OptionsFast");
            strings[8]  = game.LoadString("UI", "OptionsUp");
            strings[9]  = game.LoadString("UI", "OptionsLeft");
            strings[10] = game.LoadString("UI", "OptionsDown");
            strings[11] = game.LoadString("UI", "OptionsRight");
            strings[12] = game.LoadString("UI", "OptionsMap");
            strings[13] = game.LoadString("UI", "OptionsInteract");
            strings[14] = game.LoadString("UI", "OptionsRun");
            strings[15] = game.LoadString("UI", "OptionsPause");
            strings[16] = game.LoadString("UI", "OptionsStatus");
            strings[17] = game.LoadString("UI", "OptionsSpellbook");
            strings[18] = game.LoadString("UI", "OptionsInventory");
            strings[19] = game.LoadString("UI", "OptionsCombatSpeed");
            strings[20] = game.LoadString("UI", "OptionsSneak");

            foreach (DisplayMode mode in game.GraphicsDevice.Adapter.SupportedDisplayModes)
            {
                if (mode.Width < 800 || mode.Height < 600)
                {
                    continue;
                }
                resolutions.Add(mode);
            }
            for (int i = 0; i < resolutions.Count; i++)
            {
                if (i > 1)
                {
                    if (resolutions[i].Width == resolutions[i - 1].Width && resolutions[i].Height == resolutions[i - 1].Height)
                    {
                        resolutions.RemoveAt(i);
                        i--;
                        continue;
                    }
                    if (resolutions[i].Width > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width || resolutions[i].Height > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height)
                    {
                        resolutions.RemoveAt(i);
                        i--;
                        continue;
                    }
                }
            }
            for (int i = 0; i < resolutions.Count; i++)
            {
                if (newSettings.horzRez == resolutions[i].Width && newSettings.vertRez == resolutions[i].Height)
                {
                    activeResolution = i;
                    break;
                }
            }
            int vert = 256;

            for (int i = 0; i < 4; i++)
            {
                buttonRecs[i] = new Rectangle(TopLeft.X + 134, TopLeft.Y + vert, 80, 32);
                vert         += 41;
            }
            vert = 256;
            for (int i = 4; i < 8; i++)
            {
                buttonRecs[i] = new Rectangle(TopLeft.X + 305, TopLeft.Y + vert, 80, 32);
                vert         += 41;
            }
            vert = 256;
            for (int i = 8; i < 12; i++)
            {
                buttonRecs[i] = new Rectangle(TopLeft.X + 481, TopLeft.Y + vert, 80, 32);
                vert         += 41;
            }
        }