git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@2049 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
34
OpenRa.Game/Graphics/HardwarePalette.cs
Normal file
34
OpenRa.Game/Graphics/HardwarePalette.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Ijw.DirectX;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using OpenRa.FileFormats;
|
||||
|
||||
namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class HardwarePalette : Sheet
|
||||
{
|
||||
const int maxEntries = 16;
|
||||
int allocated = 0;
|
||||
|
||||
public HardwarePalette(Renderer renderer, Map map)
|
||||
: base(renderer,new Size(256, maxEntries))
|
||||
{
|
||||
Palette pal = new Palette(FileSystem.Open(map.Theater + ".pal"));
|
||||
AddPalette(pal);
|
||||
|
||||
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
|
||||
AddPalette(new Palette(pal, new PaletteRemap(FileSystem.Open(remap + ".rem"))));
|
||||
}
|
||||
|
||||
int AddPalette(Palette p)
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
this[new Point(i, allocated)] = p.GetColor(i);
|
||||
|
||||
return allocated++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user