pass worldRenderer around as necessary

This commit is contained in:
Bob
2010-10-11 19:42:07 +13:00
parent 10bf85f57e
commit ab1e930ba3
34 changed files with 116 additions and 118 deletions

View File

@@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.Orders
{
@@ -43,8 +44,8 @@ namespace OpenRA.Orders
}
public virtual void Tick(World world) { }
public void RenderAfterWorld(World world) { }
public void RenderBeforeWorld(World world) { }
public void RenderAfterWorld(WorldRenderer wr, World world) { }
public void RenderBeforeWorld(WorldRenderer wr, World world) { }
public string GetCursor(World world, int2 xy, MouseInput mi) { return world.Map.IsInMap(xy) ? cursor : "generic-blocked"; }
}

View File

@@ -9,6 +9,7 @@
#endregion
using System.Collections.Generic;
using OpenRA.Graphics;
namespace OpenRA
{
@@ -16,8 +17,8 @@ namespace OpenRA
{
IEnumerable<Order> Order(World world, int2 xy, MouseInput mi);
void Tick(World world);
void RenderBeforeWorld(World world);
void RenderAfterWorld(World world);
void RenderBeforeWorld(WorldRenderer wr, World world);
void RenderAfterWorld(WorldRenderer wr, World world);
string GetCursor(World world, int2 xy, MouseInput mi);
}
}

View File

@@ -6,13 +6,12 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;
using OpenRA.FileFormats;
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Orders
{
@@ -41,22 +40,22 @@ namespace OpenRA.Orders
public void Tick( World world ) {}
public void RenderBeforeWorld(World world)
public void RenderBeforeWorld( WorldRenderer wr, World world )
{
foreach (var a in world.Selection.Actors)
if (!a.Destroyed)
foreach (var t in a.TraitsImplementing<IPreRenderSelection>())
t.RenderBeforeWorld(a);
t.RenderBeforeWorld( wr, a );
Game.Renderer.Flush();
}
public void RenderAfterWorld( World world )
public void RenderAfterWorld( WorldRenderer wr, World world )
{
foreach (var a in world.Selection.Actors)
if (!a.Destroyed)
foreach (var t in a.TraitsImplementing<IPostRenderSelection>())
t.RenderAfterWorld(a);
t.RenderAfterWorld( wr, a );
Game.Renderer.Flush();
}