MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / Render

Method Render

KBotExt/MiscTab.h:75–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 }
74
75 static void Render()
76 {
77 static bool onOpen = true;
78 if (ImGui::BeginTabItem("Misc"))
79 {
80 static std::string result;
81
82 // Get processes every 5 seconds
83 static auto timeBefore = std::chrono::high_resolution_clock::now();
84 std::chrono::duration<float, std::milli> timeDuration = std::chrono::high_resolution_clock::now() - timeBefore;
85 if (timeDuration.count() > 5000 || onOpen)
86 {
87 timeBefore = std::chrono::high_resolution_clock::now();
88 LCU::GetLeagueProcesses();
89 }
90
91 ImGui::Text("Selected process: ");
92 ImGui::SameLine();
93
94 std::string comboProcesses;
95 if (LCU::IsProcessGood())
96 {
97 comboProcesses = std::to_string(LCU::leagueProcesses[LCU::indexLeagueProcesses].first)
98 + " : " + LCU::leagueProcesses[LCU::indexLeagueProcesses].second;
99 }
100 ImGui::SetNextItemWidth(static_cast<float>(S.Window.width / 3));
101 if (ImGui::BeginCombo("##comboProcesses", comboProcesses.c_str(), 0))
102 {
103 for (size_t n = 0; n < LCU::leagueProcesses.size(); n++)
104 {
105 const bool is_selected = (LCU::indexLeagueProcesses == n);
106 if (ImGui::Selectable((std::to_string(LCU::leagueProcesses[n].first) + " : " + LCU::leagueProcesses[n].second).c_str(),
107 is_selected))
108 {
109 LCU::indexLeagueProcesses = n;
110 LCU::SetLeagueClientInfo();
111 }
112
113 if (is_selected)
114 ImGui::SetItemDefaultFocus();
115 }
116 ImGui::EndCombo();
117 }
118
119 ImGui::Separator();
120
121 ImGui::Columns(2, nullptr, false);
122
123 if (ImGui::Button("Launch another client"))
124 {
125 if (!std::filesystem::exists(S.leaguePath))
126 {
127 result = "Invalid path, change it in Settings tab";
128 }
129 else
130 Utils::OpenUrl(std::format("{}LeagueClient.exe", S.leaguePath).c_str(), "--allow-multiple-clients", SW_SHOWNORMAL);
131 }
132

Callers

nothing calls this directly

Calls 7

eraseFunction · 0.85
HelpMarkerFunction · 0.85
ImVec2Function · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected