/// <summary> /// Draw the current state ofthe game. /// </summary> /// <param name="screen">Reference to the screen that contains the bar.</param> /// <param name="position">Position where the <c>OptionBar</c> is drawed.</param> /// <param name="currentValue">Current value of the <c>OptionBar</c>.</param> /// <param name="isSelected">true if the <c>OptionBar</c> is selected, false otherwise.</param> /// <param name="gametime">Global time of the game.</param> public virtual void Draw(NumericOptionEntry screen, Vector2 position, float currentValue, bool isSelected, GameTime gameTime) { Texture2D borderTexture = TextureManager.GetTexture("BarTexture").BaseTexture; double percentToDraw = currentValue / _maximumValue; double eachPercentWidth = borderTexture.Width / _maximumValue; int xPosition = GameSettings.DefaultInstance.ResolutionWidth / 3; ScreenManager.SpriteBatch.Draw( TextureManager.GetTexture("DummyTexture").BaseTexture, new Rectangle(xPosition, (int)position.Y + 8, (int)((percentToDraw * 100) * eachPercentWidth), borderTexture.Height), Color.Red); ScreenManager.SpriteBatch.Draw( borderTexture, new Rectangle(xPosition, (int)position.Y + 8, borderTexture.Width, borderTexture.Height), Color.White); }
/// <summary> /// Update the current state of the bar. /// </summary> /// <param name="screen">Reference to the screen that contains the bar.</param> /// <param name="isSelected">true if the <c>OptionBar</c> is selected, false otherwise.</param> /// <param name="gametime">Global time of the game.</param> public virtual void Update(NumericOptionEntry screen, bool isSelected, GameTime gametime) { }