Many refactors and minor changes. idk.
This commit is contained in:
@@ -39,13 +39,8 @@ namespace RecrownedAthenaeum.SpecialTypes
|
||||
this.bottom = bottom;
|
||||
this.top = top;
|
||||
|
||||
sourcePatches = GenerateSourcesPatches();
|
||||
}
|
||||
|
||||
private Rectangle[] GenerateSourcesPatches()
|
||||
{
|
||||
Rectangle[] patches =
|
||||
{
|
||||
{
|
||||
new Rectangle(0, 0, left, bottom),
|
||||
new Rectangle(left, 0, textureRegion.Width - left - right, bottom),
|
||||
new Rectangle(textureRegion.Width - right, 0, right, bottom),
|
||||
@@ -62,7 +57,9 @@ namespace RecrownedAthenaeum.SpecialTypes
|
||||
patches[i].X += textureRegion.X;
|
||||
patches[i].Y += textureRegion.Y;
|
||||
}
|
||||
return patches;
|
||||
|
||||
sourcePatches = patches;
|
||||
|
||||
}
|
||||
|
||||
private Rectangle[] GenenerateDestinationRectangles(int width, int height)
|
||||
@@ -122,7 +119,11 @@ namespace RecrownedAthenaeum.SpecialTypes
|
||||
public void Draw(ConsistentSpriteBatch spriteBatch, Rectangle destination, Color color, float rotation = 0, Vector2 origin = default(Vector2))
|
||||
{
|
||||
if (rotation != 0) throw new NotImplementedException("Ninepatches can't be rotated.");
|
||||
if (origin != default(Vector2)) throw new NotImplementedException("Ninepatches can't have origin changed (hint: use the destination rectangle to shift and position).");
|
||||
if (origin != default(Vector2))
|
||||
{
|
||||
destination.X -= (int)origin.X;
|
||||
destination.Y -= (int)origin.Y;
|
||||
}
|
||||
Draw(spriteBatch, color, destination);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user