r6041 - in trunk/data/qcsrc/menu: . item nexuiz

esteel at icculus.org esteel at icculus.org
Tue Mar 3 13:23:09 EST 2009


Author: esteel
Date: 2009-03-03 13:23:03 -0500 (Tue, 03 Mar 2009)
New Revision: 6041

Added:
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_names.c
Modified:
   trunk/data/qcsrc/menu/classes.c
   trunk/data/qcsrc/menu/item/label.c
   trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
   trunk/data/qcsrc/menu/nexuiz/mainwindow.c
Log:
second part of terencehills patch, colored name preview

Modified: trunk/data/qcsrc/menu/classes.c
===================================================================
--- trunk/data/qcsrc/menu/classes.c	2009-03-03 17:39:59 UTC (rev 6040)
+++ trunk/data/qcsrc/menu/classes.c	2009-03-03 18:23:03 UTC (rev 6041)
@@ -78,3 +78,4 @@
 #include "nexuiz/colorpicker.c"
 #include "nexuiz/cvarlist.c"
 #include "nexuiz/dialog_settings_misc_cvars.c"
+#include "nexuiz/dialog_multiplayer_playersetup_names.c"

Modified: trunk/data/qcsrc/menu/item/label.c
===================================================================
--- trunk/data/qcsrc/menu/item/label.c	2009-03-03 17:39:59 UTC (rev 6040)
+++ trunk/data/qcsrc/menu/item/label.c	2009-03-03 18:23:03 UTC (rev 6041)
@@ -9,6 +9,7 @@
 	ATTRIB(Label, fontSize, float, 8)
 	ATTRIB(Label, align, float, 0.5)
 	ATTRIB(Label, allowCut, float, 0)
+	ATTRIB(Label, allowColors, float, 0)
 	ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
 	ATTRIB(Label, keepspaceRight, float, 0)
 	ATTRIB(Label, marginLeft, float, 0) // alternate way to specify keepspace* (in characters from the font)
@@ -32,7 +33,7 @@
 void setTextLabel(entity me, string txt)
 {
 	me.text = txt;
-	me.realOrigin_x = me.align * (1 - me.keepspaceLeft - me.keepspaceRight - min(me.realFontSize_x * draw_TextWidth(me.text, 0), (1 - me.keepspaceLeft - me.keepspaceRight))) + me.keepspaceLeft;
+	me.realOrigin_x = me.align * (1 - me.keepspaceLeft - me.keepspaceRight - min(me.realFontSize_x * draw_TextWidth(me.text, me.allowColors), (1 - me.keepspaceLeft - me.keepspaceRight))) + me.keepspaceLeft;
 }
 void resizeNotifyLabel(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
@@ -43,7 +44,7 @@
 		me.keepspaceLeft = me.marginLeft * me.realFontSize_x;
 	if(me.marginRight)
 		me.keepspaceRight = me.marginRight * me.realFontSize_x;
-	me.realOrigin_x = me.align * (1 - me.keepspaceLeft - me.keepspaceRight - min(me.realFontSize_x * draw_TextWidth(me.text, 0), (1 - me.keepspaceLeft - me.keepspaceRight))) + me.keepspaceLeft;
+	me.realOrigin_x = me.align * (1 - me.keepspaceLeft - me.keepspaceRight - min(me.realFontSize_x * draw_TextWidth(me.text, me.allowColors), (1 - me.keepspaceLeft - me.keepspaceRight))) + me.keepspaceLeft;
 	me.realOrigin_y = 0.5 * (1 - me.realFontSize_y);
 }
 void configureLabelLabel(entity me, string txt, float sz, float algn)
@@ -71,20 +72,23 @@
 		if(t)
 		{
 			if(me.allowCut) // FIXME allowCut incompatible with align != 0
-				draw_Text(me.realOrigin, draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight) / me.realFontSize_x, 0), me.realFontSize, me.colorL, me.alpha, 0);
+				draw_Text(me.realOrigin, draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight) / me.realFontSize_x, me.allowColors), me.realFontSize, me.colorL, me.alpha, me.allowColors);
 			else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0
 			{
 				getWrappedLine_remaining = t;
 				o = me.realOrigin;
 				while(getWrappedLine_remaining)
 				{
-					t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight) / me.realFontSize_x, draw_TextWidth_WithoutColors);
-					draw_Text(o, t, me.realFontSize, me.colorL, me.alpha, 0);
+					if (me.allowColors)
+						t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight) / me.realFontSize_x, draw_TextWidth_WithColors);
+					else
+						t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight) / me.realFontSize_x, draw_TextWidth_WithoutColors);
+					draw_Text(o, t, me.realFontSize, me.colorL, me.alpha, me.allowColors);
 					o_y += me.realFontSize_y;
 				}
 			}
 			else
