public void Draw(SpriteBatch spriteBatch) { // Draw background background.Draw(spriteBatch); // Draw buttons foreach (Button button in menuButtons) { button.Draw(spriteBatch); } // Draw fields foreach (Field field in menuFields) { switch (field.id) { case 0: field.Draw(spriteBatch, SettingsManager.getUsername()); break; case 1: field.Draw(spriteBatch, SettingsManager.getVerboseDifficulty()); break; case 2: field.Draw(spriteBatch, SettingsManager.getResolutionWidth() + "x" + SettingsManager.getResolutionHeight()); break; case 8: field.Draw(spriteBatch, SettingsManager.getShowDebug().ToString()); break; case 9: field.Draw(spriteBatch, SettingsManager.getShowBounds().ToString()); break; case 10: field.Draw(spriteBatch, SettingsManager.getShowDepths().ToString()); break; default: field.Draw(spriteBatch, "No value"); break; } } }
public void Draw(SpriteBatch spriteBatch) { if (death == null) { spriteBatch.Draw(texture, position, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); if (SettingsManager.getShowBounds()) { // Collision rectangle spriteBatch.Draw(ContentStore.debug, bounds, Color.Red); } } else { death.Draw(spriteBatch, position); } }
public void Draw(SpriteBatch spriteBatch) { if (texture != null) { spriteBatch.Draw(texture, position, null, color, 0f, origin, 1f, SpriteEffects.None, 0f); if (SettingsManager.getShowDepths()) { spriteBatch.DrawString(ContentStore.generic, node.depth.ToString(), position, Color.White); } if (SettingsManager.getShowBounds()) { if (nodeType == StationNodeType.Turret) { spriteBatch.Draw(ContentStore.debug, bounds, Color.Red); } else { // Collision rectangle spriteBatch.Draw(ContentStore.debug, bounds, Color.White); } } if (explosion != null) { explosion.Draw(spriteBatch, position); color = new Color(120, 120, 120); } if (nodeType == StationNodeType.Turret) { spriteBatch.Draw(ContentStore.station_shield, position, null, Color.White, rotation++, origin, 0.15f, SpriteEffects.None, 0f); } } //Draw projectiles foreach (Projectile projectile in projectiles.Values) { if (projectile != null) { // Draw projectiles projectile.Draw(spriteBatch); } } }
public void Draw(SpriteBatch staticSpriteBatch, SpriteBatch cameraSpriteBatch) { //Draw projectiles foreach (Projectile projectile in projectiles.Values) { if (projectile != null) { // Draw projectiles projectile.Draw(cameraSpriteBatch); } } // Ship if (!invulnerable) { cameraSpriteBatch.Draw(texture, position, null, Color.White, playerRotation, origin, 1f, SpriteEffects.None, 0f); } else { cameraSpriteBatch.Draw(texture, position, null, Color.Red, playerRotation, origin, 1f, SpriteEffects.None, 0f); } // Shield cameraSpriteBatch.Draw(shield, position, null, Color.White, sheildRotation++, origin + new Vector2(3, 3), 1f, SpriteEffects.None, 0f); Color healthColor = Color.White; // Health if (health > 67) { healthColor = Color.LightGreen; } else if (health > 34) { healthColor = Color.Yellow; } else { healthColor = Color.PaleVioletRed; } if (playerControlled) { staticSpriteBatch.Draw(ContentStore.debug, new Vector2(6, 6), healthBar, healthColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); staticSpriteBatch.Draw(ContentStore.health_bar, new Vector2(4, 4), Color.White); // Name staticSpriteBatch.DrawString(ContentStore.generic, name, new Vector2(13, 7), Color.LightGray, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); // Debug if (SettingsManager.getShowDebug()) { staticSpriteBatch.DrawString(ContentStore.generic, "Health: " + health, Vector2.Zero, Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Position: " + position.ToString(), new Vector2(0, 16), Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Velocity: " + velocity.ToString(), new Vector2(0, 32), Color.White); staticSpriteBatch.DrawString(ContentStore.generic, "Direction: " + playerRotation, new Vector2(0, 48), Color.White); } if (SettingsManager.getShowBounds()) { // Collision rectangle cameraSpriteBatch.Draw(ContentStore.debug, bounds, Color.White); } } // Else draw a small health bar above player else { // Name Vector2 textOrigin = MoboUtils.textOrigin(name, ContentStore.generic); cameraSpriteBatch.DrawString(ContentStore.generic, name, position + new Vector2(0, -56), Color.White, 0.0f, textOrigin, 1f, SpriteEffects.None, 0.0f); // Health Bar cameraSpriteBatch.Draw(ContentStore.debug, position, new Rectangle(0, 0, fullBar.Width + 8, fullBar.Height + 8), Color.White, 0.0f, new Vector2(fullBar.Width / 2 + 4, 132), 0.25f, SpriteEffects.None, 0.0f); cameraSpriteBatch.Draw(ContentStore.debug, position, fullBar, Color.Black, 0.0f, new Vector2(fullBar.Width / 2, 128), 0.25f, SpriteEffects.None, 0.0f); cameraSpriteBatch.Draw(ContentStore.debug, position, healthBar, healthColor, 0.0f, new Vector2(healthBar.Width / 2, 128), 0.25f, SpriteEffects.None, 0.0f); } }