Skip to content

Commit 4b1efbf

Browse files
author
TheSillyDoggo
committed
thing
1 parent 2059cbd commit 4b1efbf

File tree

8 files changed

+127
-116
lines changed

8 files changed

+127
-116
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# 1.6.7
22

33
- Fixed Speedhack not working with physics bypass enabled in cbf
4+
- Removed the search bar replacing it with version info as it was in older versions
5+
- If you want to bring it back you can in the <cc>Config</c> tab
46
- Added **Toolbox Button Bypass**
57
- Added **Scale Text Input**
68
- Added **Free Scroll**

src/Client/AndroidUI.cpp

Lines changed: 101 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ bool AndroidUI::setup()
9292

9393
sprites.push_back(normal);
9494
windowsMenu->addChild(button);
95+
96+
buttons.push_back(button);
9597
}
9698

9799
updateTabs();
@@ -148,26 +150,32 @@ bool AndroidUI::setup()
148150
panel->addChild(input);
149151
this->inputField = input;
150152

151-
std::stringstream ver;
152-
ver << "Using version " << Mod::get()->getVersion().getMajor() << "." << Mod::get()->getVersion().getMinor() << "." << Mod::get()->getVersion().getPatch();
153-
154-
auto versionText = CCLabelBMFont::create(ver.str().c_str(), "chatFont.fnt");
155-
versionText->setColor({0, 0, 0});
156-
versionText->setOpacity(100);
157-
versionText->setAnchorPoint(ccp(0.5f, 0));
158-
versionText->setScale(0.45f);
159-
versionText->setPosition(ccp(64, 13 + 8));
160-
//panel->addChild(versionText);
161-
162-
auto devText = CCLabelBMFont::create("Mod Developed By TheSillyDoggo", "chatFont.fnt");
163-
devText->setColor({0, 0, 0});
164-
devText->setOpacity(100);
165-
devText->setAnchorPoint(ccp(0.5f, 0));
166-
devText->setScale(0.45f);
167-
devText->setPosition(ccp(64, 13));
168-
//panel->addChild(devText);
153+
versionParent = CCNode::create();
154+
versionParent->setAnchorPoint(ccp(0.5f, 0));
155+
versionParent->setContentWidth(150);
156+
versionParent->setPosition(windows->getPosition() + ccp(windows->getScaledContentWidth() / 2, 5));
157+
versionParent->setLayout(AxisLayout::create(Axis::Row)->setAutoScale(false)->setGap(6));
158+
versionParent->getLayout()->ignoreInvisibleChildren(true);
159+
160+
versionInfo = CCLabelBMFont::create("L", "chatFont.fnt");
161+
//versionInfo->setBlendFunc({ GL_ONE_MINUS_DST_COLOR, GL_ZERO });
162+
versionInfo->setAlignment(CCTextAlignment::kCCTextAlignmentCenter);
163+
versionInfo->setAnchorPoint(ccp(0.5f, 0));
164+
versionInfo->setScale(0.55f);
165+
versionInfo->setOpacity(125);
166+
167+
checkingSprite = LoadingCircleSprite::create();
168+
checkingSprite->runAction(CCRepeatForever::create(CCRotateBy::create(1, 360)));
169+
checkingSprite->setScale(versionInfo->getScaledContentHeight() / checkingSprite->getContentHeight());
170+
171+
versionParent->addChild(versionInfo);
172+
versionParent->addChild(checkingSprite);
173+
174+
panel->addChild(versionParent);
169175

170176
goToPage(selectedTab);
177+
updateVersionLabel();
178+
updateSearchBox();
171179

172180
//if (Client::GetModuleEnabled("npesta-width"))
173181
//{
@@ -183,84 +191,54 @@ bool AndroidUI::setup()
183191
return true;
184192
}
185193

