diff --git a/CMakeLists.txt b/CMakeLists.txt index d2ff2d0..dbe1cf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,11 +18,11 @@ file(GLOB SOURCES src/*/*/*.cpp ) -#if ("${GEODE_TARGET_PLATFORM}" STREQUAL "iOS" OR IOS) -# src/*.mm -# src/*/*.mm -# src/*/*/*.mm -#endif() +file(GLOB OBJC_SOURCES + src/*.mm + src/*/*.mm + src/*/*/*.mm +) add_library(${PROJECT_NAME} SHARED ${SOURCES}) @@ -44,15 +44,10 @@ endif() add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) include_directories(include) -file(READ "modules.txt" MODULES_CONTENT) +add_definitions(-DSTATUS_TEXTS) -string(REGEX REPLACE "\n$" "" MODULES_CONTENT "${MODULES_CONTENT}") -string(REPLACE "\n" ";" MODULES_LIST "${MODULES_CONTENT}") +CPMAddPackage("gh:matcool/gd-imgui-cocos#09a9555") -foreach(MODULE ${MODULES_LIST}) - if(NOT MODULE MATCHES "^//") - add_definitions(-D${MODULE}) - endif() -endforeach() +target_link_libraries(${PROJECT_NAME} imgui-cocos) -setup_geode_mod(${PROJECT_NAME}) +setup_geode_mod(${PROJECT_NAME}) \ No newline at end of file diff --git a/changelog.md b/changelog.md index 4ae9461..6f22cbb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,11 @@ +# 1.6.1 + +- Fixed game loading slowly if speedhack was turned to really low (<0.01) +- Fixed Editor Wave Trail changing the position while not the wave +- Transparent BG Now updates live when you change it +- Added **Hide Pause Menu** +- Added **Auto Clicker** + # 1.6.0 - Fixed Transparent BG not working on apple devices diff --git a/src/Client/Client.cpp b/src/Client/Client.cpp index efef008..115ffba 100644 --- a/src/Client/Client.cpp +++ b/src/Client/Client.cpp @@ -52,4 +52,35 @@ bool Client::handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey) } return false; -} \ No newline at end of file +} + +bool Client::useImGuiUI() +{ + return false; +} + +void Client::initImGui() +{ + ImGuiStyle* style = &ImGui::GetStyle(); + ImGuiIO* io = &ImGui::GetIO(); + + io->ConfigWindowsMoveFromTitleBarOnly = true; + + style->FramePadding = ImVec2(3, 6); + style->Colors[ImGuiCol_TitleBg] = ImVec4(20.0f / 255, 20.0f / 255, 20.0f / 255, 1); +} + +void Client::drawImGui() +{ + for (auto window : windows) + { + window->drawImGui(); + } + + ImGui::ShowStyleEditor(); +} + +void Client::sortWindows() +{ + +} diff --git a/src/Client/Client.h b/src/Client/Client.h index 74808fa..bb1841d 100644 --- a/src/Client/Client.h +++ b/src/Client/Client.h @@ -1,5 +1,6 @@ #pragma once +#include #include "../Defines/Platform.h" #include "Types/InputModule.hpp" @@ -37,6 +38,11 @@ class Client static Client* get(); bool handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey); + + bool useImGuiUI(); + void initImGui(); + void drawImGui(); + void sortWindows(); //[[deprecated("GetModuleEnabled has been deprecated due to lag, please rember to cache the module :3")]] static bool GetModuleEnabled(std::string id) diff --git a/src/Client/ClientSetup.h b/src/Client/ClientSetup.h index 5b65bf0..0326ad7 100644 --- a/src/Client/ClientSetup.h +++ b/src/Client/ClientSetup.h @@ -55,7 +55,7 @@ class ClientUtils Window* speedhack = new Speedhack(); speedhack->name = "Speedhack"; speedhack->id = "speedhack-window"; - speedhack->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 2, 50); + //speedhack->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 2, 50); speedhack->modules.push_back(new SpeedhackTop()); speedhack->modules.push_back(new SpeedhackEnabled()); @@ -73,7 +73,7 @@ class ClientUtils Window* level = new Level(); level->name = "Level"; level->id = "level-window"; - level->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 1, 50); + //level->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 1, 50); level->modules.push_back(new Module("Noclip", "noclip", "Prevents the player from dying")); level->modules.push_back(new Module("Instant Complete", "instant", "Instantly completes a level.\nMay not work because of the Geometry Dash anti-cheat.\nUsing this cheat on a rated level WILL GET YOU LEADERBOARD BANNED", false, "Warning!\nUsing this cheat on a rated level WILL GET YOU LEADERBOARD BANNED", true)); @@ -122,6 +122,8 @@ class ClientUtils level->modules.push_back(new Module("Suicide", "you-should-kill-yourself-now", "Kills the player instantly")); level->modules.push_back(new Module("No Checkpoint Limit", "no-checkpoint-limit", "Removes the 50 checkpoint limit from practice mode")); + + level->modules.push_back(new Module("Auto Clicker", "auto-clicker", "Automatically clicks (and holds for) every X ticks")); //level->modules.push_back(new Module("Frame Stepper", "frame-stepper", "Step the game through frames by tapping a button")); @@ -162,6 +164,13 @@ class ClientUtils //Client::GetModule("smart-startpos")->optionSizeForce = Client::GetModule("smart-startpos")->options[0]->sizeForOptionsPage(); Client::GetModule("custom-respawn-time")->options.push_back(new InputModule("Delay:", "respawn-time-delay", "4.2069")); + + Client::GetModule("auto-clicker")->options.push_back(new InputModule("Interval", "auto-clicker-delay", "6")); + Client::GetModule("auto-clicker")->options.push_back(new InputModule("Hold For", "auto-clicker-hold-for", "3")); + Client::GetModule("auto-clicker")->options.push_back(new Module("Player 1", "auto-clicker-player1", "Should it click for player 1", true)); + Client::GetModule("auto-clicker")->options.push_back(new Module("Player 2", "auto-clicker-player2", "Should it click for player 2", true)); + as(Client::GetModule("auto-clicker")->options[0])->allowedChars = "0123456789"; + as(Client::GetModule("auto-clicker")->options[1])->allowedChars = "0123456789"; } static void SetupBypass() @@ -169,7 +178,7 @@ class ClientUtils Window* bypass = new Window(); bypass->name = "Bypass"; bypass->id = "bypass-window"; - bypass->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); + //bypass->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); //bypass->modules.push_back(new Module("Slider Limit Bypass", "slider-limit", "Allows sliders to go beyond the limit of the slider. Doesn't work for scaling in the editor currently")); @@ -181,7 +190,7 @@ class ClientUtils Window* bypass = new Universal(); bypass->name = "Universal"; bypass->id = "universal-window"; - bypass->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); + //bypass->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); bypass->modules.push_back(new Module("Practice Music Sync", "practice-bypass", "Unlocks the Practice Music Sync button in the pause menu options")); @@ -213,6 +222,8 @@ class ClientUtils bypass->modules.push_back(new Module("Show Touches", "show-touches", "Shows a circle on the screen whenever you touch")); bypass->modules.push_back(new Module("Auto LDM", "auto-ldm", "Automatically enable Low Detail Mode in levels when you view them")); + + bypass->modules.push_back(new Module("Hide Pause Menu", "hide-pause-menu", "Hides the pause menu :3")); Client::instance->windows.push_back(bypass); @@ -235,7 +246,7 @@ class ClientUtils Window* creator = new Window(); creator->name = "Creator"; creator->id = "creator-window"; - creator->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); + //creator->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 0, 50); creator->modules.push_back(new SetValueModule("Set Scale:", "set-scale")); creator->modules.push_back(new SetValueModule("Set Rotation:", "set-rot")); @@ -278,7 +289,7 @@ class ClientUtils Window* cosmetic = new Window(); cosmetic->name = "Cosmetic"; cosmetic->id = "cosmetic-window"; - cosmetic->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 3, 50); + //cosmetic->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 3, 50); //cosmetic->modules.push_back(new Module("Hide Endscreen BTN", "end-screen", "Adds an arrow to hide the end screen")); cosmetic->modules.push_back(new Module("No Transition", "no-trans", "Disables the fade scene transitions")); @@ -357,7 +368,7 @@ class ClientUtils Window* misc = new Window(); misc->name = "Misc"; misc->id = "misc-window"; - misc->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50); + //misc->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50); //misc->modules.push_back(new Module("Use Full Options", "full-options", "Opens the full options menu instead of the mini options in the pause menu.\nAlso adds a button to the normal pause menu to open the mini options.")); @@ -448,7 +459,7 @@ class ClientUtils Window* replay = new Window(); replay->name = "Config"; replay->id = "options-window"; - replay->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50); + //replay->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 4, 50); if (android) { @@ -488,7 +499,7 @@ class ClientUtils Window* theming = new Window(); theming->name = "Theming"; theming->id = "themes-window"; - theming->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 5, 50); + //theming->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 5, 50); theming->modules.push_back(new ColourModule("Accent", "accent-colour", ccc3(10, 0, 0))); @@ -502,7 +513,7 @@ class ClientUtils Window* devtools = new Window(); devtools->name = "Developer"; devtools->id = "devtools-window"; - devtools->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 5, 50); + //devtools->windowPos = ccp(50 + (50 + (Client::instance->tileSize.x)) * 5, 50); devtools->modules.push_back(new Module("Recompile Shader", "recomp-shaders", "Recompiles blur shader")); diff --git a/src/Client/Module.cpp b/src/Client/Module.cpp index 60bd745..ceeffa2 100644 --- a/src/Client/Module.cpp +++ b/src/Client/Module.cpp @@ -2,57 +2,12 @@ #include "../Layers/ModuleOptionsLayer.h" #include "Dropdown.h" -#include "../UI/PCDrawUtils.hpp" -bool Module::touchBegan(CCPoint point, CCTouch* touch) +void Module::drawImGui() { - if (CCRectMake(0, 0, Client::tileSize.x, Client::tileSize.y).containsPoint(point)) - { - log::info("id: {}", id); - mouseHeldDown = true; - - return true; - } - - return false; -} - -bool Module::touchMoved(CCPoint point, CCTouch* touch) -{ - return false; -} - -bool Module::touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled) -{ - if (mouseHeldDown) - { - enabled = !enabled; - save(); - onChange(); - - if (enabled) - enableHooks(); - else - disableHooks(); - - if (enabled) - enablePatches(); - else - disablePatches(); - - mouseHeldDown = false; - } - - return false; -} - - -void Module::drawModule(CCPoint pointTopLeft) -{ - PCDrawUtils::drawRect(pointTopLeft, Client::tileSize, ccc4(0, 0, 255, 255)); + ImGui::Button(this->name.c_str()); } - void Module::onOptionsAndroid(CCObject* sender) { auto dat = static_cast(static_cast(sender)->getUserData()); @@ -87,6 +42,9 @@ void Module::onToggleAndroid(CCObject* sender) else disableHooks(); + if (onToggle) + onToggle(enabled); + return; } @@ -115,6 +73,9 @@ void Module::onToggleAndroid(CCObject* sender) dat->enableHooks(); else dat->disableHooks(); + + if (dat->onToggle) + dat->onToggle(dat->enabled); } void Module::makeAndroid(CCNode* menu, CCPoint pos) diff --git a/src/Client/Module.h b/src/Client/Module.h index 27083e1..a15fff4 100644 --- a/src/Client/Module.h +++ b/src/Client/Module.h @@ -51,7 +51,9 @@ class Module : public UIComponent bool mouseHeldDown = false; + geode::utils::MiniFunction onToggle; ModuleChangeDelegate* delegate = nullptr; + CCSize optionSizeForce = CCSizeZero; void addHookRaw(Result hook); @@ -65,6 +67,8 @@ class Module : public UIComponent void disablePatches(); void enablePatches(); + virtual void drawImGui(); + Module() { @@ -95,17 +99,6 @@ class Module : public UIComponent // options CCSize sizeForOptionsPage(); - - - /// @brief - /// @param point the position of the touch relative to where the module should be drawn - /// @param touch touch - /// @return should stop input passing to gd - bool touchBegan(CCPoint point, CCTouch* touch); - bool touchMoved(CCPoint point, CCTouch* touch); - bool touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled); - - void drawModule(CCPoint pointTopLeft); virtual void onChange() { diff --git a/src/Client/Window.cpp b/src/Client/Window.cpp index 4aed7c5..eded231 100644 --- a/src/Client/Window.cpp +++ b/src/Client/Window.cpp @@ -1,102 +1,33 @@ #include "Client.h" #include "Types/SetValueModule.hpp" -void Window::drawWindow() +void Window::drawImGui() { - if (modules.size() == 0) - return; + ImGui::SetNextWindowPos(windowPos); + ImGui::SetNextWindowSize(ImVec2(215, 25 * (modules.size() + 1))); - auto pos = windowPos + offsetForTime(Client::instance->animStatus); - - PCDrawUtils::drawRect(pos, Client::tileSize, ccc4(255, 0, 0, 255)); - - int i = 0; + ImGui::Begin(this->name.c_str(), nullptr, ImGuiWindowFlags_NoResize); for (auto module : modules) { - auto point = pos + ccp(0, Client::tileSize.y * (i + 1)); - - module->drawModule(point); - - i++; - } -} - -// do clipping stuff: -void Window::preDraw() {} -void Window::postDraw() {} - -CCPoint Window::offsetForTime(float time) -{ - CCPoint wndSize = CCDirector::get()->getWinSize(); - - return ccp(0, wndSize.y * (1 - quadraticEaseInOut(time))); -} - -bool Window::touchBegan(CCPoint point, CCTouch* touch) -{ - auto pos = windowPos + offsetForTime(Client::instance->animStatus); - auto rect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y); - auto wndRect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y * (modules.size() + 1)); - - if (rect.containsPoint(PCDrawUtils::getMousePosition())) - { - dragging = true; - offset = rect.origin - PCDrawUtils::getMousePosition(); - - return true; - } - else - { - int i = 0; - - for (auto mod : modules) - { - if (mod->touchBegan((pos - point) + ccp(0, Client::tileSize.y * i), touch)) - return true; - - i++; - } + module->drawImGui(); } - return false; + ImGui::End(); } -bool Window::touchMoved(CCPoint point, CCTouch* touch) +void Window::setPosition(const CCPoint &position) { - auto pos = windowPos + offsetForTime(Client::instance->animStatus); - auto wndRect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y * (modules.size() + 1)); - - if (dragging) - { - windowPos = PCDrawUtils::getMousePosition() + offset; - windowPos.x = clampf(windowPos.x, 0, CCDirector::get()->getWinSize().width - Client::tileSize.x); - windowPos.y = clampf(windowPos.y, 0, CCDirector::get()->getWinSize().height - (Client::tileSize.y * (modules.size() + 1))); - - return true; - } + CCNode::setPosition(position); - if (true) - { - int i = 0; - - for (auto mod : modules) - { - if (mod->touchMoved((pos - point) + ccp(0, Client::tileSize.y * i), touch)) - return true; - - i++; - } - } - - return false; + windowPos = ImVec2(position.x, position.y); } -bool Window::touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled) +CCPoint Window::offsetForTime(float time) { - dragging = false; + CCPoint wndSize = CCDirector::get()->getWinSize(); - return false; + return ccp(0, wndSize.y * (1 - quadraticEaseInOut(time))); } float Window::quadraticEaseInOut(float t) { diff --git a/src/Client/Window.h b/src/Client/Window.h index a79de92..41541fc 100644 --- a/src/Client/Window.h +++ b/src/Client/Window.h @@ -1,20 +1,19 @@ #pragma once #include -#include "../UI/PCDrawUtils.hpp" #include #include "../Utils/Utils.hpp" - +#include #include "Module.h" -class Window +class Window : public UIComponent { public: std::string name; std::string id; bool excludeAndroid = false; std::vector modules; - CCPoint windowPos = CCPoint(100, 100); + ImVec2 windowPos; Ref scroll; bool dragging = false; @@ -23,15 +22,10 @@ class Window bool isClosed = false; float v = 1.0f; - bool touchBegan(CCPoint point, CCTouch* touch); - bool touchMoved(CCPoint point, CCTouch* touch); - bool touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled); - float quadraticEaseInOut(float t); - void preDraw(); - void drawWindow(); - void postDraw(); + virtual void setPosition(const CCPoint &position); + virtual void drawImGui(); //stolen from stack overflow int getIndex(std::vector v, float K); diff --git a/src/Hacks/AutoClicker.cpp b/src/Hacks/AutoClicker.cpp new file mode 100644 index 0000000..353c2f8 --- /dev/null +++ b/src/Hacks/AutoClicker.cpp @@ -0,0 +1,73 @@ +#include +#include +#include "../Client/Client.h" + +using namespace geode::prelude; + +InputModule* delay; +InputModule* holdFor; +Module* player1; +Module* player2; + +class $modify (AutoBaseGameLayer, GJBaseGameLayer) +{ + struct Fields + { + int frames; + int framesHeld; + bool isHeld; + }; + + void checkRepellPlayer() // Runs every tick + { + GJBaseGameLayer::checkRepellPlayer(); + + auto fcont = m_fields.self(); + + fcont->frames++; + + if (fcont->frames >= delay->getIntValue()) + { + fcont->frames = 0; + fcont->framesHeld = 0; + } + + if (fcont->frames == 0) + { + if (player1->enabled) + this->handleButton(true, as(PlayerButton::Jump), true); + + if (player2->enabled && m_player2 && m_gameState.m_isDualMode) + this->GJBaseGameLayer::handleButton(true, as(PlayerButton::Jump), false); + + fcont->isHeld = true; + } + + if (fcont->framesHeld >= holdFor->getIntValue()) + { + if (player1->enabled) + this->GJBaseGameLayer::handleButton(false, as(PlayerButton::Jump), true); + + if (player2->enabled && m_player2 && m_gameState.m_isDualMode) + this->GJBaseGameLayer::handleButton(false, as(PlayerButton::Jump), false); + + fcont->isHeld = false; + } + + if (m_fields->isHeld) + fcont->framesHeld++; + } + + QOLMOD_MOD_ALL_HOOKS("auto-clicker") +}; + +$execute +{ + Loader::get()->queueInMainThread([] { + auto clicker = Client::GetModule("auto-clicker"); + delay = as(clicker->options[0]); + holdFor = as(clicker->options[1]); + player1 = as(clicker->options[2]); + player2 = as(clicker->options[3]); + }); +} \ No newline at end of file diff --git a/src/Hacks/EditorWaveTrail.cpp b/src/Hacks/EditorWaveTrail.cpp index 8297e5b..3d180c4 100644 --- a/src/Hacks/EditorWaveTrail.cpp +++ b/src/Hacks/EditorWaveTrail.cpp @@ -11,7 +11,7 @@ class $modify (HardStreak) { void updateStroke(float p0) { - if (LevelEditorLayer::get()) + if (auto lel = LevelEditorLayer::get()) m_drawStreak = true; HardStreak::updateStroke(p0); @@ -34,10 +34,18 @@ class $modify (PlayerObject) { PlayerObject::update(dt); - if (LevelEditorLayer::get()) + if (LevelEditorLayer::get() && m_isDart) m_waveTrail->m_currentPoint = this->getPosition(); } + void fadeOutStreak2(float p0) + { + PlayerObject::fadeOutStreak2(p0); + + if (LevelEditorLayer::get()) + m_waveTrail->runAction(CCFadeTo::create(p0, 0)); + } + QOLMOD_MOD_ALL_HOOKS("editor-wave-trail") }; diff --git a/src/Hacks/HidePauseMenu.cpp b/src/Hacks/HidePauseMenu.cpp new file mode 100644 index 0000000..b2e25b6 --- /dev/null +++ b/src/Hacks/HidePauseMenu.cpp @@ -0,0 +1,29 @@ +#include +#include +#include "../Client/Client.h" + +using namespace geode::prelude; + +class $modify (PauseLayer) +{ + virtual void customSetup() + { + PauseLayer::customSetup(); + + this->setVisible(false); + } + + QOLMOD_MOD_HOOK("hide-pause-menu", "PauseLayer::customSetup") +}; + +$execute +{ + Loader::get()->queueInMainThread([] { + Client::GetModule("hide-pause-menu")->onToggle = [](bool enabled){ + if (auto p = getChildOfType(CCScene::get(), 0)) + { + p->setVisible(!enabled); + } + }; + }); +} \ No newline at end of file diff --git a/src/Hacks/Speedhack.cpp b/src/Hacks/Speedhack.cpp index 138dd52..a5030a3 100644 --- a/src/Hacks/Speedhack.cpp +++ b/src/Hacks/Speedhack.cpp @@ -8,6 +8,9 @@ FMOD::ChannelGroup* masterGroup; float speedhackLogic(float dt) { + if (CCScene::get() && getChildOfType(CCScene::get(), 0)) + return dt; + #ifndef GEODE_IS_IOS if (!masterGroup) FMODAudioEngine::sharedEngine()->m_system->getMasterChannelGroup(&masterGroup); diff --git a/src/Hacks/TransparentBG.cpp b/src/Hacks/TransparentBG.cpp index e07e331..8245761 100644 --- a/src/Hacks/TransparentBG.cpp +++ b/src/Hacks/TransparentBG.cpp @@ -7,32 +7,6 @@ using namespace geode::prelude; -/*class $modify (CCSprite) -{ - bool grad; - - virtual bool initWithFile(const char *pszFilename) - { - if (!CCSprite::initWithFile(pszFilename)) - return false; - - if (std::string(pszFilename).starts_with("GJ_gradientBG.png")) - { - m_fields->grad = true; - } - - return true; - } - - virtual void setColor(const ccColor3B& color3) - { - if (m_fields->grad && Client::GetModuleEnabled("trans-bg")) - CCSprite::setColor({255, 255, 255}); - else - CCSprite::setColor(color3); - } -};*/ - std::string getNodeName(CCObject* node) { #ifdef GEODE_IS_WINDOWS return typeid(*node).name() + 6; @@ -52,6 +26,8 @@ std::string getNodeName(CCObject* node) { #endif } +ccColor3B oldColour = ccc3(0, 102, 255); + #ifdef __APPLE__ class $modify (AchievementNotifier) #else @@ -87,6 +63,7 @@ class $modify (AppDelegate) { if (b->getColor().r == 0 && b->getColor().g == 102 && b->getColor().b == 255) { + oldColour = b->getColor(); b->setColor({255, 255, 255}); } } @@ -94,4 +71,42 @@ class $modify (AppDelegate) } } } -}; \ No newline at end of file +}; + +$execute +{ + Loader::get()->queueInMainThread([] { + Client::GetModule("trans-bg")->onToggle = [](bool enabled){ + if (auto scene = CCScene::get()) + { + if (scene->getChildrenCount() > 0) + { + if (auto l = as(scene->getChildren()->objectAtIndex(0)); l->getChildrenCount() > 0) + { + if (getChildOfType(scene, 0)) + return; + + if (getChildOfType(scene, 0)) + return; + + l->sortAllChildren(); + + if (auto b = typeinfo_cast(l->getChildren()->objectAtIndex(0))) + { + if (getNodeName(b).starts_with("cocos2d::CCSprite")) + { + if ((b->getColor().r == 0 && b->getColor().g == 102 && b->getColor().b == 255) || (b->getColor() == ccc3(255, 255, 255))) + { + if (enabled) + b->setColor({255, 255, 255}); + else + b->setColor(oldColour); + } + } + } + } + } + } + }; + }); +} \ No newline at end of file diff --git a/src/UI/PCDrawUtils.cpp b/src/UI/PCDrawUtils.cpp deleted file mode 100644 index 67bb9f1..0000000 --- a/src/UI/PCDrawUtils.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "PCDrawUtils.hpp" - -void PCDrawUtils::drawRect(CCPoint pos, CCPoint size, ccColor4B colour) -{ - auto wndSize = CCDirector::get()->getWinSize(); - - ccDrawSolidRect(ccp(pos.x, wndSize.height - pos.y), ccp(pos.x, wndSize.height - pos.y) + ccp(size.x, -size.y), ccc4FFromccc4B(colour)); -} - -CCPoint PCDrawUtils::getMousePosition() -{ - return ccp(cocos::getMousePos().x, CCDirector::get()->getWinSize().height - cocos::getMousePos().y); -} \ No newline at end of file diff --git a/src/UI/PCDrawUtils.hpp b/src/UI/PCDrawUtils.hpp deleted file mode 100644 index 6b3aeef..0000000 --- a/src/UI/PCDrawUtils.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -using namespace geode::prelude; - -namespace PCDrawUtils -{ - void drawRect(CCPoint pos, CCPoint size, ccColor4B colour); - - CCPoint getMousePosition(); -}; \ No newline at end of file diff --git a/src/UI/PCGuiNode.cpp b/src/UI/PCGuiNode.cpp deleted file mode 100644 index 886aec8..0000000 --- a/src/UI/PCGuiNode.cpp +++ /dev/null @@ -1,167 +0,0 @@ -//#include "PCGuiNode.hpp" -// -//PCGuiNode* PCGuiNode::create() -//{ -// auto pRet = new PCGuiNode(); -// -// if (pRet && pRet->init()) -// { -// pRet->blur = CCBlurLayer::create(); -// pRet->blur->retain(); -// pRet->autorelease(); -// return pRet; -// } -// -// CC_SAFE_DELETE(pRet); -// return nullptr; -//} -// -//PCGuiNode::~PCGuiNode() -//{ -// this->release(); -// blur->release(); -//} -// -//PCGuiNode* PCGuiNode::get() -//{ -// if (!instance) -// { -// instance = PCGuiNode::create(); -// instance->retain(); -// } -// -// return instance; -//} -// -//void PCGuiNode::update(float delta) -//{ -// Client::instance->animStatus += delta * (Client::instance->open ? 1 : -1) / 0.5f; -// Client::instance->animStatus = clampf(Client::instance->animStatus, 0, 1); -// -// Client::instance->delta = delta; -//} -// -//void PCGuiNode::visit() -//{ -// blur->setOpacity(Client::instance->animStatus * 50); -// blur->visit(); -// -// CCNode::visit(); -//} -// -//void PCGuiNode::draw() -//{ -// CCNode::draw(); -// ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -// -// if (!Client::instance) -// return; -// -// for (auto window : Client::instance->windows) -// { -// window->preDraw(); -// window->drawWindow(); -// window->postDraw(); -// } -//} -// -//class $modify (CCEGLView) -//{ -// virtual void swapBuffers() -// { -// PCGuiNode::get()->visit(); -// -// CCEGLView::swapBuffers(); -// } -// -// static void onModify(auto& self) { -// auto it = self.m_hooks.begin(); -// std::advance(it, 0); -// -// if (auto h = it->second.get()) -// { -// if (!Mod::get()->getSettingValue("use-new-ui")) -// h->disable(); -// } -// } -//}; -// -////class $modify (CCDirector) -////{ -//// void drawScene() -//// { -//// CCDirector::drawScene(); -//// -//// PCGuiNode::get()->visit(); -//// } -//// -//// static void onModify(auto& self) { -//// auto it = self.m_hooks.begin(); -//// std::advance(it, 0); -//// -//// if (auto h = it->second.get()) -//// { -//// if (!Mod::get()->getSettingValue("use-new-ui")) -//// h->disable(); -//// } -//// } -////}; -// -//class $modify (CCScheduler) -//{ -// virtual void update(float delta) -// { -// PCGuiNode::get()->update(delta); -// -// CCScheduler::update(delta); -// } -// -// static void onModify(auto& self) { -// auto it = self.m_hooks.begin(); -// std::advance(it, 0); -// -// if (auto h = it->second.get()) -// { -// if (!Mod::get()->getSettingValue("use-new-ui")) -// h->disable(); -// } -// } -//}; -// -//class $modify (CCTouchDispatcher) -//{ -// void touches(CCSet* touches, CCEvent* event, unsigned int type) -// { -// bool disableTouch = false; -// -// if (auto touch = as(touches->anyObject())) -// { -// for (auto window : Client::instance->windows) -// { -// if (type == CCTOUCHBEGAN) -// disableTouch = disableTouch || window->touchBegan(touch->getLocation(), touch); -// -// if (type == CCTOUCHMOVED) -// disableTouch = disableTouch || window->touchMoved(touch->getLocation(), touch); -// -// if (type == CCTOUCHENDED) -// disableTouch = disableTouch || window->touchEndedOrCancelled(touch->getLocation(), touch, false); -// -// if (type == CCTOUCHCANCELLED) -// disableTouch = disableTouch || window->touchEndedOrCancelled(touch->getLocation(), touch, true); -// } -// } -// -// if (!disableTouch) -// return CCTouchDispatcher::touches(touches, event, type); -// } -//}; - -/* -CCTOUCHBEGAN = 0, -CCTOUCHMOVED = 1, -CCTOUCHENDED = 2, -CCTOUCHCANCELLED = 3, - -ccTouchMax = 4, -*/ \ No newline at end of file diff --git a/src/UI/PCGuiNode.hpp b/src/UI/PCGuiNode.hpp deleted file mode 100644 index fedd7bb..0000000 --- a/src/UI/PCGuiNode.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "../Client/Client.h" -#include "../Utils/CCBlurLayer.hpp" - -using namespace geode::prelude; - -class PCGuiNode : public CCNode -{ - private: - static inline PCGuiNode* instance = nullptr; - - public: - int v = 0; - bool drawScene = false; - CCBlurLayer* blur; - CCClippingNode* clip; - - static PCGuiNode* create(); - static PCGuiNode* get(); - - virtual void visit(); - virtual void draw(); - virtual void update(float delta); - - ~PCGuiNode(); -}; \ No newline at end of file diff --git a/src/UI/UIComponent.cpp b/src/UI/UIComponent.cpp index 52308df..2ad7abc 100644 --- a/src/UI/UIComponent.cpp +++ b/src/UI/UIComponent.cpp @@ -1,5 +1,10 @@ #include "UIComponent.hpp" +void UIComponent::drawImGui() +{ + +} + void UIComponent::refreshNode() { diff --git a/src/UI/UIComponent.hpp b/src/UI/UIComponent.hpp index f2fa9f9..626d5d9 100644 --- a/src/UI/UIComponent.hpp +++ b/src/UI/UIComponent.hpp @@ -7,7 +7,7 @@ using namespace geode::prelude; class UIComponent : public CCNode { public: + virtual void drawImGui(); virtual void refreshNode(); - virtual void setParent(CCNode* parent); }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index a080a0a..4588014 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,6 +139,15 @@ class $modify (MenuLayer) if (!v) { + if (Client::get()->useImGuiUI()) + { + ImGuiCocos::get().setup([] { + Client::get()->initImGui(); + }).draw([] { + Client::get()->drawImGui(); + }); + } + if (Client::GetModuleEnabled("save-pos")) { AndroidBall::position = ccp(Mod::get()->getSavedValue("posX", 32), Mod::get()->getSavedValue("posY", CCDirector::get()->getWinSize().height / 2));