diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index 8a7c526797..e2189c1172 100755
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -1,4 +1,4 @@
-
+
Debug
@@ -87,6 +87,8 @@
+
+
@@ -264,9 +266,4 @@
-->
-
-
-
-
-
\ No newline at end of file
diff --git a/OpenRA.Game/Widgets/ChatEntryWidget.cs b/OpenRA.Game/Widgets/ChatEntryWidget.cs
new file mode 100644
index 0000000000..dac7ec7fc7
--- /dev/null
+++ b/OpenRA.Game/Widgets/ChatEntryWidget.cs
@@ -0,0 +1,90 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
+ * This file is part of OpenRA.
+ *
+ * OpenRA is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenRA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenRA. If not, see .
+ */
+#endregion
+
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace OpenRA.Widgets
+{
+ // a dirty hack of a widget, which likes to steal the focus when \r is pressed, and then
+ // refuse to give it up until \r is pressed again.
+
+ class ChatEntryWidget : Widget
+ {
+ string content = "";
+ bool composing = true;
+
+ public override void DrawInner(World world)
+ {
+ //if (!composing)
+ // return;
+
+ Game.chrome.renderer.BoldFont.DrawText("Chat:", RenderOrigin + new float2(3, 7), Color.White);
+ Game.chrome.renderer.RegularFont.DrawText(content, RenderOrigin + new float2(40, 7), Color.White);
+
+ Game.chrome.renderer.RgbaSpriteRenderer.Flush();
+ }
+
+ public override bool LoseFocus(MouseInput mi)
+ {
+ return composing ? false : base.LoseFocus(mi);
+ }
+
+ public override bool HandleKeyPress(KeyPressEventArgs e, Modifiers modifiers)
+ {
+ if (e.KeyChar == '\r')
+ {
+ if (composing)
+ {
+ composing = false;
+ if (content != "")
+ Game.IssueOrder(Order.Chat(content));
+ content = "";
+
+ LoseFocus();
+ return true;
+ }
+ else
+ {
+ TakeFocus(new MouseInput());
+ return true;
+ }
+ }
+
+ if (composing)
+ {
+ if (e.KeyChar == '\b' || e.KeyChar == 0x7f)
+ {
+ if (content.Length > 0)
+ content = content.Remove(content.Length - 1);
+ }
+ else if (!char.IsControl(e.KeyChar))
+ {
+ content += e.KeyChar;
+ return true;
+ }
+
+ return false;
+ }
+
+ return base.HandleKeyPress(e, modifiers);
+ }
+ }
+}
diff --git a/OpenRA.Game/Widgets/Delegates/ChatDelegate.cs b/OpenRA.Game/Widgets/Delegates/ChatDelegate.cs
new file mode 100644
index 0000000000..7d96eca3db
--- /dev/null
+++ b/OpenRA.Game/Widgets/Delegates/ChatDelegate.cs
@@ -0,0 +1,33 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
+ * This file is part of OpenRA.
+ *
+ * OpenRA is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenRA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with OpenRA. If not, see .
+ */
+#endregion
+
+namespace OpenRA.Widgets.Delegates
+{
+ public class ChatDelegate : IWidgetDelegate
+ {
+ public ChatDelegate()
+ {
+ var r = Chrome.rootWidget;
+ var chatDisplay = r.GetWidget("INGAME_CHAT_DISPLAY");
+ var chatEntry = r.GetWidget("INGAME_CHAT_ENTRY");
+ Game.AddChatLine += chatDisplay.AddLine;
+ }
+ }
+}
diff --git a/mods/ra/chrome/ingame.yaml b/mods/ra/chrome/ingame.yaml
index ed4fedb066..224bee1e95 100644
--- a/mods/ra/chrome/ingame.yaml
+++ b/mods/ra/chrome/ingame.yaml
@@ -5,6 +5,21 @@ Container@ROOT:
Delegate:IngameChromeDelegate
Visible:false
Children:
+ ChatDisplay@INGAME_CHAT_DISPLAY:
+ Id:INGAME_CHAT_DISPLAY
+ X:220
+ Y:WINDOW_BOTTOM - HEIGHT - 30
+ Width: 760
+ Height: 200
+ Visible: True
+ Delegate: ChatDelegate
+ ChatEntry@INGAME_CHAT_ENTRY:
+ Id:INGAME_CHAT_ENTRY
+ X:220
+ Y:WINDOW_BOTTOM - HEIGHT
+ Width: 760
+ Height: 30
+ Visible: True
PostGame@POSTGAME_TEXT:
Id:POSTGAME_TEXT
X:0