186-
CCNode* AndroidUI::getBGNode()
194+
void AndroidUI::updateVersionLabel()
187195
{
188-
int theme = Mod::get()->getSavedValue<int>("theme", 5);
196+
auto ver = Mod::get()->getVersion();
197+
versionInfo->setString(fmt::format("Using Version {}.{}.{}", ver.getMajor(), ver.getMinor(), ver.getPatch()).c_str());
189198

190-
panel = CCScale9Sprite::create(fmt::format("GJ_square0{}.png", (theme < 0 ? 6 : theme)).c_str());
191-
panel->setContentSize(ccp(475, 280));
192-
panel->setID("panel");
199+
checkingSprite->setVisible(!hasCheckedForUpdates);
193200

194-
as<CCNode*>(panel->getChildren()->objectAtIndex(0))->setZOrder(-2);
195-
196-
if (Loader::get()->getLoadedMod("thesillydoggo.gradientpages") && theme == -1)
201+
if (!hasCheckedForUpdates)
197202
{
198-
auto gradient = CCLayerGradient::create(ccc4(0, 0, 0, 0), ccc4(0, 0, 0, 0));
199-
gradient->setContentSize(panel->getContentSize());
200-
gradient->setZOrder(-1);
201-
gradient->setID("gradient"_spr);
202-
203-
if (Loader::get()->getLoadedMod("thesillydoggo.gradientpages")->getSettingValue<bool>("use-custom-colours"))
203+
updateListener.bind([this](Mod::CheckUpdatesTask::Event* event)
204204
{
205-
gradient->setStartColor(Loader::get()->getLoadedMod("thesillydoggo.gradientpages")->getSettingValue<ccColor3B>("primary-colour"));
206-
gradient->setEndColor(Loader::get()->getLoadedMod("thesillydoggo.gradientpages")->getSettingValue<ccColor3B>("secondary-colour"));
207-
}
208-
else
209-
{
210-
auto gm = GameManager::get();
211-
212-
gradient->setStartColor(gm->colorForIdx(gm->m_playerColor.value()));
213-
gradient->setEndColor(gm->colorForIdx(gm->m_playerColor2.value()));
214-
}
215-
216-
gradient->setStartOpacity(255);
217-
gradient->setEndOpacity(255);
218-
219-
gradient->setPosition(CCDirector::get()->getWinSize() / 2);
220-
gradient->ignoreAnchorPointForPosition(false);
205+
if (auto value = event->getValue())
206+
{
207+
if (value->has_value())
208+
{
209+
updateRequired = value->unwrap().has_value();
210+
}
221211

222-
if (Loader::get()->getLoadedMod("thesillydoggo.gradientpages")->getSettingValue<bool>("reverse-order"))
223-
gradient->setScaleY(-1);
212+
hasCheckedForUpdates = true;
213+
updateVersionLabel();
214+
}
215+
else if (event->isCancelled())
216+
{
217+
hasCheckedForUpdates = false;
218+
updateVersionLabel();
219+
}
220+
});
224221

225-
auto outline = CCScale9Sprite::createWithSpriteFrameName((std::string("thesillydoggo.gradientpages/") + std::string("square-outline.png")).c_str());
226-
outline->setPosition(panel->getContentSize() / 2);
227-
outline->setContentSize(panel->getContentSize());
228-
outline->setZOrder(1);
229-
outline->setID("outline"_spr);
230-
231-
gradient->addChild(outline);
232-
panel->addChild(gradient);
222+
updateListener.setFilter(Mod::get()->checkUpdates());
233223

234-
gradient->setAnchorPoint(ccp(0, 0));
235-
gradient->setPosition(ccp(0, 0));
224+
return;
236225
}
237226

238-
if (theme == -2)
227+
if (updateRequired)
239228
{
240-
//panel->setColor(ccc3(0, 0, 0));
241-
//panel->setOpacity(175);
242-
243-
auto out = CCScale9Sprite::create("GJ_square07.png");
244-
out->setContentSize(panel->getContentSize());
245-
out->setAnchorPoint(ccp(0, 0));
246-
out->setID("panel-outline");
247-
panel->addChild(out);
248-
}
229+
versionInfo->setString(fmt::format("{}\nUpdate Available!", versionInfo->getString()).c_str());
249230

