/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); spaceManager.Draw(spriteBatch); switch (gameState) { case GameState.MainMenu: menuManager.Draw(spriteBatch); break; case GameState.Gameplay: sunManager.Draw(spriteBatch); orbitManager.Draw(spriteBatch); planetManager.Draw(spriteBatch); asteroidManager.Draw(spriteBatch, sunManager); scoreManager.Draw(spriteBatch); break; case GameState.Credits: creditManager.Draw(spriteBatch); break; } spriteBatch.End(); base.Draw(gameTime); }
public void DrawBloom(Camera2D camera, BloomComponent bloom, bool isBloom) { _background.Draw(false, Camera.Pos); _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.GetTransformation(_spriteBatch.GraphicsDevice)); _spaceManager.Draw(_spriteBatch, Camera.Pos, Camera.Zoom); _spriteBatch.End(); // Draw particles in different spritebatch. Otherwise they look absolutely awful. _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.Additive, null, null, null, null, Camera.GetTransformation(_spriteBatch.GraphicsDevice)); _particleManager.Draw(camera); _spriteBatch.End(); _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.GetTransformation(_spriteBatch.GraphicsDevice)); foreach (var s in _spaceViewModel.Structures) { switch (s.StructureType) { default: s.Draw(camera); break; } } _floatyAreaObjectManager.Draw(_spriteBatch, camera); _projectileManager.Draw(camera); _clientShipManager.Draw(camera); _drawShipNames(); _spriteBatch.End(); }
public void DrawBloom(GameTime gameTime, BloomComponent bloom, bool isBloom) { if (isBloom) { bloom.BeginDraw(_spriteBatch); } _spaceManager.DrawBackGround(cameraFollowing, Camera.Pos); _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.get_transformation(_spriteBatch.GraphicsDevice)); _spaceManager.Draw(_spriteBatch, Camera.Pos, Zoom); _spriteBatch.End(); // Draw particles in different spritebatch. Otherwise they look absolutely awful. _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.Additive, null, null, null, null, Camera.get_transformation(_spriteBatch.GraphicsDevice)); _spaceManager.DrawWarpZones(); _particleManager.Draw(_spriteBatch); _shipManager.ParticleDraw(_spriteBatch); _spriteBatch.End(); _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.get_transformation(_spriteBatch.GraphicsDevice)); foreach (var s in _structures) { switch (s.buildingType) { case StructureTypes.LaserTurret: ((Turret)s).Draw(_spriteBatch); break; default: s.Update(); break; } } _projectileManager.Draw(Camera._pos); _shipManager.Draw(); //ParticleManager.DrawOnTop(spriteBatch); // Not needed atm. Needed when we use Charge effects, etc _spriteBatch.End(); //normal.Draw(spriteBatch, gameTime, ConvertUnits.ToDisplayUnits(shipPos), spaceCam); #if DEBUG //_spriteBatch.Begin(); //string the = ""+ShipManager.getPlayerShipDifference(); ////DebugTextManager.DrawTextToScreenLeft(_spriteBatch, 2, the); ////ProjectileManager.Debug(_spriteBatch); //_spriteBatch.End(); #endif if (isBloom) { bloom.Draw(_spriteBatch); } }