pass world into CheckSync. don't pass world into Widget.DrawInner

This commit is contained in:
Bob
2010-10-11 19:56:28 +13:00
parent ab1e930ba3
commit cb1deacbb2
32 changed files with 83 additions and 79 deletions

View File

@@ -14,7 +14,7 @@ namespace OpenRA.Widgets
{
public readonly string Background = "dialog";
public override void DrawInner(World world)
public override void DrawInner()
{
WidgetUtils.DrawPanel(Background, RenderBounds);
}

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Widgets
return Depressed;
}
public override void DrawInner(World world)
public override void DrawInner()
{
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0);

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Widgets
: base(widget) { }
public override Rectangle EventBounds { get { return Rectangle.Empty; } }
public override void DrawInner(World world)
public override void DrawInner()
{
var pos = RenderOrigin;
var chatLogArea = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Widgets
bool composing = false;
bool teamChat = false;
public override void DrawInner(World world)
public override void DrawInner()
{
if (composing)
{

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Widgets
public bool Bold = false;
public Func<bool> Checked = () => false;
public override void DrawInner(World world)
public override void DrawInner()
{
var font = Bold ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;
var pos = RenderOrigin;

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Widgets
return new ColorBlockWidget(this);
}
public override void DrawInner(World world)
public override void DrawInner()
{
WidgetUtils.FillRectWithColor(RenderBounds, GetColor());
}

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Widgets
public override Widget Clone() { return new ImageWidget(this); }
public override void DrawInner(World world)
public override void DrawInner()
{
var name = GetImageName();
var collection = GetImageCollection();

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Widgets
GetBackground = other.GetBackground;
}
public override void DrawInner(World world)
public override void DrawInner()
{
var bg = GetBackground();

View File

@@ -44,8 +44,8 @@ namespace OpenRA.Widgets
DownPressed = other.DownPressed;
}
public override void DrawInner(World world) {}
public override void Draw(World world)
public override void DrawInner() {}
public override void Draw()
{
if (!IsVisible())
return;
@@ -74,7 +74,7 @@ namespace OpenRA.Widgets
Game.Renderer.EnableScissor(backgroundRect.X, backgroundRect.Y + HeaderHeight, backgroundRect.Width, backgroundRect.Height - HeaderHeight);
foreach (var child in Children)
child.Draw(world);
child.Draw();
Game.Renderer.DisableScissor();
}

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
static Sprite UnownedSpawn = null;
static Sprite OwnedSpawn = null;
public override void DrawInner( World world )
public override void DrawInner()
{
if (UnownedSpawn == null)
UnownedSpawn = ChromeProvider.GetImage("spawnpoints", "unowned");

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Widgets
{
public PerfGraphWidget() : base() { }
public override void DrawInner(World world)
public override void DrawInner()
{
var rect = RenderBounds;
float2 origin = Game.viewport.Location + new float2(rect.Right, rect.Bottom);

View File

@@ -93,7 +93,7 @@ namespace OpenRA.Widgets
Text = Text.Replace("\r", "");
}
public override void DrawInner(World world)
public override void DrawInner()
{
var bg = GetBackground();

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Widgets
Sprite sprite = null;
string cachedImage = null;
int cachedFrame= -1;
public override void DrawInner(World world)
public override void DrawInner()
{
var image = GetImage();
var frame = GetFrame();

View File

@@ -165,7 +165,7 @@ namespace OpenRA.Widgets
}
}
public override void DrawInner(World world)
public override void DrawInner()
{
if (!IsVisible())
return;

View File

@@ -107,7 +107,7 @@ namespace OpenRA.Widgets
base.Tick(world);
}
public override void DrawInner(World world)
public override void DrawInner()
{
int margin = 5;
var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont;

View File

@@ -1,11 +1,11 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Drawing;
@@ -20,13 +20,13 @@ namespace OpenRA.Widgets
public TimerWidget ()
{
IsVisible = () => Game.Settings.Game.MatchTimer;
}
public override void DrawInner(World world)
{
var s = WorldUtils.FormatTime(Game.LocalTick);
var size = Game.Renderer.TitleFont.Measure(s);
Game.Renderer.TitleFont.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White);
}
public override void DrawInner()
{
var s = WorldUtils.FormatTime(Game.LocalTick);
var size = Game.Renderer.TitleFont.Measure(s);
Game.Renderer.TitleFont.DrawText(s, new float2(RenderBounds.Left - size.X / 2, RenderBounds.Top - 20), Color.White);
}
}
}

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Widgets
public ViewportScrollControllerWidget() : base() { }
protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {}
public override void DrawInner( World world ) {}
public override void DrawInner() {}
public override bool HandleInputInner(MouseInput mi)
{

View File

@@ -6,11 +6,11 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System;
using System.Drawing;
using OpenRA.FileFormats;
#endregion
using System;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Support;
@@ -69,8 +69,8 @@ namespace OpenRA.Widgets
overlaySprite.sheet.Texture.SetData(overlay);
}
public override void DrawInner(World world)
{
public override void DrawInner()
{
if (video == null)
return;

View File

@@ -269,15 +269,15 @@ namespace OpenRA.Widgets
return false;
}
public abstract void DrawInner( World world );
public abstract void DrawInner();
public virtual void Draw(World world)
public virtual void Draw()
{
if (IsVisible())
{
DrawInner( world );
DrawInner();
foreach (var child in Children)
child.Draw(world);
child.Draw();
}
}
@@ -344,9 +344,9 @@ namespace OpenRA.Widgets
++Viewport.TicksSinceLastMove;
}
public static void DoDraw(World world)
public static void DoDraw()
{
RootWidget.Draw(world);
RootWidget.Draw();
}
}
@@ -355,7 +355,7 @@ namespace OpenRA.Widgets
public ContainerWidget(Widget other) : base(other) { }
public override void DrawInner( World world ) { }
public override void DrawInner() { }
public override string GetCursor(int2 pos) { return null; }
public override Widget Clone() { return new ContainerWidget(this); }

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Widgets
this.world = world;
}
public override void DrawInner( World world )
public override void DrawInner()
{
var selbox = SelectionBox;
if (selbox == null) return;

View File

@@ -20,8 +20,9 @@ namespace OpenRA.Widgets
{
public int TooltipDelay = 10;
public WorldTooltipWidget() : base() { }
public override void DrawInner(World world)
public override void DrawInner()
{
var world = Game.world;
if (Viewport.TicksSinceLastMove < TooltipDelay || world == null || world.LocalPlayer == null)
return;