Beispiel #1
0
        public MainGame()
        {
            // Basic initialization
            Window.Title = "Octopussy Game";
            Content.RootDirectory = "Content";
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.IsFullScreen = true;

            graphics.ApplyChanges();

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            PreferenceManager = new PreferenceManager();

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new MainMenuScreen(), null);
        }
        public object Clone()
        {
            var clone = new PreferenceManager();
            clone.PlayerOne = (PlayerPreference) PlayerOne.Clone();
            clone.PlayerTwo = (PlayerPreference) PlayerTwo.Clone();

            return clone;
        }
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            backgroundTexture = content.Load<Texture2D>("images/menu/settings");

            var back = new ImageMenuEntry(new Rectangle(23, 25, 78, 54),
                                          new Rectangle(170, 25, 78, 54),
                                          content.Load<Texture2D>("images/menu/polozky"),
                                          content.Load<Texture2D>("images/menu/polozky"));

            back.PositionOriginal = new Vector2(240, 662);
            back.PositionSelected = new Vector2(240, 662);

            back.Selected += OnCancel;

            var ok = new ImageMenuEntry(new Rectangle(29, 95, 79, 68),
                                        new Rectangle(174, 95, 79, 68),
                                        content.Load<Texture2D>("images/menu/polozky"),
                                        content.Load<Texture2D>("images/menu/polozky"));

            ok.PositionOriginal = new Vector2(685, 656);
            ok.PositionSelected = new Vector2(685, 656);

            ok.Selected += OnCancel;

            MenuEntries.Add(back);
            MenuEntries.Add(ok);

            SelectedEntry = -5;

            pm = ((MainGame) ScreenManager.Game).PreferenceManager;
            previousPm = pm;
            pm = (PreferenceManager) pm.Clone();

            base.LoadContent();
        }