r3067 - in trunk/data/qcsrc/menu-div0test: . item nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Jan 1 06:04:41 EST 2008


Author: div0
Date: 2008-01-01 06:04:39 -0500 (Tue, 01 Jan 2008)
New Revision: 3067

Modified:
   trunk/data/qcsrc/menu-div0test/item/nexposee.c
   trunk/data/qcsrc/menu-div0test/menu.qc
   trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
   trunk/data/qcsrc/menu-div0test/skin.qh
Log:
background image support; align "quit" to the bottom of the screen


Modified: trunk/data/qcsrc/menu-div0test/item/nexposee.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/nexposee.c	2007-12-31 13:38:56 UTC (rev 3066)
+++ trunk/data/qcsrc/menu-div0test/item/nexposee.c	2008-01-01 11:04:39 UTC (rev 3067)
@@ -19,6 +19,7 @@
 	METHOD(Nexposee, calc, void(entity))
 	METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float))
 	ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
+	METHOD(Nexposee, pullNexposee, void(entity, entity, vector))
 ENDCLASS(Nexposee)
 
 void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the current state
@@ -42,6 +43,7 @@
 .float Nexposee_smallAlpha;
 .float Nexposee_mediumAlpha;
 .vector Nexposee_scaleCenter;
+.vector Nexposee_align;
 
 void closeNexposee(entity me)
 {
@@ -60,6 +62,24 @@
 	me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize);
 }
 
+void Nexposee_Calc_Scale(entity me, float scale)
+{
+	entity e;
+	for(e = me.firstChild; e; e = e.nextSibling)
+	{
+		e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
+		e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
+		if(e.Nexposee_align_x > 0)
+			e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align_x * scale;
+		if(e.Nexposee_align_x < 0)
+			e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize_x + e.Nexposee_align_x * scale;
+		if(e.Nexposee_align_y > 0)
+			e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align_y * scale;
+		if(e.Nexposee_align_y < 0)
+			e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize_y + e.Nexposee_align_y * scale;
+	}
+}
+
 void calcNexposee(entity me)
 {
 	/*
@@ -72,11 +92,7 @@
 	
 	for(scale = 0.7;; scale *= 0.99)
 	{
-		for(e = me.firstChild; e; e = e.nextSibling)
-		{
-			e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
-			e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
-		}
+		Nexposee_Calc_Scale(me, scale);
 
 		for(e = me.firstChild; e; e = e.nextSibling)
 		{
@@ -105,11 +121,8 @@
 	}
 
 	scale *= 0.95;
-	for(e = me.firstChild; e; e = e.nextSibling)
-	{
-		e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
-		e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
-	}
+
+	Nexposee_Calc_Scale(me, scale);
 }
 
 void setNexposeeNexposee(entity me, entity other, vector scalecenter, float a0, float a1)
@@ -347,4 +360,9 @@
 	if(me.animationState == 2)
 		setFocusContainer(me, me.selectedChild);
 }
+
+void pullNexposeeNexposee(entity me, entity other, vector theAlign)
+{
+	other.Nexposee_align = theAlign;
+}
 #endif

Modified: trunk/data/qcsrc/menu-div0test/menu.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qc	2007-12-31 13:38:56 UTC (rev 3066)
+++ trunk/data/qcsrc/menu-div0test/menu.qc	2008-01-01 11:04:39 UTC (rev 3067)
@@ -166,6 +166,29 @@
 	draw_reset();
 	draw_alpha *= menuAlpha;
 
+	if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
+	{
+		vector sz;
+		vector isz;
+		sz = draw_PictureSize(SKINGFX_BACKGROUND);
+		// keep aspect of image
+		if(sz_x * draw_scale_y >= sz_y * draw_scale_x)
+		{
+			// that is, sz_x/sz_y >= draw_scale_x/draw_scale_y
+			// match up the height
+			isz_y = 1;
+			isz_x = isz_y * (sz_x / sz_y) * (draw_scale_y / draw_scale_x);
+		}
+		else
+		{
+			// that is, sz_x/sz_y <= draw_scale_x/draw_scale_y
+			// match up the width
+			isz_x = 1;
+			isz_y = isz_x * (sz_y / sz_x) * (draw_scale_x / draw_scale_y);
+		}
+		draw_Picture('0.5 0.5 0' - 0.5 * isz, SKINGFX_BACKGROUND, isz, '1 1 1', 1);
+	}
+
 	if(frametime > 0)
 	{
 		vector dMouse;

Modified: trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c	2007-12-31 13:38:56 UTC (rev 3066)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c	2008-01-01 11:04:39 UTC (rev 3067)
@@ -23,44 +23,45 @@
 
 	i = spawnNexuizTeamSelectDialog();
 	i.configureDialog(i);
-	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
 	me.mutatorsDialog = i = spawnNexuizMutatorsDialog();
 	i.configureDialog(i);
-	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
 	me.mapInfoDialog = i = spawnNexuizMapInfoDialog();
 	i.configureDialog(i);
-	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
 	me.userbindEditDialog = i = spawnNexuizUserbindEditDialog();
 	i.configureDialog(i);
-	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+	me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
 	n = spawnNexuizNexposee();
 		if(checkextension("DP_GECKO_SUPPORT"))
 		{
 			i = spawnNexuizNewsDialog();
 			i.configureDialog(i);
-			n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
-			n.setNexposee(n, i, '0.1 0.1 0', 0.5, 0.8);
+			n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+			n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
 		}
 		
 		i = spawnNexuizSettingsDialog();
 		i.configureDialog(i);
-		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
-		n.setNexposee(n, i, '0.1 0.9 0', 0.5, 0.8);
+		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+		n.setNexposee(n, i, '0.1 0.9 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
 
 		i = spawnNexuizMultiplayerDialog();
 		i.configureDialog(i);
-		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
-		n.setNexposee(n, i, '0.9 0.5 0', 0.5, 0.8);
+		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+		n.setNexposee(n, i, '0.9 0.5 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
 
 		i = spawnNexuizQuitDialog();
 		i.configureDialog(i);
-		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
-		n.setNexposee(n, i, '0.9 1.2 0', 0.5, 0.8);
-	me.addItem(me, n, '0 0 0', '1 1 0', 1);
+		n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+		n.setNexposee(n, i, '0.9 1.2 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+		n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / cvar("vid_conheight")));
+	me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
 	me.moveItemAfter(me, n, NULL);
 
 	me.initializeDialog(me, n);

Modified: trunk/data/qcsrc/menu-div0test/skin.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/skin.qh	2007-12-31 13:38:56 UTC (rev 3066)
+++ trunk/data/qcsrc/menu-div0test/skin.qh	2008-01-01 11:04:39 UTC (rev 3067)
@@ -77,3 +77,7 @@
 
 const string SKINGFX_CHARMAP = "charmap";
 const string SKINGFX_CHARMAP_SELECTED = "charmapbutton";
+
+const string SKINGFX_BACKGROUND = "background";
+
+const vector SKINALPHAS_MAINMENU = '0.5 0.8 0.95';




More information about the nexuiz-commits mailing list