eliminate public CursorProvider.Palettes

don't hand over the cursor palette to the world renderer at all
still update worldrender palette (set and apply modifiers)
This commit is contained in:
Matthias Mailänder
2013-03-24 22:02:45 +01:00
parent ba12aafd78
commit 851512a84e
2 changed files with 7 additions and 5 deletions

View File

@@ -20,7 +20,6 @@ namespace OpenRA.Graphics
{ {
public static class CursorProvider public static class CursorProvider
{ {
public static Dictionary<string, Palette> Palettes { get; private set; }
public static HardwarePalette Palette; public static HardwarePalette Palette;
static Dictionary<string, CursorSequence> cursors; static Dictionary<string, CursorSequence> cursors;
@@ -36,12 +35,12 @@ namespace OpenRA.Graphics
ShadowIndex[ShadowIndex.Length - 1] = Convert.ToInt32(sequences.NodesDict["ShadowIndex"].Value); ShadowIndex[ShadowIndex.Length - 1] = Convert.ToInt32(sequences.NodesDict["ShadowIndex"].Value);
} }
Palettes = new Dictionary<string, Palette>(); var palettes = new Dictionary<string, Palette>();
foreach (var s in sequences.NodesDict["Palettes"].Nodes) foreach (var s in sequences.NodesDict["Palettes"].Nodes)
Palettes.Add(s.Key, new Palette(FileSystem.Open(s.Value.Value), ShadowIndex)); palettes.Add(s.Key, new Palette(FileSystem.Open(s.Value.Value), ShadowIndex));
Palette = new HardwarePalette(); Palette = new HardwarePalette();
foreach (var p in CursorProvider.Palettes) foreach (var p in palettes)
Palette.AddPalette(p.Key, p.Value, false); Palette.AddPalette(p.Key, p.Value, false);
// Generate initial palette texture // Generate initial palette texture

View File

@@ -41,12 +41,15 @@ namespace OpenRA.Graphics
internal WorldRenderer(World world) internal WorldRenderer(World world)
{ {
this.world = world; this.world = world;
palette = CursorProvider.Palette; palette = new HardwarePalette();
palettes = new Cache<string, PaletteReference>(CreatePaletteReference); palettes = new Cache<string, PaletteReference>(CreatePaletteReference);
foreach (var pal in world.traitDict.ActorsWithTraitMultiple<IPalette>(world)) foreach (var pal in world.traitDict.ActorsWithTraitMultiple<IPalette>(world))
pal.Trait.InitPalette( this ); pal.Trait.InitPalette( this );
// Generate initial palette texture
palette.Update(new IPaletteModifier[] {});
terrainRenderer = new TerrainRenderer(world, this); terrainRenderer = new TerrainRenderer(world, this);
shroudRenderer = new ShroudRenderer(world); shroudRenderer = new ShroudRenderer(world);
} }