(b451554e8) Merge remote-tracking branch 'origin/dev' into keymapping-refactor-test
This commit is contained in:
@@ -5,30 +5,25 @@ namespace Barotrauma
|
||||
{
|
||||
partial class DeformableSprite
|
||||
{
|
||||
private Sprite sprite;
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get { return sprite.size; }
|
||||
get { return Sprite.size; }
|
||||
}
|
||||
|
||||
public Vector2 Origin
|
||||
{
|
||||
get { return sprite.Origin; }
|
||||
set { sprite.Origin = value; }
|
||||
get { return Sprite.Origin; }
|
||||
set { Sprite.Origin = value; }
|
||||
}
|
||||
|
||||
public Sprite Sprite
|
||||
public Sprite Sprite { get; private set; }
|
||||
|
||||
public DeformableSprite(XElement element, int? subdivisionsX = null, int? subdivisionsY = null, string filePath = "", bool lazyLoad = false)
|
||||
{
|
||||
get { return sprite; }
|
||||
Sprite = new Sprite(element, file: filePath, lazyLoad: lazyLoad);
|
||||
InitProjSpecific(element, subdivisionsX, subdivisionsY, lazyLoad);
|
||||
}
|
||||
|
||||
public DeformableSprite(XElement element, int? subdivisionsX = null, int? subdivisionsY = null, string filePath = "")
|
||||
{
|
||||
sprite = new Sprite(element, file: filePath);
|
||||
InitProjSpecific(element, subdivisionsX, subdivisionsY);
|
||||
}
|
||||
|
||||
partial void InitProjSpecific(XElement element, int? subdivisionsX, int? subdivisionsY);
|
||||
partial void InitProjSpecific(XElement element, int? subdivisionsX, int? subdivisionsY, bool lazyLoad = false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,8 +103,9 @@ namespace Barotrauma
|
||||
partial void LoadTexture(ref Vector4 sourceVector, ref bool shouldReturn, bool premultiplyAlpha = true);
|
||||
partial void CalculateSourceRect();
|
||||
|
||||
public Sprite(XElement element, string path = "", string file = "")
|
||||
public Sprite(XElement element, string path = "", string file = "", bool? preMultiplyAlpha = null, bool lazyLoad = false)
|
||||
{
|
||||
this.lazyLoad = lazyLoad;
|
||||
SourceElement = element;
|
||||
if (file == "")
|
||||
{
|
||||
@@ -127,8 +128,12 @@ namespace Barotrauma
|
||||
|
||||
Name = SourceElement.GetAttributeString("name", null);
|
||||
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
|
||||
preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true);
|
||||
bool shouldReturn = false;
|
||||
LoadTexture(ref sourceVector, ref shouldReturn, SourceElement.GetAttributeBool("premultiplyalpha", true));
|
||||
if (!lazyLoad)
|
||||
{
|
||||
LoadTexture(ref sourceVector, ref shouldReturn, preMultipliedAlpha);
|
||||
}
|
||||
if (shouldReturn) return;
|
||||
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
|
||||
size = SourceElement.GetAttributeVector2("size", Vector2.One);
|
||||
|
||||
Reference in New Issue
Block a user