Introduce ActorPreviewWidget.

This commit is contained in:
Paul Chote
2014-07-20 23:27:23 +12:00
committed by Paul Chote
parent db1a27b071
commit 268ca94dc1
5 changed files with 139 additions and 0 deletions

View File

@@ -502,6 +502,10 @@ namespace OpenRA
using (new PerfSample("render_widgets"))
{
Game.Renderer.WorldVoxelRenderer.BeginFrame();
Ui.PrepareRenderables();
Game.Renderer.WorldVoxelRenderer.EndFrame();
Ui.Draw();
if (ModData != null && ModData.CursorProvider != null)

View File

@@ -108,7 +108,11 @@ namespace OpenRA.Graphics
public void BeginFrame(int2 scroll, float zoom)
{
Device.Clear();
SetViewportParams(scroll, zoom);
}
public void SetViewportParams(int2 scroll, float zoom)
{
var resolutionChanged = lastResolution != Resolution;
if (resolutionChanged)
{

View File

@@ -72,6 +72,8 @@ namespace OpenRA.Widgets
public static void Tick() { Root.TickOuter(); }
public static void PrepareRenderables() { Root.PrepareRenderablesOuter(); }
public static void Draw() { Root.DrawOuter(); }
public static bool HandleInput(MouseInput mi)
@@ -387,6 +389,18 @@ namespace OpenRA.Widgets
return handled;
}
public virtual void PrepareRenderables() { }
public virtual void PrepareRenderablesOuter()
{
if (IsVisible())
{
PrepareRenderables();
foreach (var child in Children)
child.PrepareRenderablesOuter();
}
}
public virtual void Draw() { }
public virtual void DrawOuter()