diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e34ff6..660b2e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,8 @@ add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) setup_geode_mod(${PROJECT_NAME}) +target_compile_definitions(${PROJECT_NAME} PUBLIC "BETTEREDIT_VERSION_STR=${MOD_VERSION}") + # Bad code will NOT be deployed! if(MSVC) target_compile_options(${PROJECT_NAME} PRIVATE /W4) diff --git a/mod.json b/mod.json index 53ce85d..4deea01 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "3.2.0", - "version": "6.6.5", + "version": "6.7.0", "gd": { "win": "2.206", "mac": "2.206", diff --git a/src/features/Keybinds.cpp b/src/features/Keybinds.cpp index 98ef600..544ea53 100644 --- a/src/features/Keybinds.cpp +++ b/src/features/Keybinds.cpp @@ -151,13 +151,11 @@ struct $modify(EditorUI) { this->moveObjectCall(EditCommand::BigDown); }); - if (isProEnabled()) { + BE_PRO_FEATURE( this->defineKeybind("group-summary"_spr, [this] { - #ifdef BETTEREDIT_PRO GroupSummaryPopup::create()->show(); - #endif }); - } + ); return true; } @@ -469,7 +467,7 @@ struct $modify(EditorUI) { Category::EDITOR_MOVE, true }); - if (isProEnabled()) { + BE_PRO_FEATURE_GLOBAL( BindManager::get()->registerBindable({ "group-summary"_spr, "Open Group Summary", @@ -477,7 +475,7 @@ struct $modify(EditorUI) { {}, Category::EDITOR, false }); - } + ); } #endif diff --git a/src/features/MoveMenu.cpp b/src/features/MoveMenu.cpp index 6d51bb8..1bb66f6 100644 --- a/src/features/MoveMenu.cpp +++ b/src/features/MoveMenu.cpp @@ -186,9 +186,10 @@ class CustomEditMenu : public CCNode { return nullptr; } - if (isProUIEnabled()) { - return nullptr; - } + // todo: pro + // if (isProUIEnabled()) { + // return nullptr; + // } if (create) { auto winSize = CCDirector::get()->getWinSize(); diff --git a/src/features/TypeInZLayer.cpp b/src/features/TypeInZLayer.cpp index fff2ecf..a2ae3ad 100644 --- a/src/features/TypeInZLayer.cpp +++ b/src/features/TypeInZLayer.cpp @@ -19,9 +19,10 @@ class $modify(TypeInUI, EditorUI) { if (!EditorUI::init(lel)) return false; - if (isProUIEnabled()) { - return true; - } + // todo: pro + // if (isProUIEnabled()) { + // return true; + // } auto layerMenu = this->getChildByID("layer-menu"); layerMenu->setContentSize({ 130, layerMenu->getContentSize().height }); diff --git a/src/features/about/AboutBEButton.cpp b/src/features/about/AboutBEButton.cpp index 5d14ecd..c71c78f 100644 --- a/src/features/about/AboutBEButton.cpp +++ b/src/features/about/AboutBEButton.cpp @@ -4,6 +4,7 @@ #include #include "AboutBEPopup.hpp" #include "SupportPopup.hpp" +#include using namespace geode::prelude; @@ -70,6 +71,12 @@ class $modify(AboutBEPauseLayer, EditorPauseLayer) { topMenu->addChild(supportBtn); topMenu->updateLayout(); } + + BE_PRO_FEATURE( + if (auto btn = this->querySelector("support-be-btn"_spr)) { + btn->removeFromParent(); + } + ); } auto menu = this->getChildByID("guidelines-menu"); diff --git a/src/features/about/AboutBEPopup.cpp b/src/features/about/AboutBEPopup.cpp index fd8f553..0bcfd35 100644 --- a/src/features/about/AboutBEPopup.cpp +++ b/src/features/about/AboutBEPopup.cpp @@ -5,6 +5,11 @@ #include #include #include +#include + +#ifdef BETTEREDIT_PRO +#include +#endif struct Dev { const char* name; @@ -51,7 +56,7 @@ bool AboutBEPopup::setup() { auto developedBy = CCLabelBMFont::create("Developed by", "goldFont.fnt"); developedBy->setScale(.7f); - m_mainLayer->addChildAtPosition(developedBy, Anchor::Center, ccp(0, 85)); + m_mainLayer->addChildAtPosition(developedBy, Anchor::Center, ccp(0, 90)); auto hjfod = Dev { .name = "HJfod", @@ -62,13 +67,13 @@ bool AboutBEPopup::setup() { { "geode.loader/gift.png", "https://ko-fi.com/hjfod" }, } }.create(this, true); - m_mainLayer->addChildAtPosition(hjfod, Anchor::Center, ccp(0, 55)); + m_mainLayer->addChildAtPosition(hjfod, Anchor::Center, ccp(0, 60)); // other devs auto credits = CCLabelBMFont::create("Contributors", "goldFont.fnt"); credits->setScale(.6f); - m_mainLayer->addChildAtPosition(credits, Anchor::Center, ccp(0, 10)); + m_mainLayer->addChildAtPosition(credits, Anchor::Center, ccp(0, 15)); auto devs = CCNode::create(); devs->setContentSize({ 325, 90 }); @@ -126,7 +131,7 @@ bool AboutBEPopup::setup() { ->setCrossAxisOverflow(true) ->setGap(20.f) ); - m_mainLayer->addChildAtPosition(devs, Anchor::Center, ccp(0, -20)); + m_mainLayer->addChildAtPosition(devs, Anchor::Center, ccp(0, -15)); // actions @@ -140,6 +145,7 @@ bool AboutBEPopup::setup() { { "Changelog", menu_selector(AboutBEPopup::onChangelog) }, { "Special Thanks", menu_selector(AboutBEPopup::onSpecialThanks) }, { "Support BE", menu_selector(AboutBEPopup::onSupport) }, + { "Supporters", menu_selector(AboutBEPopup::onSupporters) }, }) { auto spr = ButtonSprite::create(pair.first, "goldFont.fnt", "GJ_button_05.png", .8f); spr->setScale(.55f); @@ -148,7 +154,14 @@ bool AboutBEPopup::setup() { } menu->setLayout(RowLayout::create()->setGrowCrossAxis(true)); - m_mainLayer->addChildAtPosition(menu, Anchor::Center, ccp(0, -70)); + m_mainLayer->addChildAtPosition(menu, Anchor::Center, ccp(0, -60)); + + BE_PRO_FEATURE( + auto label = CCLabelBMFont::create("Thank You for Supporting BetterEdit <3", "bigFont.fnt"); + label->setColor({ 55, 255, 255 }); + label->setScale(.35f); + m_mainLayer->addChildAtPosition(label, Anchor::Center, ccp(0, -95)); + ); // BE links @@ -188,6 +201,11 @@ void AboutBEPopup::onSupport(CCObject*) { SupportPopup::create(false)->show(); // openSupportPopup(Mod::get()); } +void AboutBEPopup::onSupporters(CCObject*) { +#ifdef BETTEREDIT_PRO + pro::SupportersPopup::create()->show(); +#endif +} void AboutBEPopup::onSuggestFeature(CCObject*) { createQuickPopup( diff --git a/src/features/about/AboutBEPopup.hpp b/src/features/about/AboutBEPopup.hpp index 5f77b74..8b504ff 100644 --- a/src/features/about/AboutBEPopup.hpp +++ b/src/features/about/AboutBEPopup.hpp @@ -16,6 +16,7 @@ class AboutBEPopup : public PopupWithCorners<> { void onReportBug(CCObject*); void onSuggestFeature(CCObject*); void onSupport(CCObject*); + void onSupporters(CCObject*); void onChangelog(CCObject*); void onSpecialThanks(CCObject*); void onDevLink(CCObject* sender); diff --git a/src/features/scaling/EditorUIScaling.cpp b/src/features/scaling/EditorUIScaling.cpp index 84b0cbd..3d5de91 100644 --- a/src/features/scaling/EditorUIScaling.cpp +++ b/src/features/scaling/EditorUIScaling.cpp @@ -21,9 +21,7 @@ class $modify(ScaledUI, EditorUI) { if (!EditorUI::init(p0)) return false; - if (isProUIEnabled()) { - return true; - } + // todo: pro compatability float scale = Mod::get()->getSettingValue("scale-factor"); auto size = CCDirector::get()->getWinSize(); @@ -158,10 +156,6 @@ class $modify(ScaledUI, EditorUI) { } void centerBuildTabs() { - if (isProUIEnabled()) { - return; - } - // This centers the build tab auto winSize = CCDirector::get()->getWinSize(); for (auto c : CCArrayExt(this->getChildren())) { diff --git a/src/utils/NextFreeOffsetInput.hpp b/src/utils/NextFreeOffsetInput.hpp index dc26ce2..db50046 100644 --- a/src/utils/NextFreeOffsetInput.hpp +++ b/src/utils/NextFreeOffsetInput.hpp @@ -51,7 +51,6 @@ class NextFreeOffsetInput : public CCNode { m_input->setString(numToString(s_value)); } m_input->setCallback([](auto str) { - log::info("hi: {}", str); if (auto value = numFromString(str)) { s_value = clamp(value.unwrap(), Source::MIN_VALUE, Source::MAX_VALUE); } diff --git a/src/utils/Pro.hpp b/src/utils/Pro.hpp index d5896fd..875dcee 100644 --- a/src/utils/Pro.hpp +++ b/src/utils/Pro.hpp @@ -10,19 +10,25 @@ BE_ALLOW_START BE_ALLOW_UNUSED_FUNCTION -static bool isProUIEnabled() { #ifdef BETTEREDIT_PRO - return pro::isNewUIEnabled(); -#else - return false; -#endif -} -static bool isProEnabled() { -#ifdef BETTEREDIT_PRO - return pro::isProEnabled(); + #define BE_PRO_FEATURE(...) \ + pro::checkProEnabled() \ + .listen([this](auto* value) { \ + if (pro::verifyPro<__LINE__>(*value) == (__LINE__ + pro::ssl::MAGIC_OK)) { \ + __VA_ARGS__; \ + } \ + }) + + #define BE_PRO_FEATURE_GLOBAL(...) \ + pro::checkProEnabled() \ + .listen([](auto* value) { \ + if (pro::verifyPro<__LINE__>(*value) == (__LINE__ + pro::ssl::MAGIC_OK)) { \ + __VA_ARGS__; \ + } \ + }) #else - return false; + #define BE_PRO_FEATURE(...) + #define BE_PRO_FEATURE_GLOBAL(...) #endif -} BE_ALLOW_END