/// <summary> /// Draws the Menu Entry onto the screen. /// </summary> /// <param name="gameTime">Current GameTime.</param> /// <param name="isSelected">Specifies if the item is currently selected.</param> /// <param name="screen">The screen this entry belongs to.</param> public virtual void Draw(GameTime gameTime, bool isSelected, MenuScreen screen) { //A selected entry is brighter than a non-selected entry. Color entryColor = isSelected ? Color.LimeGreen: Color.Green; //Set up rendering objects SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch; SpriteFont spriteFont = screen.ScreenManager.Font; //Draw the menu item to the screen. spriteBatch.DrawString(spriteFont, this.text, this.position, entryColor); }
/// <summary> /// Calulates the height of the entry. /// </summary> /// <param name="screen">The screen this entry belongs to.</param> /// <returns></returns> public int GetHeight(MenuScreen screen) { return (int)screen.ScreenManager.Font.MeasureString(this.text).Y; }
/// <summary> /// Updates the Menu Entry. /// </summary> /// <param name="gameTime">Current GameTime.</param> /// <param name="isSelected">Specifies if the item is currently selected.</param> /// <param name="screen">The screen this entry belongs to.</param> public virtual void Update(GameTime gameTime, bool isSelected, MenuScreen screen) { }
/// <summary> /// Calulates the width of the entry. /// </summary> /// <param name="screen">The screen this entry belongs to.</param> /// <returns></returns> public int GetWidth(MenuScreen screen) { return (int)screen.ScreenManager.Font.MeasureString(this.text).X; }
/// <summary> /// Calulates the height of the entry. /// </summary> /// <param name="screen">The screen this entry belongs to.</param> /// <returns></returns> public int GetHeight(MenuScreen screen) { return((int)screen.ScreenManager.Font.MeasureString(this.text).Y); }
/// <summary> /// Calulates the width of the entry. /// </summary> /// <param name="screen">The screen this entry belongs to.</param> /// <returns></returns> public int GetWidth(MenuScreen screen) { return((int)screen.ScreenManager.Font.MeasureString(this.text).X); }