Add EmbeddedSpritePalette sprite metadata.

This commit is contained in:
Paul Chote
2018-10-07 17:40:05 +00:00
parent dee6d03626
commit eb61c45e14
4 changed files with 106 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Primitives;
namespace OpenRA.Mods.Common.SpriteLoaders
@@ -68,6 +69,11 @@ namespace OpenRA.Mods.Common.SpriteLoaders
Array.Copy(png.Data, frameStart + y * png.Width, frames[i].Data, y * frames[i].Size.Width, frames[i].Size.Width);
}
metadata = new TypeDictionary
{
new EmbeddedSpritePalette(png.Palette.Select(x => (uint)x.ToArgb()).ToArray())
};
return true;
}