Files
OpenRA/OpenRa.Game/Traits/LightPaletteRotator.cs
2010-01-11 22:35:48 +13:00

27 lines
510 B
C#

using System.Drawing;
namespace OpenRa.Game.Traits
{
class LightPaletteRotator : ITick, IPaletteModifier
{
public LightPaletteRotator(Actor self) { }
float t = 0;
public void Tick(Actor self)
{
t += .5f;
}
public void AdjustPalette(Bitmap b)
{
var rotate = (int)t % 18;
if (rotate > 9)
rotate = 18 - rotate;
using (var bitmapCopy = new Bitmap(b))
for (int j = 0; j < 16; j++)
b.SetPixel(0x67, j, b.GetPixel(230+rotate, j));
}
}
}