mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Update overlay.cpp
Replaced the manual filter with imgui filter Theme adjustments: -- item separation is bigger -- window title is centered -- inputtext is more clearly highlighted so it doesnt blend out with the background -- adjusted companion window initial pos and size
This commit is contained in:
parent
a5e43d3132
commit
22c5c7be49
@ -125,9 +125,9 @@ public:
|
|||||||
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f);
|
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f);
|
||||||
colors[ImGuiCol_Border] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
colors[ImGuiCol_Border] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
||||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.70f);
|
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.70f);
|
||||||
colors[ImGuiCol_FrameBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.75f);
|
colors[ImGuiCol_FrameBg] = ImVec4(0.05f, 0.05f, 0.05f, 0.75f);
|
||||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.11f, 0.11f, 0.11f, 1.00f);
|
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.16f, 0.16f, 0.16f, 1.00f);
|
||||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.21f, 0.21f, 0.21f, 1.00f);
|
colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.26f, 0.26f, 1.00f);
|
||||||
colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
||||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.06f, 0.06f, 0.06f, 1.00f);
|
colors[ImGuiCol_TitleBgActive] = ImVec4(0.06f, 0.06f, 0.06f, 1.00f);
|
||||||
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
||||||
@ -176,7 +176,8 @@ public:
|
|||||||
style.WindowBorderSize = 0.0f;
|
style.WindowBorderSize = 0.0f;
|
||||||
style.ScrollbarRounding = 1.0f;
|
style.ScrollbarRounding = 1.0f;
|
||||||
style.WindowRounding = 2.5f;
|
style.WindowRounding = 2.5f;
|
||||||
style.ItemSpacing = ImVec2(4, 1);
|
style.ItemSpacing = ImVec2(4, 4);
|
||||||
|
style.WindowTitleAlign = ImVec2(0.5f, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@ -192,6 +193,7 @@ public:
|
|||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(840, 600), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(840, 600), ImGuiCond_FirstUseEver);
|
||||||
ImGui::SetWindowPos(ImVec2(-1000, 50), ImGuiCond_FirstUseEver);
|
ImGui::SetWindowPos(ImVec2(-1000, 50), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (!ImGui::Begin(title, p_open))
|
if (!ImGui::Begin(title, p_open))
|
||||||
{
|
{
|
||||||
ImGui::End(); return;
|
ImGui::End(); return;
|
||||||
@ -344,6 +346,7 @@ public:
|
|||||||
{// Auto focus previous widget
|
{// Auto focus previous widget
|
||||||
ImGui::SetKeyboardFocusHere(-1);
|
ImGui::SetKeyboardFocusHere(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +466,8 @@ public:
|
|||||||
ImVector<ServerListing*> ServerList;
|
ImVector<ServerListing*> ServerList;
|
||||||
ServerListing* SelectedServer;
|
ServerListing* SelectedServer;
|
||||||
|
|
||||||
char FilterBuffer[256] = { 0 };
|
ImGuiTextFilter ServerBrowserFilter;
|
||||||
|
|
||||||
char ServerConnStringBuffer[256] = { 0 };
|
char ServerConnStringBuffer[256] = { 0 };
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
@ -488,7 +492,6 @@ public:
|
|||||||
|
|
||||||
CCompanion()
|
CCompanion()
|
||||||
{
|
{
|
||||||
memset(FilterBuffer, 0, sizeof(FilterBuffer));
|
|
||||||
memset(MatchmakingServerStringBuffer, 0, sizeof(MatchmakingServerStringBuffer));
|
memset(MatchmakingServerStringBuffer, 0, sizeof(MatchmakingServerStringBuffer));
|
||||||
memset(ServerNameBuffer, 0, sizeof(ServerNameBuffer));
|
memset(ServerNameBuffer, 0, sizeof(ServerNameBuffer));
|
||||||
memset(ServerConnStringBuffer, 0, sizeof(ServerConnStringBuffer));
|
memset(ServerConnStringBuffer, 0, sizeof(ServerConnStringBuffer));
|
||||||
@ -512,6 +515,18 @@ public:
|
|||||||
|
|
||||||
//RefreshServerList();
|
//RefreshServerList();
|
||||||
|
|
||||||
|
ServerList.push_back(
|
||||||
|
new ServerListing("TDM friendly <3", "mp_rr_desertlands_64k_x_64k", "192.168.0.55", "v1.132.0")
|
||||||
|
);
|
||||||
|
ServerList.push_back(
|
||||||
|
new ServerListing("OCTANE RACING UwU", "mp_rr_desertlands_64k_x_64k", "192.168.0.55", "v1.132.0")
|
||||||
|
);
|
||||||
|
ServerList.push_back(
|
||||||
|
new ServerListing("TDM friendly <3", "mp_rr_desertlands_64k_x_64k", "192.168.0.55", "v1.142.0")
|
||||||
|
);
|
||||||
|
ServerList.push_back(
|
||||||
|
new ServerListing("TDM friendly <3", "mp_rr_desertlands_64k_x_64k", "192.168.0.55", "v1.132.0")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshServerList()
|
void RefreshServerList()
|
||||||
@ -552,20 +567,13 @@ public:
|
|||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string stringtolower(std::string source)
|
|
||||||
{
|
|
||||||
for (auto& ch : source)
|
|
||||||
ch = std::tolower(ch);
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServerBrowserSection()
|
void ServerBrowserSection()
|
||||||
{
|
{
|
||||||
|
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::InputText("Filter", FilterBuffer, IM_ARRAYSIZE(FilterBuffer), 0);
|
ServerBrowserFilter.Draw();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Refresh List", ImVec2(ImGui::GetWindowSize().x * (2.f/6.f), 19)))
|
if (ImGui::Button("Refresh List"))
|
||||||
{
|
{
|
||||||
RefreshServerList();
|
RefreshServerList();
|
||||||
}
|
}
|
||||||
@ -585,17 +593,16 @@ public:
|
|||||||
|
|
||||||
for (ServerListing* server : ServerList)
|
for (ServerListing* server : ServerList)
|
||||||
{
|
{
|
||||||
const char* name = stringtolower(server->name).c_str();
|
const char* name = server->name.c_str();
|
||||||
const char* ip = stringtolower(server->ip).c_str();
|
const char* ip = server->ip.c_str();
|
||||||
const char* map = stringtolower(server->map).c_str();
|
const char* map = server->map.c_str();
|
||||||
const char* version = stringtolower(server->version).c_str();
|
const char* version = server->version.c_str();
|
||||||
|
|
||||||
|
|
||||||
if (!strcmp(FilterBuffer, "")
|
if (ServerBrowserFilter.PassFilter(name)
|
||||||
|| strstr(name, FilterBuffer) != NULL
|
|| ServerBrowserFilter.PassFilter(ip)
|
||||||
|| strstr(ip, FilterBuffer) != NULL
|
|| ServerBrowserFilter.PassFilter(map)
|
||||||
|| strstr(map, FilterBuffer) != NULL
|
|| ServerBrowserFilter.PassFilter(version))
|
||||||
|| strstr(version, FilterBuffer) != NULL)
|
|
||||||
{
|
{
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text(server->name.c_str());
|
ImGui::Text(server->name.c_str());
|
||||||
@ -691,8 +698,9 @@ public:
|
|||||||
|
|
||||||
void Draw(const char* title, bool* p_open)
|
void Draw(const char* title, bool* p_open)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowSize(ImVec2(2000, 1000), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(800, 890), ImGuiCond_FirstUseEver);
|
||||||
ImGui::SetWindowPos(ImVec2(-1000, 50), ImGuiCond_FirstUseEver);
|
ImGui::SetWindowPos(ImVec2(-500, 50), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if (!ImGui::Begin(title, p_open))
|
if (!ImGui::Begin(title, p_open))
|
||||||
{
|
{
|
||||||
ImGui::End(); return;
|
ImGui::End(); return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user