-				draw_Text(me.realOrigin, t, me.realFontSize, me.colorL, me.alpha, 0);
+				draw_Text(me.realOrigin, t, me.realFontSize, me.colorL, me.alpha, me.allowColors);
 		}
 }
 #endif

Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2009-03-03 17:39:59 UTC (rev 6040)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup.c	2009-03-03 18:23:03 UTC (rev 6041)
@@ -30,13 +30,19 @@
 }
 void fillNexuizPlayerSettingsTab(entity me)
 {
-	entity e, pms, sl, e0, box;
+	entity e, pms, sl, eName, e0, box;
 	float i, n;
 
 	me.TR(me);
-		me.TD(me, 1, 1, me.playerNameLabel = makeNexuizTextLabel(0, "Player Name:"));
+		me.TD(me, 1, 0.5, me.playerNameLabel = makeNexuizTextLabel(0, "Name:"));
 			me.playerNameLabelAlpha = me.playerNameLabel.alpha;
-		me.TD(me, 1, 2, box = makeNexuizInputBox(1, "_cl_name"));
+		me.TD(me, 1, 2.5, eName = makeNexuizTextLabel(0, string_null));
+			eName.textEntity = main.namesDialog;
+			eName.allowCut = 1;
+			eName.allowColors = 1;
+			eName.alpha = 1;
+	me.TR(me);
+		me.TD(me, 1, 3.0, box = makeNexuizInputBox(1, "_cl_name"));
 			box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
 			box.maxLength = 63;
 	me.TR(me);
@@ -47,7 +53,6 @@
 	me.TR(me);
 	me.TR(me);
 	me.TR(me);
-	me.TR(me);
 		pms = makeNexuizPlayerModelSelector();
 		me.TDempty(me, 0.5);
 		me.TD(me, 1, 0.3, e = makeNexuizButton("<<", '0 0 0'));

Added: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_names.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_names.c	                        (rev 0)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_playersetup_names.c	2009-03-03 18:23:03 UTC (rev 6041)
@@ -0,0 +1,18 @@
+#ifdef INTERFACE
+CLASS(NexuizNamesDialog) EXTENDS(NexuizDialog)
+	METHOD(NexuizNamesDialog, toString, string(entity))
+	ATTRIB(NexuizNamesDialog, title, string, "Favorite Names")
+	ATTRIB(NexuizNamesDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS) // FIXME: replace SKINCOLOR_DIALOG_MUTATORS with something else
+	ATTRIB(NexuizNamesDialog, intendedWidth, float, 0.45)
+	ATTRIB(NexuizNamesDialog, rows, float, 5)
+	ATTRIB(NexuizNamesDialog, columns, float, 6)
+	ATTRIB(NexuizNamesDialog, refilterEntity, entity, NULL)
+ENDCLASS(NexuizNamesDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+string toStringNexuizNamesDialog(entity me)
+{
+	return cvar_string("_cl_name");
+}
+#endif

Modified: trunk/data/qcsrc/menu/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/mainwindow.c	2009-03-03 17:39:59 UTC (rev 6040)
+++ trunk/data/qcsrc/menu/nexuiz/mainwindow.c	2009-03-03 18:23:03 UTC (rev 6041)
@@ -3,6 +3,7 @@
 	METHOD(MainWindow, configureMainWindow, void(entity))
 	ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
 	ATTRIB(MainWindow, weaponsDialog, entity, NULL)
+	ATTRIB(MainWindow, namesDialog, entity, NULL)
 	ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
 	ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
 	ATTRIB(MainWindow, winnerDialog, entity, NULL)
@@ -52,6 +53,10 @@
 	i.configureDialog(i);
 	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+	me.namesDialog = i = spawnNexuizNamesDialog();
+	i.configureDialog(i);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
 	me.radarDialog = i = spawnNexuizRadarDialog();
 	i.configureDialog(i);
 	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);




More information about the nexuiz-commits mailing list