Beispiel #1
0
        public void Render(Entity entity, SpriteBatch batch, AssetManager assetManager)
        {
            var tex = assetManager[AssetManager.SolidGrayColor];

            var rectBg = new Rectangle(RenderPosition.ToPoint(), LayoutSize.ToPoint());

            if (MouseState == ElementMouseState.Pressed)
            {
                rectBg.Offset(1, 1);
            }

            var rectShadow = rectBg;

            rectShadow.Offset(2, 2);

            var   textOffset  = new Vector2(2);
            Color buttonColor = Color.White;

            if (MouseState == ElementMouseState.Pressed)
            {
                textOffset += new Vector2(1);
                buttonColor = Color.LightGray;
            }
            else if (MouseState == ElementMouseState.Hover)
            {
                buttonColor = Color.LightGray;
            }

            batch.Draw(tex, rectShadow, Color.Gray);
            batch.Draw(tex, rectBg, buttonColor);
            batch.DrawString(Font, Text, RenderPosition + textOffset, Color.Black);
        }