water palette done that way

This commit is contained in:
Chris Forbes
2009-12-23 21:08:29 +13:00
parent e4f8c28990
commit af715b4a5e
3 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace OpenRa.Game.Traits
{
class WaterPaletteRotation : ITick, IPaletteModifier
{
public WaterPaletteRotation(Actor self) { }
float t = 0;
public void Tick(Actor self)
{
t += .25f;
}
public void AdjustPalette(Bitmap b)
{
var rotate = (int)t % 7;
using (var bitmapCopy = new Bitmap(b))
for (int j = 0; j < 16; j++)
for (int i = 0; i < 7; i++)
b.SetPixel(0x60 + (rotate + i) % 7, j, bitmapCopy.GetPixel(0x60 + i, j));
}
}
}