250-
if (theme == -3)
251-
{
252-
if (auto spr = CCSprite::create(Mod::get()->getSavedValue<std::string>("image-theme-path").c_str()))
231+
for (size_t i = 0; i < 17; i++)
253232
{
254-
spr->setScaleX(panel->getContentWidth() / spr->getContentWidth());
255-
spr->setScaleY(panel->getContentHeight() / spr->getContentHeight());
256-
spr->setPosition(panel->getContentSize() / 2);
257-
spr->setZOrder(-2);
258-
259-
panel->addChild(spr);
233+
if (auto n = as<CCNodeRGBA*>(versionInfo->getChildren()->objectAtIndex(versionInfo->getChildren()->count() - i - 1)))
234+
{
235+
n->setColor(ccc3(87, 87, 255));
236+
}
260237
}
238+
261239
}
262240

263-
return panel;
241+
versionParent->updateLayout();
264242
}
265243

266244
CCMenu* AndroidUI::getSearchPanel()
@@ -510,4 +488,47 @@ void AndroidUI::onKeybinds(CCObject*)
510488
AndroidUI::~AndroidUI()
511489
{
512490
instance = nullptr;
491+
}
492+
493+
void AndroidUI::keyDown(cocos2d::enumKeyCodes key)
494+
{
495+
if (key == enumKeyCodes::KEY_One)
496+
onPressTab(buttons[0]);
497+
498+
if (key == enumKeyCodes::KEY_Two)
499+
onPressTab(buttons[1]);
500+
501+
if (key == enumKeyCodes::KEY_Three)
502+
onPressTab(buttons[2]);
503+
504+
if (key == enumKeyCodes::KEY_Four)
505+
onPressTab(buttons[3]);
506+
507+
if (key == enumKeyCodes::KEY_Five)
508+
onPressTab(buttons[4]);
509+
510+
if (key == enumKeyCodes::KEY_Six)
511+
onPressTab(buttons[5]);
512+
513+
if (key == enumKeyCodes::KEY_Seven)
514+
onPressTab(buttons[6]);
515+
516+
if (key == enumKeyCodes::KEY_Eight)
517+
onPressTab(buttons[7]);
518+
519+
//if (key == enumKeyCodes::KEY_Nine)
520+
// onPressTab(buttons[8]);
521+
522+
//if (key == enumKeyCodes::KEY_Zero)
523+
// onPressTab(buttons[9]);
524+
525+
Popup<>::keyDown(key);
526+
}
527+
528+
void AndroidUI::updateSearchBox()
529+
{
530+
auto en = Client::GetModuleEnabled("ui-search-box");
531+
532+
versionInfo->setVisible(!en);
533+
inputField->setVisible(en);
513534
}

src/Client/AndroidUI.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ class AndroidUI : public geode::Popup<>, TextInputDelegate
2121
CCMenu* searchResultsPanel = nullptr;
2222
CCMenu* btnMenu = nullptr;
2323
TextInput* inputField = nullptr;
24+
CCLabelBMFont* versionInfo;
2425
ScrollLayer* scroll = nullptr;
26+
CCNode* versionParent;
27+
CCNode* checkingSprite;
28+
29+
EventListener<Mod::CheckUpdatesTask> updateListener;
30+
31+
static inline bool hasCheckedForUpdates = false;
32+
static inline bool updateRequired = false;
2533

2634
QOLModMenuBG* bg;
2735

@@ -36,15 +44,17 @@ class AndroidUI : public geode::Popup<>, TextInputDelegate
3644
void onKeybinds(CCObject*);
3745
void onPressTab(CCObject* sender);
3846

47+
void updateVersionLabel();
3948
void updateTabs();
49+
void updateSearchBox();
4050

4151
virtual bool setup();
4252
virtual void textChanged(CCTextInputNode* p0);
4353
virtual void update(float dt);
4454
virtual void keyBackClicked();
55+
virtual void keyDown(cocos2d::enumKeyCodes key);
4556

4657
CCAction* getEnterAction(CCNode* panel);
47-
CCNode* getBGNode();
4858
CCMenu* getSearchPanel();
4959

5060
static AndroidUI* addToScene();

