Overlay rendering
- also, sequences for HBOX and PBOX
This commit is contained in:
@@ -5,16 +5,24 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class SpriteSheetBuilder
|
||||
{
|
||||
static Dictionary<string, Sprite> sprites =
|
||||
new Dictionary<string, Sprite>();
|
||||
static Dictionary<string, Sprite[]> sprites =
|
||||
new Dictionary<string, Sprite[]>();
|
||||
|
||||
public static Sprite LoadSprite(string filename)
|
||||
public static Sprite LoadSprite(string filename, params string[] exts )
|
||||
{
|
||||
Sprite value;
|
||||
if (!sprites.TryGetValue(filename, out value))
|
||||
return LoadAllSprites( filename, exts )[ 0 ];
|
||||
}
|
||||
|
||||
public static Sprite[] LoadAllSprites( string filename, params string[] exts )
|
||||
{
|
||||
Sprite[] value;
|
||||
if( !sprites.TryGetValue( filename, out value ) )
|
||||
{
|
||||
ShpReader shp = new ShpReader(FileSystem.Open(filename));
|
||||
sprites.Add(filename, value = SheetBuilder.Add(shp[0].Image, shp.Size));
|
||||
ShpReader shp = new ShpReader( FileSystem.OpenWithExts( filename, exts ) );
|
||||
value = new Sprite[ shp.ImageCount ];
|
||||
for( int i = 0 ; i < shp.ImageCount ; i++ )
|
||||
value[ i ] = SheetBuilder.Add( shp[ i ].Image, shp.Size );
|
||||
sprites.Add( filename, value );
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user