mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
feat: add persistent coordinate display below minimap
Always-visible player coordinates (X, Y in canonical WoW space) rendered as warm-yellow text on a semi-transparent pill just below the minimap circle, eliminating the need to hover for position info.
This commit is contained in:
parent
2e504232ec
commit
7475a4fff3
1 changed files with 24 additions and 4 deletions
|
|
@ -12074,17 +12074,37 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Persistent coordinate display below the minimap
|
||||||
|
{
|
||||||
|
glm::vec3 playerCanon = core::coords::renderToCanonical(playerRender);
|
||||||
|
char coordBuf[32];
|
||||||
|
std::snprintf(coordBuf, sizeof(coordBuf), "%.1f, %.1f", playerCanon.x, playerCanon.y);
|
||||||
|
|
||||||
|
ImFont* font = ImGui::GetFont();
|
||||||
|
float fontSize = ImGui::GetFontSize();
|
||||||
|
ImVec2 textSz = font->CalcTextSizeA(fontSize, FLT_MAX, 0.0f, coordBuf);
|
||||||
|
|
||||||
|
float tx = centerX - textSz.x * 0.5f;
|
||||||
|
float ty = centerY + mapRadius + 3.0f;
|
||||||
|
|
||||||
|
// Semi-transparent dark background pill
|
||||||
|
float pad = 3.0f;
|
||||||
|
drawList->AddRectFilled(
|
||||||
|
ImVec2(tx - pad, ty - pad),
|
||||||
|
ImVec2(tx + textSz.x + pad, ty + textSz.y + pad),
|
||||||
|
IM_COL32(0, 0, 0, 140), 4.0f);
|
||||||
|
// Coordinate text in warm yellow
|
||||||
|
drawList->AddText(font, fontSize, ImVec2(tx, ty), IM_COL32(230, 220, 140, 255), coordBuf);
|
||||||
|
}
|
||||||
|
|
||||||
// Hover tooltip: show player's WoW coordinates (canonical X=North, Y=West)
|
// Hover tooltip: show player's WoW coordinates (canonical X=North, Y=West)
|
||||||
{
|
{
|
||||||
ImVec2 mouse = ImGui::GetMousePos();
|
ImVec2 mouse = ImGui::GetMousePos();
|
||||||
float mdx = mouse.x - centerX;
|
float mdx = mouse.x - centerX;
|
||||||
float mdy = mouse.y - centerY;
|
float mdy = mouse.y - centerY;
|
||||||
if (mdx * mdx + mdy * mdy <= mapRadius * mapRadius) {
|
if (mdx * mdx + mdy * mdy <= mapRadius * mapRadius) {
|
||||||
glm::vec3 playerCanon = core::coords::renderToCanonical(playerRender);
|
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::TextColored(ImVec4(0.9f, 0.9f, 0.5f, 1.0f),
|
ImGui::TextColored(ImVec4(0.9f, 0.9f, 0.5f, 1.0f), "Ctrl+click to ping");
|
||||||
"%.1f, %.1f", playerCanon.x, playerCanon.y);
|
|
||||||
ImGui::TextDisabled("Ctrl+click to ping");
|
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue