Files
OpenRA/OpenRa.Game/Graphics/CursorSheetBuilder.cs
Chris Forbes 8450077370 unfail
2009-12-28 09:19:35 +13:00

22 lines
631 B
C#

using System.Collections.Generic;
using OpenRa.FileFormats;
using System.Linq;
using IjwFramework.Collections;
namespace OpenRa.Game.Graphics
{
static class CursorSheetBuilder
{
static Cache<string, Sprite[]> cursors = new Cache<string, Sprite[]>(LoadCursors);
static readonly string[] exts = { ".shp" };
static Sprite[] LoadCursors(string filename)
{
var shp = new Dune2ShpReader(FileSystem.OpenWithExts(filename, exts));
return shp.Select(a => SheetBuilder.Add(a.Image, a.Size)).ToArray();
}
public static Sprite[] LoadAllSprites(string filename) { return cursors[filename]; }
}
}