aboutsummaryrefslogtreecommitdiff
path: root/src/gui/profilergraph.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 22:12:00 +0200
commit21df26984da91143c15587f5a03c98d68c3adc4e (patch)
treeaaa707a628ad331f67890023dffe1b4f60dd01d3 /src/gui/profilergraph.cpp
parentb09fc5de5cdb021f43ad32b7e3f50dc75c0bc622 (diff)
parenteabf05758e3ba5f6f4bb1b8d1d1f02179b84e410 (diff)
downloaddragonfireclient-21df26984da91143c15587f5a03c98d68c3adc4e.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'src/gui/profilergraph.cpp')
-rw-r--r--src/gui/profilergraph.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/profilergraph.cpp b/src/gui/profilergraph.cpp
index b29285e2f..f71ef3799 100644
--- a/src/gui/profilergraph.cpp
+++ b/src/gui/profilergraph.cpp
@@ -94,20 +94,29 @@ void ProfilerGraph::draw(s32 x_left, s32 y_bottom, video::IVideoDriver *driver,
show_min = 0;
}
- s32 texth = 15;
+ const s32 texth = 15;
char buf[10];
- porting::mt_snprintf(buf, sizeof(buf), "%.3g", show_max);
+ if (floorf(show_max) == show_max)
+ porting::mt_snprintf(buf, sizeof(buf), "%.5g", show_max);
+ else
+ porting::mt_snprintf(buf, sizeof(buf), "%.3g", show_max);
font->draw(utf8_to_wide(buf).c_str(),
core::rect<s32>(textx, y - graphh, textx2,
y - graphh + texth),
meta.color);
- porting::mt_snprintf(buf, sizeof(buf), "%.3g", show_min);
+
+ if (floorf(show_min) == show_min)
+ porting::mt_snprintf(buf, sizeof(buf), "%.5g", show_min);
+ else
+ porting::mt_snprintf(buf, sizeof(buf), "%.3g", show_min);
font->draw(utf8_to_wide(buf).c_str(),
core::rect<s32>(textx, y - texth, textx2, y), meta.color);
+
font->draw(utf8_to_wide(id).c_str(),
core::rect<s32>(textx, y - graphh / 2 - texth / 2, textx2,
y - graphh / 2 + texth / 2),
meta.color);
+
s32 graph1y = y;
s32 graph1h = graphh;
bool relativegraph = (show_min != 0 && show_min != show_max);