ChangeState() public method

public ChangeState ( GameState newState ) : void
newState GameState
return void
Example #1
0
        public FinalBomber()
        {
            Instance = this;
            Graphics = new GraphicsDeviceManager(this)
                {
                    PreferredBackBufferWidth = Config.Resolutions[Config.IndexResolution, 0],
                    PreferredBackBufferHeight = Config.Resolutions[Config.IndexResolution, 1]
                };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolutions[Config.IndexResolution, 0], Config.Resolutions[Config.IndexResolution, 1]);

            #if DEBUG
            Graphics.SynchronizeWithVerticalRetrace = false;
            #else
            Graphics.SynchronizeWithVerticalRetrace = true;
            #endif
            // Don't fix FPS to 60 => this wont work when vsync is ON
            IsFixedTimeStep = false;

            Graphics.IsFullScreen = Config.FullScreen;
            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            var stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleScreen = new TitleScreen(this, stateManager);
            BattleMenuScreen = new BattleMenuScreen(this, stateManager);
            SuddenDeathMenuScreen = new SuddenDeathMenuScreen(this, stateManager);
            ItemMenuScreen = new ItemMenuScreen(this, stateManager);
            GamePlayScreen = new GamePlayScreen(this, stateManager);
            SinglePlayerGamePlayScreen = new SinglePlayerGamePlayScreen(this, stateManager);

            OptionMenuScreen = new OptionMenuScreen(this, stateManager);
            KeysMenuScreen = new KeysMenuScreen(this, stateManager);
            CreditMenuScreen = new CreditMenuScreen(this, stateManager);

            SinglePlayerGameModeMenuScreen = new SinglePlayerGameModeMenuScreen(this, stateManager);
            LobbyMenuScreen = new LobbyMenuScreen(this, stateManager);
            OnlineGameMenuScreen = new OnlineGameMenuScreen(this, stateManager);
            MultiplayerGameModeMenuScreen = new MultiplayerGameModeMenuScreen(this, stateManager);
            UserMenuScreen = new UserMenuScreen(this, stateManager);
            UserLoginMenuScreen = new UserLoginMenuScreen(this, stateManager);
            UserRegistrationMenuScreen = new UserRegistrationMenuScreen(this, stateManager);
            NetworkMenuScreen = new NetworkMenuScreen(this, stateManager);
            CreateServerMenuScreen = new CreateServerMenuScreen(this, stateManager);
            JoinServerMenuScreen = new JoinServerMenuScreen(this, stateManager);

            NetworkTestScreen = new NetworkGamePlayScreen(this, stateManager);

            stateManager.ChangeState(TitleScreen);

            // FPS
            Components.Add(new FrameRateCounter(this));

            _password = "";
        }