1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 22:18:34 +01:00

allow changing the color of panels

This commit is contained in:
Ell 2021-06-22 01:14:06 +02:00
parent dca013e551
commit ef83124cfa

View file

@ -22,6 +22,11 @@ namespace MLEM.Ui.Elements {
/// </summary> /// </summary>
public StyleProp<NinePatch> Texture; public StyleProp<NinePatch> Texture;
/// <summary> /// <summary>
/// The color that this panel's <see cref="Texture"/> should be drawn with.
/// If this style property has no value, <see cref="Color.White"/> is used.
/// </summary>
public StyleProp<Color> DrawColor;
/// <summary>
/// The scroll bar that this panel contains. /// The scroll bar that this panel contains.
/// This is only nonnull if <see cref="scrollOverflow"/> is true. /// This is only nonnull if <see cref="scrollOverflow"/> is true.
/// </summary> /// </summary>
@ -154,7 +159,7 @@ namespace MLEM.Ui.Elements {
/// <inheritdoc /> /// <inheritdoc />
public override void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) { public override void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) {
if (this.Texture.HasValue()) if (this.Texture.HasValue())
batch.Draw(this.Texture, this.DisplayArea, Color.White * alpha, this.Scale); batch.Draw(this.Texture, this.DisplayArea, this.DrawColor.OrDefault(Color.White) * alpha, this.Scale);
// if we handle overflow, draw using the render target in DrawUnbound // if we handle overflow, draw using the render target in DrawUnbound
if (!this.scrollOverflow || this.renderTarget == null) { if (!this.scrollOverflow || this.renderTarget == null) {
base.Draw(time, batch, alpha, blendState, samplerState, matrix); base.Draw(time, batch, alpha, blendState, samplerState, matrix);