fix(UserSidebar): Fixed height and top offset

This commit is contained in:
Yimura 2021-01-16 16:21:00 +01:00
parent f2c1660007
commit b468eb7549
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78

View File

@ -5,11 +5,12 @@ namespace big
{ {
void window::render_user_sidebar() void window::render_user_sidebar()
{ {
ImGui::SetNextWindowSize({ 350.f, (float)y }, ImGuiCond_Always); static const float height_correction = 28.f;
ImGui::SetNextWindowPos({ x - 350.f, 28.f }, ImGuiCond_Always); ImGui::SetNextWindowSize({ 350.f, (float)y - height_correction }, ImGuiCond_Always);
ImGui::SetNextWindowPos({ x - 350.f, height_correction }, ImGuiCond_Always);
if (ImGui::Begin("###player_menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav)) if (ImGui::Begin("###player_menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav))
{ {
auto vecButtonWidth = ImVec2(ImGui::GetWindowSize().x, 0.0f); auto vecButtonWidth = ImVec2(ImGui::GetWindowSize().x - 30.f, 0.0f);
ImGui::TextColored({ 255,255,255,255 }, "YOU:"); ImGui::TextColored({ 255,255,255,255 }, "YOU:");
@ -29,6 +30,8 @@ namespace big
if (ImGui::TreeNode("Friends")) if (ImGui::TreeNode("Friends"))
{ {
ImGui::Unindent();
bool friendInLobby = false; bool friendInLobby = false;
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
@ -52,12 +55,15 @@ namespace big
ImGui::TextColored({ 180,180,180,255 }, " No friends in current lobby."); ImGui::TextColored({ 180,180,180,255 }, " No friends in current lobby.");
} }
ImGui::Indent();
ImGui::TreePop(); ImGui::TreePop();
ImGui::Separator(); ImGui::Separator();
} }
if (ImGui::TreeNode("Players")) if (ImGui::TreeNode("Players"))
{ {
ImGui::Unindent();
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
player player = g_players[i]; player player = g_players[i];
@ -72,6 +78,7 @@ namespace big
} }
} }
ImGui::Indent();
ImGui::TreePop(); ImGui::TreePop();
} }