diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 9d38df3298..8289d20004 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -210,7 +210,6 @@ - diff --git a/OpenRA.Game/Widgets/ScrollingTextWidget.cs b/OpenRA.Game/Widgets/ScrollingTextWidget.cs deleted file mode 100755 index aa74ab01a5..0000000000 --- a/OpenRA.Game/Widgets/ScrollingTextWidget.cs +++ /dev/null @@ -1,121 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 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 COPYING. - */ -#endregion - -using System; -using System.Drawing; - -namespace OpenRA.Widgets -{ - public class ScrollingTextWidget : Widget - { - public string Text = ""; - string ScrollingText = ""; - - public string Background = null; - - public bool Bold = false; - - public int ScrollLength = 200; - - // ticks per single letter scroll - public int ScrollRate = 4; - - string ScrollBuffer = ""; - - int ScrollLocation = 0; - int ScrollTick = 0; - - public Func GetText; - public Func GetBackground; - - public ScrollingTextWidget() - : base() - { - GetText = () => Text; - GetBackground = () => Background; - } - - protected ScrollingTextWidget(ScrollingTextWidget other) - : base(other) - { - Text = other.Text; - GetText = other.GetText; - Bold = other.Bold; - GetBackground = other.GetBackground; - } - - public override void Tick() - { - if (Text != "") - { - ScrollingText = Text; - Text = ""; - } - UpdateScrollBuffer(); - } - - public void ResetScroll() - { - ScrollLocation = 0; - ScrollTick = 0; - } - - void UpdateScrollBuffer() - { - ScrollTick++; - - if (ScrollTick < ScrollRate) - return; - - ScrollTick = 0; - ScrollBuffer = ""; - - if (ScrollingText.Substring(ScrollingText.Length - 4, 3) != " ") - ScrollingText += " "; - - int tempScrollLocation = ScrollLocation; - for (int i = 0; i < ScrollLength; ++i) - { - ScrollBuffer += ScrollingText.Substring(tempScrollLocation, 1); - tempScrollLocation = (tempScrollLocation + 1) % ScrollingText.Length; - } - - ScrollLocation = (ScrollLocation + 1) % ScrollingText.Length; - } - - public void SetText(string newText) - { - Text = newText.Replace("\n", " "); - Text = Text.Replace("\r", ""); - } - - public override void Draw() - { - var bg = GetBackground(); - - if (bg != null) - WidgetUtils.DrawPanel(bg, RenderBounds); - - var font = (Bold) ? Game.Renderer.Fonts["Bold"] : Game.Renderer.Fonts["Regular"]; - var text = GetText(); - if (text == null) - return; - - int2 textSize = font.Measure(text); - int2 position = RenderOrigin + new int2(0, (Bounds.Height - textSize.Y) / 2); - - Game.Renderer.EnableScissor(position.X, position.Y, Bounds.Width, Bounds.Height); - font.DrawText(ScrollBuffer, position, Color.White); - Game.Renderer.DisableScissor(); - } - - public override Widget Clone() { return new ScrollingTextWidget(this); } - } -}