Updated to MonoGame 3.6 + Directory refactor
- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class SpriteSheet : Sprite
|
||||
{
|
||||
private Rectangle[] sourceRects;
|
||||
|
||||
public int FrameCount
|
||||
{
|
||||
get { return sourceRects.Length; }
|
||||
}
|
||||
|
||||
public SpriteSheet(XElement element, string path = "", string file = "")
|
||||
: base(element, path, file)
|
||||
{
|
||||
int columnCount = Math.Max(ToolBox.GetAttributeInt(element, "columns", 1), 1);
|
||||
int rowCount = Math.Max(ToolBox.GetAttributeInt(element, "rows", 1), 1);
|
||||
|
||||
sourceRects = new Rectangle[rowCount * columnCount];
|
||||
|
||||
int cellWidth = SourceRect.Width / columnCount;
|
||||
int cellHeight = SourceRect.Height / rowCount;
|
||||
|
||||
for (int x = 0; x < columnCount; x++)
|
||||
{
|
||||
for (int y = 0; y < rowCount; y++)
|
||||
{
|
||||
sourceRects[x + y * columnCount] = new Rectangle(x * cellWidth, y * cellHeight, cellWidth, cellHeight);
|
||||
}
|
||||
}
|
||||
|
||||
origin = ToolBox.GetAttributeVector2(element, "origin", new Vector2(0.5f, 0.5f));
|
||||
origin.X = origin.X * cellWidth;
|
||||
origin.Y = origin.Y * cellHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user