|
15 | 15 | using namespace geode::prelude; |
16 | 16 | using namespace keybinds; |
17 | 17 |
|
18 | | -static void addBindSprites(CCNode* target, const char* action) { |
| 18 | +static void addBindSprites(CCNodeRGBA* target, const char* action) { |
| 19 | + if (target == nullptr) return; |
19 | 20 | target->removeAllChildren(); |
20 | 21 |
|
21 | 22 | auto bindContainer = CCNode::create(); |
22 | | - bindContainer->setScale(.65f); |
23 | 23 | bool first = true; |
24 | 24 | for (auto& bind : BindManager::get()->getBindsFor(action)) { |
25 | 25 | if (!first) { |
26 | | - bindContainer->addChild(CCLabelBMFont::create("/", "bigFont.fnt")); |
| 26 | + auto separator = CCLabelBMFont::create("/", "bigFont.fnt"); |
| 27 | + separator->setScale(.8f); |
| 28 | + separator->setOpacity(target->getOpacity()); |
| 29 | + bindContainer->addChild(separator); |
27 | 30 | } |
28 | 31 | first = false; |
29 | | - bindContainer->addChild(bind->createLabel()); |
| 32 | + auto label = bind->createLabel(); |
| 33 | + label->setScale(.8f); |
| 34 | + if (auto rgba = typeinfo_cast<CCRGBAProtocol*>(label)) { |
| 35 | + rgba->setOpacity(target->getOpacity()); |
| 36 | + } |
| 37 | + bindContainer->addChild(label); |
30 | 38 | } |
31 | 39 | bindContainer->setID("binds"_spr); |
32 | 40 | bindContainer->setContentSize({ |
33 | | - target->getContentSize().width / bindContainer->getScale(), 40.f |
| 41 | + target->getScaledContentWidth(), 40.f |
34 | 42 | }); |
35 | | - bindContainer->setLayout(RowLayout::create()); |
| 43 | + bindContainer->setLayout(SimpleRowLayout::create()->setMainAxisScaling(AxisScaling::ScaleDown)); |
36 | 44 | bindContainer->setAnchorPoint({ .5f, .5f }); |
37 | | - bindContainer->setPosition(target->getContentSize().width / 2, -1.f); |
| 45 | + bindContainer->setPosition(target->getContentWidth() / 2, -1.f); |
38 | 46 | target->addChild(bindContainer); |
39 | 47 | } |
40 | 48 |
|
@@ -256,15 +264,15 @@ struct $modify(UILayer) { |
256 | 264 | }); |
257 | 265 | // display practice mode button keybinds |
258 | 266 | if (auto menu = this->getChildByID("checkpoint-menu")) { |
259 | | - if (auto add = menu->getChildByID("add-checkpoint-button")) { |
| 267 | + if (auto add = typeinfo_cast<CCMenuItemSpriteExtra*>(menu->getChildByID("add-checkpoint-button"))) { |
260 | 268 | addBindSprites( |
261 | | - static_cast<CCMenuItemSpriteExtra*>(add)->getNormalImage(), |
| 269 | + typeinfo_cast<CCNodeRGBA*>(add->getNormalImage()), |
262 | 270 | "robtop.geometry-dash/place-checkpoint" |
263 | 271 | ); |
264 | 272 | } |
265 | | - if (auto rem = menu->getChildByID("remove-checkpoint-button")) { |
| 273 | + if (auto rem = typeinfo_cast<CCMenuItemSpriteExtra*>(menu->getChildByID("remove-checkpoint-button"))) { |
266 | 274 | addBindSprites( |
267 | | - static_cast<CCMenuItemSpriteExtra*>(rem)->getNormalImage(), |
| 275 | + typeinfo_cast<CCNodeRGBA*>(rem->getNormalImage()), |
268 | 276 | "robtop.geometry-dash/delete-checkpoint" |
269 | 277 | ); |
270 | 278 | } |
|
0 commit comments