non-working palette fail

This commit is contained in:
Paul Chote
2010-08-14 21:07:19 +12:00
parent 5c1408d4d7
commit dda6556e17
7 changed files with 73 additions and 60 deletions

View File

@@ -77,11 +77,20 @@ namespace OpenRA.Graphics
public void Update(IEnumerable<IPaletteModifier> paletteMods)
{
var b = new Bitmap(Bitmap);
foreach (var mod in paletteMods)
mod.AdjustPalette(b);
Texture.SetData(b);
//var b = new Bitmap(Bitmap);
//foreach (var mod in paletteMods)
// mod.AdjustPalette(b);
var data = new uint[256,MaxPalettes];
foreach (var pal in palettes)
{
var j = indices[pal.Key];
var c = pal.Value.Values;
for (var i = 0; i < 256; i++)
data[i,j] = c[i];
}
Texture.SetData(data);
Game.Renderer.PaletteTexture = Texture;
}
}

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Widgets
string cachedVideo;
float invLength;
float2 videoOrigin, videoSize;
int[,] overlay;
uint[,] overlay;
bool stopped;
bool paused;
@@ -56,8 +56,8 @@ namespace OpenRA.Widgets
if (!DrawOverlay)
return;
overlay = new int[2*textureSize, 2*textureSize];
var black = Color.Black.ToArgb();
overlay = new uint[2*textureSize, 2*textureSize];
uint black = (uint)255 << 24;
for (var y = 0; y < video.Height; y++)
for (var x = 0; x < video.Width; x++)
overlay[2*y,x] = black;