Support 32 bit png sprites.

This commit is contained in:
Paul Chote
2019-08-05 22:40:25 +01:00
committed by abcdefg30
parent 1111ce4754
commit 522861e484
2 changed files with 14 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
@@ -47,6 +48,10 @@ namespace OpenRA.Mods.Common.Traits
ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem)
{
var png = new Png(fileSystem.Open(Filename));
if (png.Palette == null)
throw new InvalidOperationException("Unable to load palette `{0}` from non-paletted png `{1}`".F(Name, Filename));
var colors = new uint[Palette.Size];
for (var i = 0; i < png.Palette.Length; i++)