Наследование: MSGUIUnclickable
Пример #1
0
 /// <summary>
 /// Constructs an MSButton.
 /// </summary>
 /// <param name="label">Add text to this MSButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of thisMSButton</param>
 /// <param name="unhovered">will be drawn when this MSButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="highlight">the Color to overlay this MSButton with</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(boundingRectangle, toolTip, shape, spriteBatch, game)
 {
     unhoveredTexture = unhovered;
     clickedTexture = clicked;
     hoveredTexture = hovered;
     this.highlight = highlight;
     collisionTexture = unhovered;
     if (label != null)
     {
         this.label = label;
         this.label.Position += Position;
     }
     this.action = action;
     this.shape = shape;
     UnHover();
 }
Пример #2
0
 /// <summary>
 /// Constructs an MSButton.
 /// </summary>
 /// <param name="label">Add text to this MSButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of thisMSButton</param>
 /// <param name="unhovered">will be drawn when this MSButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="highlight">the Color to overlay this MSButton with</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSAnimatingButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(label, action, boundingRectangle, unhovered, clicked, hovered, highlight, toolTip, shape, spriteBatch, game)
 {
     clickTimer = 0;
     unclickTimer = 0;
     UnclickTimerLimit = 0;
     unclickTriggered = false;
     hoverTimer = 0;
     unhoverTimer = 0;
     ClickPosition = new ConstantParametricCurve();
     ClickSize = new ConstantParametricCurve();
     HoverPosition = new ConstantParametricCurve();
     HoverSize = new ConstantParametricCurve();
     UnclickPosition = new ConstantParametricCurve();
     UnclickSize = new ConstantParametricCurve();
     UnhoverPosition = new ConstantParametricCurve();
     UnhoverSize = new ConstantParametricCurve();
     x0 = boundingRectangle.X;
     y0 = boundingRectangle.Y;
     w0 = boundingRectangle.Width;
     h0 = boundingRectangle.Height;
 }
Пример #3
0
 /// <summary>
 /// Constructs an MSAnimatingButton with no highlight.
 /// </summary>
 /// <param name="label">Add text to this MSAnimatingButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSAnimatingButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of this MSAnimatingButton</param>
 /// <param name="unhovered">will be drawn when this MSAnimatingButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSAnimatingButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSAnimatingButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSAnimatingButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : this(label, action, boundingRectangle, unhovered, clicked, hovered, Color.White, toolTip, shape, spriteBatch, game)
 {
 }