]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show zoom value with max 2 decimal digits
authorterencehill <piuntn@gmail.com>
Sun, 14 Aug 2011 16:43:53 +0000 (18:43 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 14 Aug 2011 16:43:53 +0000 (18:43 +0200)
qcsrc/menu/xonotic/screenshotimage.c

index 537a8a5e140123bc335bb76caaa4ae3efa9d5235..1a5561d4cd5102263c4211621bb9fb75bae7fcc3 100644 (file)
@@ -64,8 +64,15 @@ void XonoticScreenshotImage_draw(entity me)
                }
                if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
                {
+                       string zoomString;
+                       float z;
+                       z = me.zoomFactor * 100;
+                       if (z - floor(z) == 0)
+                               zoomString = sprintf("%d%%", z);
+                       else
+                               zoomString = sprintf("%.2f%%", z);
                        theAlpha = (2 - (time - me.zoomTime));
-                       draw_Text('0.05 0.95 0', strcat(ftos(me.zoomFactor * 100), "%"), me.realFontSize, '1 1 1', theAlpha, FALSE);
+                       draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, FALSE);
                }
        }
 }