From: terencehill Date: Sun, 14 Aug 2011 16:43:53 +0000 (+0200) Subject: Show zoom value with max 2 decimal digits X-Git-Tag: xonotic-v0.8.0~139^2~1^2~155^2~25 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f886c9df112ecd6d8781bca41370e65a1eeb14e0;p=xonotic%2Fxonotic-data.pk3dir.git Show zoom value with max 2 decimal digits --- diff --git a/qcsrc/menu/xonotic/screenshotimage.c b/qcsrc/menu/xonotic/screenshotimage.c index 537a8a5e1..1a5561d4c 100644 --- a/qcsrc/menu/xonotic/screenshotimage.c +++ b/qcsrc/menu/xonotic/screenshotimage.c @@ -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); } } }