Skip to content

Commit a835aea

Browse files
committed
Bug fixes
1 parent 22be082 commit a835aea

File tree

6 files changed

+30
-16
lines changed

6 files changed

+30
-16
lines changed

assets/logo.ico

-26 KB
Binary file not shown.

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"gd": {
44
"win": "2.206"
55
},
6-
"version": "v0.7.1",
6+
"version": "v0.7.2",
77
"id": "zalphalaneous.minecraft",
88
"name": "Minecraftify!",
99
"developer": "Alphalaneous",

src/ui/hooks/CCDirector.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44

55
class $modify(MyCCDirector, CCDirector){
66

7-
/*void popScene(){
8-
CCScene* currentScene = CCDirector::get()->getRunningScene();
9-
if(!currentScene->getChildByIDRecursive("settings-layer"_spr)){
10-
if(!currentScene->getChildByIDRecursive("MenuLayer")){
11-
CCDirector::popScene();
12-
}
13-
}
14-
else{
15-
currentScene->getChildByIDRecursive("settings-layer"_spr)->removeFromParent();
16-
}
17-
}*/
18-
197
bool replaceScene(CCScene *pScene){
208

219
if(!GlobalVars::getSharedInstance()->isInitialLaunch){

src/ui/hooks/FLAlertLayer.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ class $modify(MyFLAlertLayer, FLAlertLayer){
1212
if(!Loader::get()->isModLoaded("geode.node-ids")) return true;
1313

1414
CCNode* mainLayer = getChildByID("main-layer");
15+
16+
bool hasScroll = mainLayer->getChildByID("scroll-layer");
1517

1618
float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;
1719

1820
if(CCScale9Sprite* background = typeinfo_cast<CCScale9Sprite*>(mainLayer->getChildByID("background"))){
1921
CCScale9Sprite* newBackground = CCScale9Sprite::create("ui_background.png"_spr);
2022
newBackground->setColor(background->getColor());
21-
newBackground->setContentSize(background->getContentSize() / 4 / scale);
23+
24+
CCSize newBGSize = background->getContentSize() / 4 / scale;
25+
26+
float sizeIncrease = 0;
27+
28+
if(!hasScroll){
29+
sizeIncrease = 10;
30+
}
31+
32+
newBackground->setContentSize({newBGSize.width + sizeIncrease, newBGSize.height});
2233
newBackground->setScale(background->getScale() * 4 * scale);
2334
newBackground->setPosition({mainLayer->getContentSize().width/2, mainLayer->getContentSize().height/2});
2435
newBackground->setAnchorPoint(background->getAnchorPoint());
@@ -60,6 +71,9 @@ class $modify(MyFLAlertLayer, FLAlertLayer){
6071
text->setAnchorPoint({0.5, 0});
6172
text->setScale(0.6f);
6273
text->setPosition({0, text->getPosition().y});
74+
std::string labelText = std::string(text->getString());
75+
Utils::trim(labelText);
76+
text->setString(labelText.c_str());
6377
}
6478
}
6579

@@ -77,6 +91,9 @@ class $modify(MyFLAlertLayer, FLAlertLayer){
7791
text->setAnchorPoint({0.5, 1});
7892
text->setScale(0.6f);
7993
text->setPosition({0, text->getPosition().y});
94+
std::string labelText = std::string(text->getString());
95+
Utils::trim(labelText);
96+
text->setString(labelText.c_str());
8097
}
8198

8299
contentLayer->setContentSize(textArea->getScaledContentSize());
@@ -120,7 +137,7 @@ class $modify(MyFLAlertLayer, FLAlertLayer){
120137
RowLayout* rowLayout = RowLayout::create();
121138
rowLayout->ignoreInvisibleChildren(true);
122139

123-
CCMenu* innerButtonMenu = CCMenu::create();
140+
CCNode* innerButtonMenu = CCNode::create();
124141

125142
innerButtonMenu->setContentSize({400, 30});
126143
innerButtonMenu->setLayout(rowLayout);

src/ui/nodes/MCButtonChild.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "MCLabel.h"
33
#include "../../utils/Utils.h"
44

5+
using namespace geode::prelude;
6+
57
CCSprite* generateEdgeSprite(gd::string textureName){
68

79
float scale = CCDirector::sharedDirector()->getContentScaleFactor()/4;
@@ -133,7 +135,9 @@ void MCButtonChild::onHoverExit(){
133135
void MCButtonChild::selected(){
134136
if(this->isHovering){
135137
FMODAudioEngine::sharedEngine()->playEffect("click.ogg"_spr);
136-
CCMenuItem::activate();
138+
geode::Loader::get()->queueInMainThread([this]() { //delay it by a frame because for some reason it crashes the touch dispatcher otherwise ???
139+
(m_pListener->*m_pfnSelector)(this);
140+
});
137141
}
138142
}
139143

src/utils/Utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ class Utils {
297297
return newToggler;
298298
}
299299

300+
static void trim(std::string& str) {
301+
str.erase(str.find_last_not_of(' ')+1);
302+
str.erase(0, str.find_first_not_of(' '));
303+
}
304+
300305
static CCNode* getNodeSafe(CCNode* node, std::string id) {
301306

302307
if(CCNode* ret = node->getChildByIDRecursive(id)){

0 commit comments

Comments
 (0)