move Game.worldRenderer into World
This commit is contained in:
@@ -170,7 +170,7 @@ namespace OpenRa
|
|||||||
new int2(140, 15), Color.White);
|
new int2(140, 15), Color.White);
|
||||||
|
|
||||||
if (Game.Settings.PerfGraph)
|
if (Game.Settings.PerfGraph)
|
||||||
PerfHistory.Render(renderer, Game.worldRenderer.lineRenderer);
|
PerfHistory.Render(renderer, Game.world.WorldRenderer.lineRenderer);
|
||||||
|
|
||||||
DrawRadar();
|
DrawRadar();
|
||||||
DrawPower();
|
DrawPower();
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace OpenRa
|
|||||||
public static World world;
|
public static World world;
|
||||||
internal static Viewport viewport;
|
internal static Viewport viewport;
|
||||||
public static PathFinder PathFinder;
|
public static PathFinder PathFinder;
|
||||||
public static WorldRenderer worldRenderer;
|
|
||||||
public static Controller controller;
|
public static Controller controller;
|
||||||
internal static Chrome chrome;
|
internal static Chrome chrome;
|
||||||
public static UserSettings Settings;
|
public static UserSettings Settings;
|
||||||
@@ -43,7 +42,7 @@ namespace OpenRa
|
|||||||
|
|
||||||
public static bool skipMakeAnims = true;
|
public static bool skipMakeAnims = true;
|
||||||
|
|
||||||
static Renderer renderer;
|
internal static Renderer renderer;
|
||||||
static bool usingAftermath;
|
static bool usingAftermath;
|
||||||
static int2 clientSize;
|
static int2 clientSize;
|
||||||
static HardwarePalette palette;
|
static HardwarePalette palette;
|
||||||
@@ -79,8 +78,6 @@ namespace OpenRa
|
|||||||
players[i] = new Player(i, LobbyInfo.Clients.FirstOrDefault(a => a.Index == i));
|
players[i] = new Player(i, LobbyInfo.Clients.FirstOrDefault(a => a.Index == i));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldRenderer = new WorldRenderer(renderer);
|
|
||||||
|
|
||||||
SequenceProvider.Initialize(usingAftermath);
|
SequenceProvider.Initialize(usingAftermath);
|
||||||
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ namespace OpenRa.Graphics
|
|||||||
Map map;
|
Map map;
|
||||||
OverlayRenderer overlayRenderer;
|
OverlayRenderer overlayRenderer;
|
||||||
|
|
||||||
public TerrainRenderer(Renderer renderer, Map map)
|
public TerrainRenderer(World world, Renderer renderer)
|
||||||
{
|
{
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.map = map;
|
this.map = world.Map;
|
||||||
|
|
||||||
Size tileSize = new Size( Game.CellSize, Game.CellSize );
|
Size tileSize = new Size( Game.CellSize, Game.CellSize );
|
||||||
|
|
||||||
var tileMapping = new Cache<TileReference, Sprite>(
|
var tileMapping = new Cache<TileReference, Sprite>(
|
||||||
x => SheetBuilder.Add(Game.world.TileSet.GetBytes(x), tileSize));
|
x => SheetBuilder.Add(world.TileSet.GetBytes(x), tileSize));
|
||||||
|
|
||||||
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
||||||
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRa.Graphics
|
|||||||
|
|
||||||
renderer.BeginFrame(r1, r2, scrollPosition);
|
renderer.BeginFrame(r1, r2, scrollPosition);
|
||||||
|
|
||||||
Game.worldRenderer.Draw();
|
Game.world.WorldRenderer.Draw();
|
||||||
Game.chrome.Draw();
|
Game.chrome.Draw();
|
||||||
|
|
||||||
var c = Game.chrome.HitTest(mousePos) ? Cursor.Default : Game.controller.ChooseCursor();
|
var c = Game.chrome.HitTest(mousePos) ? Cursor.Default : Game.controller.ChooseCursor();
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ namespace OpenRa.Graphics
|
|||||||
|
|
||||||
public static bool ShowUnitPaths = false;
|
public static bool ShowUnitPaths = false;
|
||||||
|
|
||||||
internal WorldRenderer(Renderer renderer)
|
internal WorldRenderer(World world, Renderer renderer)
|
||||||
{
|
{
|
||||||
terrainRenderer = new TerrainRenderer(renderer, Game.world.Map);
|
terrainRenderer = new TerrainRenderer(world, renderer);
|
||||||
|
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
spriteRenderer = new SpriteRenderer(renderer, true);
|
spriteRenderer = new SpriteRenderer(renderer, true);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRa.Orders
|
|||||||
public void Tick() {}
|
public void Tick() {}
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
Game.worldRenderer.DrawSelectionBox(self, Color.White, true);
|
Game.world.WorldRenderer.DrawSelectionBox(self, Color.White, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor GetCursor(int2 xy, MouseInput mi)
|
public Cursor GetCursor(int2 xy, MouseInput mi)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRa.Orders
|
|||||||
|
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
Game.worldRenderer.uiOverlay.DrawBuildingGrid( Building, BuildingInfo );
|
Game.world.WorldRenderer.uiOverlay.DrawBuildingGrid( Building, BuildingInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor GetCursor(int2 xy, MouseInput mi)
|
public Cursor GetCursor(int2 xy, MouseInput mi)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRa.Orders
|
|||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
foreach( var a in selection )
|
foreach( var a in selection )
|
||||||
Game.worldRenderer.DrawSelectionBox( a, Color.White, true );
|
Game.world.WorldRenderer.DrawSelectionBox( a, Color.White, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor GetCursor(int2 xy, MouseInput mi)
|
public Cursor GetCursor(int2 xy, MouseInput mi)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using OpenRa.Effects;
|
using OpenRa.Effects;
|
||||||
using OpenRa.Support;
|
using OpenRa.Support;
|
||||||
using OpenRa.FileFormats;
|
using OpenRa.FileFormats;
|
||||||
|
using OpenRa.Graphics;
|
||||||
|
|
||||||
namespace OpenRa
|
namespace OpenRa
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,8 @@ namespace OpenRa
|
|||||||
public readonly Map Map;
|
public readonly Map Map;
|
||||||
public readonly TileSet TileSet;
|
public readonly TileSet TileSet;
|
||||||
|
|
||||||
|
public readonly WorldRenderer WorldRenderer;
|
||||||
|
|
||||||
readonly int oreFrequency;
|
readonly int oreFrequency;
|
||||||
int oreTicks;
|
int oreTicks;
|
||||||
|
|
||||||
@@ -35,6 +38,8 @@ namespace OpenRa
|
|||||||
Map.InitOreDensity();
|
Map.InitOreDensity();
|
||||||
|
|
||||||
CreateActor("World", new int2(int.MaxValue, int.MaxValue), null);
|
CreateActor("World", new int2(int.MaxValue, int.MaxValue), null);
|
||||||
|
|
||||||
|
WorldRenderer = new WorldRenderer(this, Game.renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor CreateActor( string name, int2 location, Player owner )
|
public Actor CreateActor( string name, int2 location, Player owner )
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRa.Mods.Aftermath.Orders
|
|||||||
public void Tick() { }
|
public void Tick() { }
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
Game.worldRenderer.DrawSelectionBox(self, Color.White, true);
|
Game.world.WorldRenderer.DrawSelectionBox(self, Color.White, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor GetCursor(int2 xy, MouseInput mi)
|
public Cursor GetCursor(int2 xy, MouseInput mi)
|
||||||
|
|||||||
Reference in New Issue
Block a user