git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@2049 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
26
OpenRa.Game/Graphics/TreeCache.cs
Normal file
26
OpenRa.Game/Graphics/TreeCache.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class TreeCache
|
||||
{
|
||||
Dictionary<string, Sprite> trees = new Dictionary<string, Sprite>();
|
||||
|
||||
public TreeCache(Map map)
|
||||
{
|
||||
foreach (TreeReference r in map.Trees)
|
||||
{
|
||||
if (trees.ContainsKey(r.Image))
|
||||
continue;
|
||||
|
||||
string filename = r.Image + "." + map.Theater.Substring(0, 3);
|
||||
|
||||
ShpReader reader = new ShpReader( FileSystem.Open( filename ) );
|
||||
trees.Add(r.Image, SheetBuilder.Add(reader[0].Image, reader.Size));
|
||||
}
|
||||
}
|
||||
|
||||
public Sprite GetImage(string tree) { return trees[tree]; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user