src/Client/Client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool Client::handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey)
5656

5757
bool Client::useImGuiUI()
5858
{
59-
return Mod::get()->getSettingValue<bool>("use-imgui-ui");
59+
return Mod::get()->getSavedValue<bool>("use-imgui-ui");
6060
}
6161

6262
void Client::initImGui()

src/Client/ClientSetup.h

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,12 @@ class ClientUtils
454454
{
455455
auto cfg = new Config();
456456

457-
cfg->modules.push_back(new SliderModule("Anim Speed:", "anim-speed", 0.5f));
457+
auto sbox = new Module("Search Box", "ui-search-box", "Adds a search box to the bottom of the ui instead of <cc>version info</c>.");
458+
sbox->onToggle = [](bool enabled){
459+
460+
};
461+
462+
cfg->modules.push_back(sbox);
458463
cfg->modules.push_back(new Module("Additional Border", "npesta-width", "Adds borders to the left and right sides of the mod menu to make the menu look better with some texture packs\nlike the <cg>npesta</c> pack"));
459464
cfg->modules.push_back(new Module("Blur Background", "menu-bg-blur", "Blurs the background of the mod menu"));
460465

@@ -471,37 +476,8 @@ class ClientUtils
471476
Client::instance->windows.push_back(cfg);
472477
return;
473478
}
474-
475-
Window* replay = new Window();
476-
replay->name = "Config";
477-
replay->id = "options-window";
478-
//replay->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50);
479-
480-
if (android)
481-
{
482-
replay->modules.push_back(new AltModuleLocation());
483-
484-
}
485-
else
486-
{
487-
replay->modules.push_back(new Module("Draggable Ball", "allow-dragging", "Allow dragging the ball on screen"));
488-
}
489-
490-
Client::instance->windows.push_back(replay);
491479
}
492480

493-
/*static void SetupCreator()
494-
{
495-
Window* creator = new Window();
496-
creator->name = "Creator";
497-
creator->id = "creator-window";
498-
creator->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50);
499-
500-
creator->modules.push_back(new Module("Copy Hack", "copy-hack"));
501-
502-
Client::instance->windows.push_back(creator);
503-
}*/
504-
505481
static void SetupVariables(bool android)
506482
{
507483
if (android)

src/Client/Windows/Config.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ void Config::cocosCreate(CCMenu* menu)
5959
CCPoint p;
6060

6161
#ifdef GEODE_IS_DESKTOP
62-
for (size_t i = 1; i < 4; i++)
62+
for (size_t i = 0; i < 4; i++)
6363
#else
64-
for (size_t i = 1; i < 3; i++)
64+
for (size_t i = 0; i < 3; i++)
6565
#endif
6666
{
67-
p = ccp(20, menuTab->getContentHeight() - 45 - (28 * (i - 1)));
67+
p = ccp(20, menuTab->getContentHeight() - 45 - (28 * (i)));
6868
modules[i]->makeAndroid(menuTab, p);
6969
}
7070

src/Hacks/Speedhack.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ float speedhackLogic(float dt)
3939
#endif
4040
ColourUtility::update(dt * v);
4141

42+
#ifdef GEODE_IS_WINDOWS
4243
CCDirector::get()->setActualDeltaTime(CCDirector::get()->getActualDeltaTime() * v);
4344
CCDirector::get()->setDeltaTime(CCDirector::get()->getDeltaTime() * v);
45+
#endif
4446
return dt * v;
4547
}
4648
}

src/UI/CategoryTabSprite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void CategoryTabSprite::setContentSize(const CCSize& contentSize)
8080
if (sprite)
8181
as<AnchorLayoutOptions*>(sprite->getLayoutOptions())->setOffset(ccp(-label->getContentWidth() / 2 - sprite->getScaledContentWidth(), 0));
8282

83-
if (sprite && label->getString() == "")
83+
if (sprite && std::string(label->getString()).empty())
8484
as<AnchorLayoutOptions*>(sprite->getLayoutOptions())->setOffset(CCPointZero);
8585
}
8686

0 commit comments

Comments
 (0)