water palette done that way
This commit is contained in:
@@ -74,6 +74,10 @@ namespace OpenRa.Game
|
|||||||
Game.world.Add(a);
|
Game.world.Add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var worldActor = new Actor(null, new int2(int.MaxValue, int.MaxValue), null);
|
||||||
|
worldActor.traits.Add(new Traits.WaterPaletteRotation(worldActor));
|
||||||
|
Game.world.Add(worldActor);
|
||||||
|
|
||||||
Rules.Map.InitOreDensity();
|
Rules.Map.InitOreDensity();
|
||||||
worldRenderer = new WorldRenderer(renderer);
|
worldRenderer = new WorldRenderer(renderer);
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,7 @@
|
|||||||
<Compile Include="Traits\Tree.cs" />
|
<Compile Include="Traits\Tree.cs" />
|
||||||
<Compile Include="Traits\Turreted.cs" />
|
<Compile Include="Traits\Turreted.cs" />
|
||||||
<Compile Include="Traits\Unit.cs" />
|
<Compile Include="Traits\Unit.cs" />
|
||||||
|
<Compile Include="Traits\WaterPaletteRotation.cs" />
|
||||||
<Compile Include="Traits\WithShadow.cs" />
|
<Compile Include="Traits\WithShadow.cs" />
|
||||||
<Compile Include="UnitOrders.cs" />
|
<Compile Include="UnitOrders.cs" />
|
||||||
<Compile Include="Traits\Util.cs" />
|
<Compile Include="Traits\Util.cs" />
|
||||||
|
|||||||
28
OpenRa.Game/Traits/WaterPaletteRotation.cs
Normal file
28
OpenRa.Game/Traits/WaterPaletteRotation.cs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user