Revisit F6 statistics formatting (#13126)

This commit is contained in:
SmallJoker 2023-01-16 20:16:23 +01:00 committed by GitHub
parent a2a280691c
commit ecd6d61697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

@ -276,7 +276,7 @@ void GameUI::updateProfiler()
core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()-> core::dimension2d<u32> size = m_guitext_profiler->getOverrideFont()->
getDimension(str.c_str()); getDimension(str.c_str());
core::position2di upper_left(6, 50); core::position2di upper_left(6, m_guitext->getTextHeight() * 2.5f);
core::position2di lower_right = upper_left; core::position2di lower_right = upper_left;
lower_right.X += size.Width + 10; lower_right.X += size.Width + 10;
lower_right.Y += size.Height; lower_right.Y += size.Height;

@ -273,7 +273,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
std::vector<NearbyCollisionInfo> cinfo; std::vector<NearbyCollisionInfo> cinfo;
{ {
//TimeTaker tt2("collisionMoveSimple collect boxes"); //TimeTaker tt2("collisionMoveSimple collect boxes");
ScopeProfiler sp2(g_profiler, PROFILER_NAME("collisionMoveSimple(): collect boxes"), SPT_AVG); ScopeProfiler sp2(g_profiler, PROFILER_NAME("collision collect boxes"), SPT_AVG);
v3f minpos_f( v3f minpos_f(
MYMIN(pos_f->X, newpos_f.X), MYMIN(pos_f->X, newpos_f.X),

@ -137,7 +137,7 @@ int Profiler::print(std::ostream &o, u32 page, u32 pagecount)
{ {
GraphValues values; GraphValues values;
getPage(values, page, pagecount); getPage(values, page, pagecount);
char num_buf[50]; char buffer[50];
for (const auto &i : values) { for (const auto &i : values) {
o << " " << i.first << " "; o << " " << i.first << " ";
@ -146,16 +146,17 @@ int Profiler::print(std::ostream &o, u32 page, u32 pagecount)
continue; continue;
} }
s32 space = 44 - i.first.size(); {
for (s32 j = 0; j < space; j++) { // Padding
if ((j & 1) && j < space - 1) s32 space = std::max(0, 44 - (s32)i.first.size());
o << "."; memset(buffer, '_', space);
else buffer[space] = '\0';
o << " "; o << buffer;
} }
porting::mt_snprintf(num_buf, sizeof(num_buf), "% 4ix % 3g",
porting::mt_snprintf(buffer, sizeof(buffer), "% 5ix % 4.4g",
getAvgCount(i.first), i.second); getAvgCount(i.first), i.second);
o << num_buf << std::endl; o << buffer << std::endl;
} }
return values.size(); return values.size();
} }