mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
make image texture not read only
This commit is contained in:
parent
e150c0eb0d
commit
6ede030138
1 changed files with 4 additions and 4 deletions
|
@ -7,20 +7,20 @@ namespace MLEM.Ui.Elements {
|
||||||
public class Image : Element {
|
public class Image : Element {
|
||||||
|
|
||||||
public Color Color = Color.White;
|
public Color Color = Color.White;
|
||||||
private readonly TextureRegion texture;
|
public TextureRegion Texture;
|
||||||
private readonly bool scaleToImage;
|
private readonly bool scaleToImage;
|
||||||
|
|
||||||
public Image(Anchor anchor, Vector2 size, TextureRegion texture, bool scaleToImage = false) : base(anchor, size) {
|
public Image(Anchor anchor, Vector2 size, TextureRegion texture, bool scaleToImage = false) : base(anchor, size) {
|
||||||
this.texture = texture;
|
this.Texture = texture;
|
||||||
this.scaleToImage = scaleToImage;
|
this.scaleToImage = scaleToImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Point CalcActualSize(Rectangle parentArea) {
|
protected override Point CalcActualSize(Rectangle parentArea) {
|
||||||
return this.scaleToImage ? this.texture.Size : base.CalcActualSize(parentArea);
|
return this.scaleToImage ? this.Texture.Size : base.CalcActualSize(parentArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(GameTime time, SpriteBatch batch, float alpha, Point offset) {
|
public override void Draw(GameTime time, SpriteBatch batch, float alpha, Point offset) {
|
||||||
batch.Draw(this.texture, this.DisplayArea.OffsetCopy(offset), this.Color * alpha);
|
batch.Draw(this.Texture, this.DisplayArea.OffsetCopy(offset), this.Color * alpha);
|
||||||
base.Draw(time, batch, alpha, offset);
|
base.Draw(time, batch, alpha, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue