moved Game.palette into WorldRenderer

This commit is contained in:
Bob
2010-01-21 12:31:44 +13:00
parent d07b782044
commit d7be2b0dd3
4 changed files with 19 additions and 17 deletions

View File

@@ -28,7 +28,6 @@ namespace OpenRa
internal static Renderer renderer;
static int2 clientSize;
static HardwarePalette palette;
static string mapName;
internal static Session LobbyInfo = new Session();
static bool changePending;
@@ -57,8 +56,6 @@ namespace OpenRa
a.Owner.Shroud.Explore(a);
};
palette = new HardwarePalette(renderer, world.Map);
SequenceProvider.Initialize(manifest.Sequences);
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
@@ -147,8 +144,6 @@ namespace OpenRa
using (new PerfSample("render"))
{
UpdatePalette(world.Actors.SelectMany(
a => a.traits.WithInterface<IPaletteModifier>()));
++RenderFrame;
viewport.DrawRegions();
}
@@ -157,16 +152,6 @@ namespace OpenRa
PerfHistory.items["batches"].Tick();
}
static void UpdatePalette(IEnumerable<IPaletteModifier> paletteMods)
{
var b = new Bitmap(palette.Bitmap);
foreach (var mod in paletteMods)
mod.AdjustPalette(b);
palette.Texture.SetData(b);
renderer.PaletteTexture = palette.Texture;
}
public static Random SharedRandom = new Random(0); /* for things that require sync */
public static Random CosmeticRandom = new Random(); /* for things that are just fluff */