Forums

Alpha value in a Background
Last Post 04 Feb 2015 01:09 PM by Tokula. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
TokulaUser is Offline
New Member
New Member
Posts:4


--
03 Feb 2015 09:01 PM
    Firstly, thanks for this great extension
    I'm using it with MonoGame and it's very easy to use!


    I ran into the following issue when I made a stackpanel with the following background:

    private void InitializeComponent()
    {
    var sp = new StackPanel();

    sp.Background = new SolidColorBrush(new Color(Color.Black, 0.5f));

    this.Content = sp;

    // and then add a main menu inside a smaller StackPanel with a fixed width and height
    }

    and then tried to draw it:

    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

    spriteBatch.DrawString(_font, "my string", new Vector2(50, 50), Color.White);

    _myUI.Draw(gameTime);

    spriteBatchExt.End();

    The resulting string is completely white. So my question is: Is colors with a alpha value not supported? Or am I doing it wrong?

    It's not a big issue thou, since I can make the half-see-through-background myself with a texture, and then draw the UI in the center.
    It would just be a nice feature to set an alpha value on the parent stackpanel first, and then make a smaller stackpanel inside.
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:676


    --
    03 Feb 2015 09:27 PM
    Yes, alpha is supported. If you are drawing something with Sprite Batch yourself, no way it will work with UI lib. In that case it depends on many things like order of call, render state etc. What are you trying to achieve?
    TokulaUser is Offline
    New Member
    New Member
    Posts:4


    --
    04 Feb 2015 01:09 PM
    I discovered that the UI had a Background property and that I should use that instead

    Sorry for the inconvenience
    You are not authorized to post a reply.