refactor cursor rendering

create a new cursor palette only once and not in WorldRenderer
move cusrsor sequence lookup and drawing to CursorProvider
This commit is contained in:
Matthias Mailänder
2013-03-24 21:21:30 +01:00
parent 227a7a61eb
commit ba12aafd78
3 changed files with 23 additions and 17 deletions

View File

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