Don't hard-code the transparent background color.
This commit is contained in:
committed by
Paul Chote
parent
1bf01bc214
commit
1d2d8ed107
@@ -22,6 +22,9 @@ namespace OpenRA.Traits
|
|||||||
[Desc("The prefix for the resulting player palettes")]
|
[Desc("The prefix for the resulting player palettes")]
|
||||||
public readonly string BaseName = "highlight";
|
public readonly string BaseName = "highlight";
|
||||||
|
|
||||||
|
[Desc("Index set to be fully transparent/invisible.")]
|
||||||
|
public readonly int TransparentIndex = 0;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
|
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ namespace OpenRA.Traits
|
|||||||
public void LoadPlayerPalettes(WorldRenderer wr, string playerName, Color color, bool replaceExisting)
|
public void LoadPlayerPalettes(WorldRenderer wr, string playerName, Color color, bool replaceExisting)
|
||||||
{
|
{
|
||||||
var argb = (uint)Color.FromArgb(128, color).ToArgb();
|
var argb = (uint)Color.FromArgb(128, color).ToArgb();
|
||||||
var pal = new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => i == 0 ? 0 : argb));
|
var pal = new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => i == info.TransparentIndex ? 0 : argb));
|
||||||
wr.AddPalette(info.BaseName + playerName, pal, false, replaceExisting);
|
wr.AddPalette(info.BaseName + playerName, pal, false, replaceExisting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user