MCPcopy Create free account
hub / github.com/GlobedGD/globed2 / addLevelSendButton

Function addLevelSendButton

src/modules/ui/hooks/LevelInfoLayer.cpp:73–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73 void addLevelSendButton() {
74 auto* leftMenu = typeinfo_cast<CCMenu*>(this->getChildByIDRecursive("left-side-menu"));
75 if (!leftMenu) {
76 return;
77 }
78
79 bool plat = m_level->isPlatformer();
80
81 Build<CCSprite>::create("icon-send-btn.png"_spr)
82 .with([&](auto spr) { cue::rescaleToMatch(spr, 46.f); })
83 .intoMenuItem([this, plat] {
84 if (plat) {
85 SendFeaturePopup::create(m_level)->show();
86 } else {
87 PopupManager::get().alert("Error", "Only <cj>Platformer levels</c> are eligible to be <cg>Globed Featured!</c>").showInstant();
88 }
89 })
90 .with([&](auto* btn) {
91 if (!plat) {
92 btn->setColor({100, 100, 100});
93 }
94 })
95 .id("send-btn"_spr)
96 .parent(leftMenu);
97
98 leftMenu->updateLayout();
99 }
100
101 void addPinButton() {
102 auto rightMenu = this->getChildByIDRecursive("right-side-menu");

Callers

nothing calls this directly

Calls 6

showMethod · 0.80
showInstantMethod · 0.80
alertMethod · 0.80
setColorMethod · 0.80
getFunction · 0.50
idMethod · 0.45

Tested by

no test coverage detected