Esempio n. 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);
            }
        }
Esempio n. 2
0
 /// <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;
     }
 }
Esempio n. 3
0
 public YnSceneGui()
     : base()
 {
     _guiManager          = new YnGui();
     _useOtherBatchForGui = false;
 }
Esempio n. 4
0
 /// <summary>
 /// Ease method to retreive the widget's current skin.
 /// </summary>
 /// <returns>The skin</returns>
 protected YnSkin GetSkin()
 {
     return(YnGui.GetSkin(_skinName));
 }
Esempio n. 5
0
 public MainMenuState(string name)
     : base(name, false)
 {
     _gui = new YnGui();
     YnGui.RegisterSkin("GAME", YnSkinGenerator.Generate(Color.Aquamarine, "Fonts/MainMenuFont"));
 }