merged pchote/master
This commit is contained in:
25
OpenRa.Game/Traits/LightPaletteRotator.cs
Normal file
25
OpenRa.Game/Traits/LightPaletteRotator.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class LightPaletteRotatorInfo : StatelessTraitInfo<LightPaletteRotator> { }
|
||||
class LightPaletteRotator : ITick, IPaletteModifier
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user