r2857 - trunk/data/qcsrc/menu-div0test

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Oct 27 12:25:22 EDT 2007


Author: div0
Date: 2007-10-27 12:25:22 -0400 (Sat, 27 Oct 2007)
New Revision: 2857

Modified:
   trunk/data/qcsrc/menu-div0test/menu.qc
   trunk/data/qcsrc/menu-div0test/menu.qh
Log:
added support for grabbing keys


Modified: trunk/data/qcsrc/menu-div0test/menu.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qc	2007-10-27 16:19:24 UTC (rev 2856)
+++ trunk/data/qcsrc/menu-div0test/menu.qc	2007-10-27 16:25:22 UTC (rev 2857)
@@ -54,15 +54,26 @@
 {
 	if(!Menu_Active)
 		return;
-	draw_reset();
-	if(!main.keyDown(main, key, ascii, shiftState))
-		if(key == K_ESCAPE)
-			if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
-				m_hide(); // disable menu on unhandled ESC
+	if(keyGrabber)
+	{
+		entity e;
+		e = keyGrabber;
+		keyGrabber = NULL;
+		e.keyGrabbed(e, key, ascii);
+	}
+	else
+	{
+		draw_reset();
+		if(!main.keyDown(main, key, ascii, shiftState))
+			if(key == K_ESCAPE)
+				if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
+					m_hide(); // disable menu on unhandled ESC
+		if(key >= K_MOUSE1 && key <= K_MOUSE10)
+			if(!mouseButtonsPressed)
+				main.mousePress(main, mousePos);
+	}
 	if(key >= K_MOUSE1 && key <= K_MOUSE10)
 	{
-		if(!mouseButtonsPressed)
-			main.mousePress(main, mousePos);
 		++mouseButtonsPressed;
 		if(mouseButtonsPressed > 10)
 		{

Modified: trunk/data/qcsrc/menu-div0test/menu.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qh	2007-10-27 16:19:24 UTC (rev 2856)
+++ trunk/data/qcsrc/menu-div0test/menu.qh	2007-10-27 16:25:22 UTC (rev 2857)
@@ -22,3 +22,6 @@
 const float S_ALT = 4;
 
 float frametime;
+
+entity keyGrabber;
+.void(entity me, float key, float ascii) keyGrabbed;




More information about the nexuiz-commits mailing list