2019-08-09 19:28:48 +02:00
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using MLEM.Textures;
|
2019-08-10 21:37:10 +02:00
|
|
|
using MLEM.Ui.Style;
|
2019-08-09 19:28:48 +02:00
|
|
|
|
|
|
|
namespace MLEM.Ui.Elements {
|
|
|
|
public class Panel : Element {
|
|
|
|
|
2019-08-10 21:37:10 +02:00
|
|
|
public NinePatch Texture;
|
2019-08-09 19:28:48 +02:00
|
|
|
|
2019-08-11 18:50:39 +02:00
|
|
|
public Panel(Anchor anchor, Vector2 size, Point positionOffset, bool setHeightBasedOnChildren = false, NinePatch texture = null) : base(anchor, size) {
|
2019-08-10 21:37:10 +02:00
|
|
|
this.Texture = texture;
|
2019-08-09 22:04:26 +02:00
|
|
|
this.PositionOffset = positionOffset;
|
2019-08-11 18:50:39 +02:00
|
|
|
this.SetHeightBasedOnChildren = setHeightBasedOnChildren;
|
2019-08-09 19:28:48 +02:00
|
|
|
this.ChildPadding = new Point(5);
|
|
|
|
}
|
|
|
|
|
2019-08-10 13:42:18 +02:00
|
|
|
public override void Draw(GameTime time, SpriteBatch batch, float alpha) {
|
2019-08-10 21:37:10 +02:00
|
|
|
batch.Draw(this.Texture, this.DisplayArea, Color.White * alpha);
|
2019-08-10 13:42:18 +02:00
|
|
|
base.Draw(time, batch, alpha);
|
2019-08-09 19:28:48 +02:00
|
|
|
}
|
|
|
|
|
2019-08-10 21:37:10 +02:00
|
|
|
protected override void InitStyle(UiStyle style) {
|
|
|
|
base.InitStyle(style);
|
|
|
|
this.Texture = style.PanelTexture;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:28:48 +02:00
|
|
|
}
|
|
|
|
}
|