Beispiel #1
0
        /// <summary>
        /// Gamestate pattern : Draw the widget.
        /// </summary>
        /// <param name="gameTime">Elasped time since last draw</param>
        /// <param name="spriteBatch">The sprite batch</param>
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            // If the widget is invisible, don't render it nor it's children
            if (_visible)
            {
                // Retreive the used skin
                YnSkin skin = YnGui.GetSkin(_skinName);

                // Draw the borders if needed
                if (_hasBorders)
                {
                    DrawBorders(gameTime, spriteBatch, skin);
                }

                // Draw the background id needed
                if (_hasBackground)
                {
                    DrawBackground(gameTime, spriteBatch, skin);
                }

                // Draw the component itself
                DrawWidget(gameTime, spriteBatch, skin);

                // Draw the child components
                DrawChildren(gameTime, spriteBatch);
            }
        }
 /// <summary>
 /// Manage the text color when the button is clicked.
 /// </summary>
 /// <param name="gameTime">The game time</param>
 protected override void DoCustomUpdate(GameTime gameTime)
 {
     if (Clicked)
     {
         // The label's custom text color is used to render it in the clicked state
         _label.TextColor      = YnGui.GetSkin(_skinName).TextColorClicked;
         _label.UseCustomColor = true;
     }
     else
     {
         _label.UseCustomColor = false;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Ease method to retreive the widget's current skin.
 /// </summary>
 /// <returns>The skin</returns>
 protected YnSkin GetSkin()
 {
     return(YnGui.GetSkin(_skinName));
 }