Stub for chat implementation
authorunc0rr
Mon, 19 May 2008 18:07:05 +0000
changeset 942 b41af014d85e
parent 941 b5222ddafe1f
child 943 a0c36a0b3ad9
Stub for chat implementation
hedgewars/CMakeLists.txt
hedgewars/hwengine.dpr
hedgewars/uChat.pas
hedgewars/uWorld.pas
--- a/hedgewars/CMakeLists.txt	Sun May 18 10:54:43 2008 +0000
+++ b/hedgewars/CMakeLists.txt	Mon May 19 18:07:05 2008 +0000
@@ -12,6 +12,7 @@
 	uAIAmmoTests.pas
 	uAIMisc.pas
 	uAmmos.pas
+	uChat.pas
 	uCollisions.pas
 	uConsole.pas
 	uConsts.pas
--- a/hedgewars/hwengine.dpr	Sun May 18 10:54:43 2008 +0000
+++ b/hedgewars/hwengine.dpr	Mon May 19 18:07:05 2008 +0000
@@ -50,7 +50,8 @@
   uAmmos in 'uAmmos.pas',
   uSHA in 'uSHA.pas',
   uFloat in 'uFloat.pas',
-  uStats in 'uStats.pas';
+  uStats in 'uStats.pas',
+  uChat in 'uChat.pas';
 
 {$INCLUDE options.inc}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uChat.pas	Mon May 19 18:07:05 2008 +0000
@@ -0,0 +1,52 @@
+(*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program 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; version 2 of the License
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+unit uChat;
+
+interface
+
+procedure AddChatString(s: shortstring);
+procedure DrawChat;
+
+implementation
+uses uMisc, uStore, uConsts;
+
+const MaxStrIndex = 7;
+
+type TStr = record
+		Time: Longword;
+		Tex: PTexture;
+		end;
+
+var Strs: array[0 .. MaxStrIndex] of TStr;
+	lastStr: Longword = 0;
+
+procedure AddChatString(s: shortstring);
+begin
+lastStr:= (lastStr + 1) mod (MaxStrIndex + 1);
+
+Strs[lastStr].Time:= RealTicks + 7500;
+Strs[lastStr].Tex:= RenderStringTex(s, $FFFFFF, fnt16)
+end;
+
+procedure DrawChat;
+begin
+if Strs[lastStr].Tex <> nil then DrawTexture(10, 10, Strs[lastStr].Tex)
+end;
+
+end.
--- a/hedgewars/uWorld.pas	Sun May 18 10:54:43 2008 +0000
+++ b/hedgewars/uWorld.pas	Mon May 19 18:07:05 2008 +0000
@@ -39,7 +39,7 @@
 
 implementation
 uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, GL,
-     uAmmos, uVisualGears;
+     uAmmos, uVisualGears, uChat;
 const FPS: Longword = 0;
       CountTicks: Longword = 0;
       SoundTimerTicks: Longword = 0;
@@ -333,6 +333,8 @@
 // AmmoMenu
 if (AMxCurr < cScreenWidth) or bShowAmmoMenu then ShowAmmoMenu(Surface);
 
+DrawChat;
+
 // Cursor
 if isCursorVisible then
    begin