Recast: improve text and value representation on GUI

Small UX improvement.
This commit is contained in:
Kawe Mazidjatari 2024-07-11 09:22:08 +02:00
parent 5955ac7864
commit d38bdd1abd
3 changed files with 11 additions and 8 deletions

View File

@ -200,7 +200,7 @@ void Editor::handleCommonSettings()
int gw = 0, gh = 0; int gw = 0, gh = 0;
rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh); rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh);
char text[64]; char text[64];
snprintf(text, 64, "Voxels %d x %d", gw, gh); snprintf(text, 64, "Voxels: %d x %d", gw, gh);
ImGui::Text(text); ImGui::Text(text);
} }

View File

@ -252,7 +252,7 @@ void Editor_TileMesh::handleSettings()
Editor::handleCommonSettings(); Editor::handleCommonSettings();
ImGui::Text("Tiling"); ImGui::Text("Tiling");
ImGui::SliderInt("TileSize", &m_tileSize, 8, 1024); ImGui::SliderInt("Tile Size", &m_tileSize, 8, 1024);
ImGui::Checkbox("Build All Tiles", &m_buildAll); ImGui::Checkbox("Build All Tiles", &m_buildAll);
ImGui::Checkbox("Keep Intermediate Results", &m_keepInterResults); ImGui::Checkbox("Keep Intermediate Results", &m_keepInterResults);
@ -267,9 +267,9 @@ void Editor_TileMesh::handleSettings()
const int ts = m_tileSize; const int ts = m_tileSize;
const int tw = (gw + ts-1) / ts; const int tw = (gw + ts-1) / ts;
const int th = (gh + ts-1) / ts; const int th = (gh + ts-1) / ts;
snprintf(text, sizeof(text), "Tiles %d x %d", tw, th); snprintf(text, sizeof(text), "Tiles: %d x %d", tw, th);
ImGui::Text(text); ImGui::Text(text);
snprintf(text, sizeof(text), "Tile Sizes %g x %g (%g)", tw*m_cellSize, th*m_cellSize, m_tileSize*m_cellSize); snprintf(text, sizeof(text), "Tile Sizes: %g x %g (%g)", tw*m_cellSize, th*m_cellSize, m_tileSize*m_cellSize);
ImGui::Text(text); ImGui::Text(text);
// Max tiles and max polys affect how the tile IDs are calculated. // Max tiles and max polys affect how the tile IDs are calculated.
// There are 28 bits available for identifying a tile and a polygon. // There are 28 bits available for identifying a tile and a polygon.
@ -277,9 +277,9 @@ void Editor_TileMesh::handleSettings()
int polyBits = 28 - tileBits; int polyBits = 28 - tileBits;
m_maxTiles = 1 << tileBits; m_maxTiles = 1 << tileBits;
m_maxPolysPerTile = 1 << polyBits; m_maxPolysPerTile = 1 << polyBits;
snprintf(text, sizeof(text), "Max Tiles %d", m_maxTiles); snprintf(text, sizeof(text), "Max Tiles: %d", m_maxTiles);
ImGui::Text(text); ImGui::Text(text);
snprintf(text, sizeof(text), "Max Polys %d", m_maxPolysPerTile); snprintf(text, sizeof(text), "Max Polys: %d", m_maxPolysPerTile);
ImGui::Text(text); ImGui::Text(text);
} }
else else

View File

@ -981,8 +981,11 @@ int not_main(int argc, char** argv)
if (geom) if (geom)
{ {
char text[64]; char text[64];
snprintf(text, 64, "Verts: %.1fk Tris: %.1fk", snprintf(text, sizeof(text), "Verts: %.1fk",
geom->getMesh()->getVertCount() / 1000.0f, geom->getMesh()->getVertCount() / 1000.0f);
ImGui::Text(text);
snprintf(text, sizeof(text), "Tris: %.1fk",
geom->getMesh()->getTriCount() / 1000.0f); geom->getMesh()->getTriCount() / 1000.0f);
ImGui::Text(text); ImGui::Text(text);
} }