MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / DrawAdvancedModMenu

Function DrawAdvancedModMenu

Source/GUI/dimgui/modmenu.cpp:240–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static void DrawAdvancedModMenu(Engine* engine) {
241 const std::vector<ModInstance*>& mods = ModLoading::Instance().GetMods();
242
243 // Automatic size
244 ImGui::BeginChild("Sub1", ImVec2(300, 0), false, ImGuiWindowFlags_HorizontalScrollbar & ImGuiWindowFlags_AlwaysAutoResize);
245
246 ImGui::Columns(1);
247
248#if ENABLE_STEAMWORKS
249 if (Steamworks::Instance()->UserNeedsToAcceptWorkshopAgreement()) {
250 ImGui::TextWrapped("%s", "Note: You need to go to steampowered.com and accept the Workshop Agreement before you're able to fully publish mods.");
251 ImGui::Separator();
252 }
253#endif
254
255 CategorizedModsList& categmods = GetCachedCategorizedMods();
256 CategorizedModsList::iterator modcatit = categmods.begin();
257
258 for (; modcatit != categmods.end(); modcatit++) {
259 const std::vector<ModInstance*> mods = modcatit->second;
260 if (mods.size() > 0 && ImGui::TreeNodeEx(modcatit->first, ImGuiTreeNodeFlags_DefaultOpen)) {
261 for (auto mod : mods) {
262 bool active = mod->IsActive();
263 ModID sid = mod->GetSid();
264 ImGui::PushID(sid.id);
265 if (CanActivateModInstance(mod)) {
266 if (mod->IsActive()) {
267 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
268 }
269
270 if (ImGui::Selectable(mod->name, mod_menu_selected_sid == sid, ImGuiSelectableFlags_SpanAllColumns)) {
271 mod_menu_selected_sid = sid;
272 }
273
274 if (mod->IsActive()) {
275 ImGui::PopStyleColor(1);
276 }
277 /*
278 if(ImGui::Checkbox(mod->name.c_str(), &active)){
279 ModLoading::Instance().GetMod(mod->GetSid())->Activate(active);
280 mod_can_activate_check_cache_map_.clear();
281 }
282 */
283 } else {
284 if (mod->IsInstalled()) {
285 ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]);
286 } else {
287 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.6f, 0.3f, 0.1f, 1.0f));
288 }
289
290 if (ImGui::Selectable(mod->name, mod_menu_selected_sid == sid, ImGuiSelectableFlags_SpanAllColumns)) {
291 mod_menu_selected_sid = sid;
292 }
293 ImGui::PopStyleColor(1);
294 /*
295 ImGui::Checkbox(mod->name.c_str(), &active);
296 //ImGui::MenuItem(mod->name.c_str(), NULL, false, false);
297 */

Callers 1

DrawModMenuFunction · 0.85

Calls 15

CanActivateModInstanceFunction · 0.85
PushStyleColorFunction · 0.85
PopStyleColorFunction · 0.85
FormatStringFunction · 0.85
PushStyleVarFunction · 0.85
FindFilePathFunction · 0.85
AssemblePathFunction · 0.85
ImageClass · 0.85
TextClass · 0.85
ImGuiYesNoFunction · 0.85
ButtonClass · 0.85

Tested by

no test coverage detected