public override void Draw(SpriteBatch Batch) { //Call the Renderer's Draw //NOTE: The renderer will be in charge of rendering 2 screens: the 2D HUD and the 3D World //It will be passed the game state from the engine and decide how to draw each component //It will also be in charge of sending input from the visualisation to the engine if (gameplayScreen != null) { gameplayScreen.Draw(Batch); } }
/// <summary> /// The base draw loop handles drawing all draw loops corresponding to the current game state /// </summary> /// <param name="gameTime">Provides a snapshot of timing values</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); // Switch based on the current scene switch (State) { // Call each corresponding draw method case GameState.MainMenu: MainMenuScreen.Draw(spriteBatch); break; case GameState.Instructions: InstructionsScreen.Draw(spriteBatch); break; case GameState.ModeSelection: ModeSelectionScreen.Draw(spriteBatch); break; // If the gameplayScreen is not defined because the state updates asynchronously from // the update loop creating a new instance of gameplayScreen, ignore the current frame // and wait until the gameplayScreen is defined case GameState.ClassicGameplay: if (gameplayScreen != null) { gameplayScreen.Draw(spriteBatch); } break; case GameState.FreeGameplay: if (gameplayScreen != null) { gameplayScreen.Draw(spriteBatch); } break; } }