public virtual void Draw(MenuState a_ms) { if (bButtonHidden.Equals (false)) { Color color = Color.White * a_ms.TransitionAlpha; SpriteBatch spriteBatch = GSM.Instance.SpriteBatch; SpriteFont font = GSM.Instance.Font; //color = bFocused ? Color.White * a_ms.TransitionAlpha : Color.White* a_ms.TransitionAlpha; Rectangle uv = new Rectangle (); if (bFocused.Equals (false)) uv = new Rectangle (0, 0, tex2dButtonTexture.Width, (int)(tex2dButtonTexture.Height * 0.5f)); else { uv = new Rectangle(0,(int)(tex2dButtonTexture.Height*0.5f),tex2dButtonTexture.Width, (int)(tex2dButtonTexture.Height*0.5f)); } spriteBatch.Draw (tex2dButtonTexture, rSpritePosition, uv, color); if (bLabel.Equals (true)) spriteBatch.DrawString (font, sButtonText, new Vector2 (vec2Position.X, vec2Position.Y), color, 0, new Vector2 (0, 0), 1f, SpriteEffects.None, 0); }
public virtual int GetWidth(MenuState a_ms) { return (int)GSM.Instance.Font.MeasureString(sButtonText).X;
public virtual void Update(MenuState a_ms, GameTime a_gt) { float fadeSpeed = (float)a_gt.ElapsedGameTime.TotalSeconds * 4; vec2TextSize = GSM.Instance.Font.MeasureString (sButtonText); if (bFocused) fSelectionFade = Math.Min (fSelectionFade + fadeSpeed, 20); else fSelectionFade = Math.Max (fSelectionFade - fadeSpeed, 0); bFocused = InputController.Instance.IsMouse(rSpritePosition);
public virtual int GetHeight(MenuState a_ms) { return GSM.Instance.Font.LineSpacing + tex2dButtonTexture.Height;