feat(GUI): Added user sidebar
This commit is contained in:
parent
b88b6dc5c5
commit
509283f48a
@ -104,6 +104,9 @@ namespace big
|
|||||||
|
|
||||||
// gui/main_window.cpp
|
// gui/main_window.cpp
|
||||||
render_main_window();
|
render_main_window();
|
||||||
|
|
||||||
|
// gui/user_sidebar.cpp
|
||||||
|
render_user_sidebar();
|
||||||
}
|
}
|
||||||
EXCEPT_CLAUSE
|
EXCEPT_CLAUSE
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ namespace big
|
|||||||
|
|
||||||
void render_top_bar();
|
void render_top_bar();
|
||||||
void render_main_window();
|
void render_main_window();
|
||||||
|
void render_user_sidebar();
|
||||||
public:
|
public:
|
||||||
bool m_opened{};
|
bool m_opened{};
|
||||||
};
|
};
|
||||||
|
74
BigBaseV2/src/gui/user_sidebar.cpp
Normal file
74
BigBaseV2/src/gui/user_sidebar.cpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#include "imgui.h"
|
||||||
|
#include "gui.hpp"
|
||||||
|
#include "features.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
void gui::render_user_sidebar()
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowSize({ 350.f, (float)y }, ImGuiCond_Always);
|
||||||
|
ImGui::SetNextWindowPos({ x - 350.f, 0.f }, ImGuiCond_Always);
|
||||||
|
if (ImGui::Begin("###player_menu", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav))
|
||||||
|
{
|
||||||
|
auto vecButtonWidth = ImVec2(ImGui::GetWindowSize().x, 0.0f);
|
||||||
|
|
||||||
|
ImGui::TextColored({ 255,255,255,255 }, "YOU:");
|
||||||
|
|
||||||
|
if (ImGui::Button(g_players[g_playerId].name, vecButtonWidth))
|
||||||
|
{
|
||||||
|
g_selectedPlayer = g_playerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Friends"))
|
||||||
|
{
|
||||||
|
bool friendInLobby = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
player player = g_players[i];
|
||||||
|
|
||||||
|
if (player.is_friend && player.is_online)
|
||||||
|
{
|
||||||
|
friendInLobby = true;
|
||||||
|
|
||||||
|
if (ImGui::Button(player.name, vecButtonWidth))
|
||||||
|
{
|
||||||
|
g_selectedPlayer = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!friendInLobby)
|
||||||
|
{
|
||||||
|
ImGui::TextColored({ 180,180,180,255 }, " No friends in current lobby.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
ImGui::Separator();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Players"))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
player player = g_players[i];
|
||||||
|
|
||||||
|
if (!player.is_friend && player.is_online && i != g_playerId)
|
||||||
|
{
|
||||||
|
if (ImGui::Button(player.name, vecButtonWidth))
|
||||||
|
{
|
||||||
|
g_selectedPlayer = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user