From cf36d8f21ff451b13803751b909eb96a410b7861 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:23:27 +0300 Subject: [PATCH 1/5] add rgb color input to cmakelists :sunglasses: --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c08db58d..7d328c63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,11 +13,16 @@ file(GLOB SOURCES src/features/BetterScaling/*.cpp src/features/StartPosSwitcher/*.cpp src/features/OffsetNextFree/*.cpp + src/features/RGBColorInput/*.cpp src/features/*.cpp src/other/*.cpp src/*.cpp ) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") +endif() + # Set up the mod binary add_library(${PROJECT_NAME} SHARED ${SOURCES}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") @@ -34,6 +39,7 @@ add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build) setup_geode_mod(${PROJECT_NAME} EXTERNALS be_team.editorapi:1.0.0) + # Build EditorAPI alongside BetterEdit add_subdirectory(api) target_link_libraries(${PROJECT_NAME} EditorAPI) From ed321435828f1a0e1dff01015881169685e5d7aa Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:53:07 +0300 Subject: [PATCH 2/5] fix startpos switcher crash on editor enter --- CMakeLists.txt | 4 -- .../StartPosSwitcher/StartPosSwitcher.cpp | 42 ++++++++++++------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d328c63..101d02cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,10 +19,6 @@ file(GLOB SOURCES src/*.cpp ) -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") -endif() - # Set up the mod binary add_library(${PROJECT_NAME} SHARED ${SOURCES}) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") diff --git a/src/features/StartPosSwitcher/StartPosSwitcher.cpp b/src/features/StartPosSwitcher/StartPosSwitcher.cpp index 8d47568f..2419dbd4 100644 --- a/src/features/StartPosSwitcher/StartPosSwitcher.cpp +++ b/src/features/StartPosSwitcher/StartPosSwitcher.cpp @@ -63,9 +63,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) { return false; } StartPosManager::get()->setStartPositions(m_objects); - auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); - if (bar) { - bar->setStartPosCounters(); + if (m_editorUI && m_editorUI->getChildren()) { + auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); + if (bar) { + bar->setStartPosCounters(); + } } return true; @@ -74,9 +76,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) { LevelEditorLayer::addSpecial(obj); if (!m_editorInitialising && obj->m_objectID == 31) { StartPosManager::get()->addStartPos(obj->getPosition()); - auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); - if (bar) { - bar->setStartPosCounters(); + if (m_editorUI && m_editorUI->getChildren()) { + auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); + if (bar) { + bar->setStartPosCounters(); + } } } } @@ -96,8 +100,10 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) { manager->clear(); } manager->setStartPositions(m_objects); - auto buttonBar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); - buttonBar->setStartPosCounters(); + if (m_editorUI && m_editorUI->getChildren()) { + auto buttonBar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); + buttonBar->setStartPosCounters(); + } } } @@ -108,6 +114,9 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) { void setupLevelStart(LevelSettingsObject* obj) { StartPosManager::get()->setStartPositions(m_objects); + if (!m_editorInitialising) { + return; + } if (StartPosManager::get()->isLevelStart()) { this->setStartPosObject(nullptr); m_player1->setStartPos(CCPointZero); @@ -122,9 +131,11 @@ class $modify(StartPosSwitchLayer, LevelEditorLayer) { if (!startPos) { Notification::create("Couldn't setup Start Position switcher.", CCSprite::createWithSpriteFrameName("edit_delBtnSmall_001.png"))->show(); StartPosManager::get()->setDefault(); - auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); - if (bar) { - bar->setStartPosCounters(); + if (m_editorUI && m_editorUI->getChildren()) { + auto bar = static_cast(m_editorUI->getChildByID("start-pos-button-bar"_spr)); + if (bar) { + bar->setStartPosCounters(); + } } LevelEditorLayer::setupLevelStart(obj); return; @@ -288,9 +299,12 @@ class $modify(GameObject) { LevelEditorLayer::get(), static_cast(as(this)), [this]() { - auto buttonBar = static_cast(LevelEditorLayer::get()->m_editorUI->getChildByID("start-pos-button-bar"_spr)); - if (buttonBar) { - buttonBar->setStartPosCounters(); + auto editorUI = LevelEditorLayer::get()->m_editorUI; + if (editorUI && editorUI->getChildren()) { + auto buttonBar = static_cast(LevelEditorLayer::get()->m_editorUI->getChildByID("start-pos-button-bar"_spr)); + if (buttonBar) { + buttonBar->setStartPosCounters(); + } } } ); From bb3d0fd579fe3863a93995bd6bd038e6d9f32e02 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:54:41 +0300 Subject: [PATCH 3/5] limit rgb color input to windows for now --- src/features/RGBColorInput/RGBColorInput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/features/RGBColorInput/RGBColorInput.cpp b/src/features/RGBColorInput/RGBColorInput.cpp index af2cc023..1265126c 100644 --- a/src/features/RGBColorInput/RGBColorInput.cpp +++ b/src/features/RGBColorInput/RGBColorInput.cpp @@ -1,3 +1,5 @@ +#ifdef GEODE_IS_WINDOWS + #include #include #include @@ -111,4 +113,6 @@ class $modify(SetupPulsePopup) { m_fields->rgbWidget->setVisible(m_pulseMode == 0); } } -}; \ No newline at end of file +}; + +#endif \ No newline at end of file From b9e426690045529c81bf7ae91f35576bdc634f2b Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:59:07 +0300 Subject: [PATCH 4/5] scratch that it should work on mac now --- src/features/RGBColorInput/RGBColorInput.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/features/RGBColorInput/RGBColorInput.cpp b/src/features/RGBColorInput/RGBColorInput.cpp index 1265126c..49f989f9 100644 --- a/src/features/RGBColorInput/RGBColorInput.cpp +++ b/src/features/RGBColorInput/RGBColorInput.cpp @@ -1,5 +1,3 @@ -#ifdef GEODE_IS_WINDOWS - #include #include #include @@ -104,15 +102,14 @@ class $modify(SetupPulsePopup) { } } - void updatePulseMode() { - SetupPulsePopup::updatePulseMode(); + void onSelectPulseMode(CCObject* sender) { + SetupPulsePopup::onSelectPulseMode(sender); if (!Mod::get()->getSettingValue("rgb-color-input")) { return; } if (m_fields->rgbWidget) { m_fields->rgbWidget->setVisible(m_pulseMode == 0); + m_fields->rgbWidget->updateLabels(true, true); } } }; - -#endif \ No newline at end of file From 91e7125eee9d095bafa786e1d79e7171a5e85534 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Fri, 20 Oct 2023 00:03:29 +0300 Subject: [PATCH 5/5] v5.0.0-alpha.10 --- changelog.md | 5 +++++ mod.json | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 503d6685..95839d61 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# v5.0.0-alpha.10 + + - Fix a crash that could happen when entering the editor + - Correctly enable RGB Color Input + # v5.0.0-alpha.9 - Fix preview mode screwing up moving objects on playtest pause diff --git a/mod.json b/mod.json index 6ac904dd..45b504d0 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "1.3.4", - "version": "v5.0.0-alpha.9", + "version": "v5.0.0-alpha.10", "id": "be_team.betteredit", "name": "BetterEdit", "developer": "BE Team", @@ -54,7 +54,7 @@ "rgb-color-input": { "type": "bool", "default": true, - "name": "RGB + HEX Color Input", + "name": "RGB Color Input", "description": "Adds a widget that allows RGB and HEX input in color edit, color trigger and pulse trigger" }, "editor-pulse": {