From f886c9df112ecd6d8781bca41370e65a1eeb14e0 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 14 Aug 2011 18:43:53 +0200 Subject: [PATCH] Show zoom value with max 2 decimal digits --- qcsrc/menu/xonotic/screenshotimage.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); } } } -- 2.39.2