drop CursorSheetBuilder; use normal SheetBuilder for cursors now.

This commit is contained in:
Chris Forbes
2011-07-17 19:15:55 +12:00
parent 5609c8d041
commit 3d2635fca5
4 changed files with 2 additions and 41 deletions

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Graphics
public CursorSequence(string cursorSrc, string palette, MiniYaml info)
{
sprites = Game.modData.CursorSheetBuilder.LoadAllSprites(cursorSrc);
sprites = Game.modData.SpriteLoader.LoadAllSprites(cursorSrc);
var d = info.NodesDict;
start = int.Parse(d["start"].Value);

View File

@@ -1,37 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Linq;
using OpenRA.FileFormats;
namespace OpenRA.Graphics
{
public class CursorSheetBuilder
{
ModData modData;
Cache<string, Sprite[]> cursors;
readonly string[] exts = { ".shp" };
public CursorSheetBuilder( ModData modData )
{
this.modData = modData;
this.cursors = new Cache<string, Sprite[]>( LoadCursors );
}
Sprite[] LoadCursors(string filename)
{
var shp = new ShpReader(FileSystem.OpenWithExts(filename, exts));
return shp.Select(a => modData.SheetBuilder.Add(a.Image, shp.Size)).ToArray();
}
public Sprite[] LoadAllSprites(string filename) { return cursors[filename]; }
}
}

View File

@@ -26,7 +26,6 @@ namespace OpenRA
public readonly WidgetLoader WidgetLoader;
public ILoadScreen LoadScreen = null;
public SheetBuilder SheetBuilder;
public CursorSheetBuilder CursorSheetBuilder;
public SpriteLoader SpriteLoader;
public HardwarePalette Palette { get; private set; }
IFolder previousMapMount = null;
@@ -59,7 +58,7 @@ namespace OpenRA
ChromeMetrics.Initialize(Manifest.ChromeMetrics);
ChromeProvider.Initialize(Manifest.Chrome);
SheetBuilder = new SheetBuilder(TextureChannel.Red);
CursorSheetBuilder = new CursorSheetBuilder(this);
SpriteLoader = new SpriteLoader(new string[] { ".shp" }, SheetBuilder);
CursorProvider.Initialize(Manifest.Cursors);
Palette.Update(new IPaletteModifier[] { });
}

View File

@@ -112,7 +112,6 @@
<Compile Include="Graphics\Animation.cs" />
<Compile Include="Game.cs" />
<Compile Include="Graphics\CursorSequence.cs" />
<Compile Include="Graphics\CursorSheetBuilder.cs" />
<Compile Include="Graphics\LineRenderer.cs" />
<Compile Include="Graphics\WorldRenderer.cs" />
<Compile Include="Orders\IOrderGenerator.cs" />