]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_cmds.c
new menu QC builtin "stringwidth(string text, float handleColors)", does not do anyth...
[xonotic/darkplaces.git] / prvm_cmds.c
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)