]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
new menu QC builtin "stringwidth(string text, float handleColors)", does not do anyth...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Oct 2007 10:59:44 +0000 (10:59 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Oct 2007 10:59:44 +0000 (10:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7654 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c
mvm_cmds.c
prvm_cmds.c
prvm_cmds.h

index f4cab9c58d70d50ba07abda1b21144ca745eb7ef..68b8ecc20ed0f8aabc138a0e527478e44f92ca3e 100644 (file)
@@ -3076,7 +3076,7 @@ VM_drawfill,                                      // #323 float(vector position, vector size, vector rgb, float a
 VM_drawsetcliparea,                            // #324 void(float x, float y, float width, float height) drawsetcliparea
 VM_drawresetcliparea,                  // #325 void(void) drawresetcliparea
 VM_drawcolorcodedstring,               // #326 float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) (EXT_CSQC)
-NULL,                                                  // #327
+NULL,                                                  // #327 // FIXME add stringwidth() here?
 NULL,                                                  // #328
 NULL,                                                  // #329
 VM_CL_getstatf,                                        // #330 float(float stnum) getstatf (EXT_CSQC)
index 69391109c2310f74d8fcd9c9dbcd91c8151166d4..dddf5a184663940c1b10a8e8086655013d5d28a8 100644 (file)
@@ -1228,7 +1228,7 @@ VM_cin_getstate,                  // #464
 VM_cin_restart,                        // #465
 VM_drawline,                           // #466
 VM_drawcolorcodedstring,       // #467
-NULL,                                          // #468
+VM_stringwidth,                                // #468
 NULL,                                          // #469
 NULL,                                          // #470
 VM_asin,                                       // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
index 36cb5dbd56b004db67f3ffe50aa8723943ecae24..1c7f42330487338afd692bd696363af5b07d9011 100644 (file)
@@ -2729,6 +2729,24 @@ void VM_drawcolorcodedstring(void)
 }
 /*
 =========
+VM_stringwidth
+
+float  stringwidth(string text, float allowColorCodes)
+=========
+*/
+void VM_stringwidth(void)
+{
+       const char  *string;
+       int colors;
+       VM_SAFEPARMCOUNT(2,VM_drawstring);
+
+       string = PRVM_G_STRING(OFS_PARM0);
+       colors = (int)PRVM_G_FLOAT(OFS_PARM1);
+
+       PRVM_G_FLOAT(OFS_RETURN) = DrawQ_String(0, 0, string, 0, 1, 1, 0, 0, 0, 0, 0, NULL, !colors); // 1x1 characters, don't actually draw
+}
+/*
+=========
 VM_drawpic
 
 float  drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
index 1efbd2612e8d873bc80799409b89650aa1a16865..fb4837379c712f0cfb303977a48f3b7555026e57 100644 (file)
@@ -134,6 +134,8 @@ string      precache_pic(string pic)
                freepic(string s)
 float  drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag)
 float  drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
+float  drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag)
+float  stringwidth(string text, float handleColors)
 float  drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
 float  drawfill(vector position, vector size, vector rgb, float alpha, float flag)
                drawsetcliparea(float x, float y, float width, float height)
@@ -324,6 +326,7 @@ void VM_freepic(void);
 void VM_drawcharacter(void);
 void VM_drawstring(void);
 void VM_drawcolorcodedstring(void);
+void VM_stringwidth(void);
 void VM_drawpic(void);
 void VM_drawfill(void);
 void VM_drawsetcliparea(void);