public override void Initialize() { mapScreen = (MapScreen)Game.Components[Game.Components.Count - 2]; base.Initialize(); }
public Game1() { //load graphics according to the device manager and setting //the resolution graphics = new GraphicsDeviceManager(this); graphics.ToggleFullScreen(); graphics.PreferredBackBufferHeight = screenHeight; graphics.PreferredBackBufferWidth = screenWidth; graphics.ApplyChanges(); player = new Player(); //screen size developed at baseScreenSize = new Vector2(screenWidth, screenHeight); //the screen size it is scaled to ScreenRectangle = new Rectangle(0, 0, screenWidth, screenHeight); //base directory where all the content is stored, content is a reference //content pipeline - content loaded Content.RootDirectory = "Content"; //adds the input handler component, keeps track of what is inputted Components.Add(new Input_Handler(this)); //keeps track of the states - the different pages stateManager = new GameStateManager(this); //game screens used for the game TitleScreen = new Game_Screens.LoginScreen(this, stateManager); StartMenuScreen = new Game_Screens.StartMenu(this, stateManager); GamePlayScreen = new Game_Screens.GamePlayScreen(this, stateManager); MapScreen = new Game_Screens.MapScreen(this, stateManager); Achievements = new Game_Screens.PlayerStatistics(this, stateManager); //intial state starts at title screen stateManager.ChangeState(TitleScreen); }