Пример #1
0
 /// <summary>
 /// Draw Machine Controller
 /// </summary>
 /// <param name="spriteBatch"></param>
 public void draw(Troopy.Xna.SpriteBatch spriteBatch)
 {
     if (this.TextureController != null)
     {
         spriteBatch.Draw(
             this.TextureController,
             new Vector2(this.Left, this.Top),
             Color.White
             );
     }
 }
Пример #2
0
        public void draw(Troopy.Xna.SpriteBatch spriteBatch)
        {
            for (int i = 0; i < this.Tools.Count; i++)
            {
                Tool  t = this.Tools[i];
                Color bc;
                if (this.selectedTool != null && this.selectedTool.GetType() == t.GetType())
                {
                    bc = this.BorderColorSelected;
                }
                else
                {
                    if (!t.Available)
                    {
                        bc = this.BorderColorDisabled;
                    }
                    else if (this.isToolHovered(i))
                    {
                        bc = this.BorderColorHover;
                    }
                    else
                    {
                        bc = this.BorderColorAvailable;
                    }
                }

                // Draw button border
                spriteBatch.LayerDepth = this.LdButtonBorder;
                spriteBatch.drawRectangle(
                    this.Left,
                    this.Top + (i * this.Width),
                    this.Width,
                    this.Width,
                    bc
                    );

                // Draw Button
                spriteBatch.LayerDepth = this.LdButtonButton;
                spriteBatch.Draw(
                    t.buttonTexture,
                    new Vector2(this.Left + this.ButtonBorder, this.Top + (i * this.Width) + this.ButtonBorder),
                    null, null, null, 0f, null, Color.White, SpriteEffects.None, spriteBatch.LayerDepth
                    );
            }
        }