From ace9097c1b9a2d8b0c81c7cf0bb5ba3acd62e663 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Mon, 28 Apr 2025 09:19:02 -0400 Subject: [PATCH 01/36] SimpleAxisLayout! --- mod.json | 2 +- src/pages/Attributes.cpp | 223 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 223 insertions(+), 2 deletions(-) diff --git a/mod.json b/mod.json index b5bf4f5..529364e 100644 --- a/mod.json +++ b/mod.json @@ -1,5 +1,5 @@ { - "geode": "4.0.0-beta.1", + "geode": "4.3.1", "version": "v1.8.0", "gd": { "win": "*", diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index abc3e3e..36295d5 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -132,7 +132,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { auto color = rgbaNode->getColor(); float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, rgbaNode->getOpacity() / 255.f }; if (ImGui::ColorEdit4("Color", _color)) { - rgbaNode->setColor({ + rgbaNode->setColor(ccColor3B{ static_cast(_color[0] * 255), static_cast(_color[1] * 255), static_cast(_color[2] * 255) @@ -306,6 +306,224 @@ void DevTools::drawNodeAttributes(CCNode* node) { node->addChild(btn); node->updateLayout(); } + if (auto layout = typeinfo_cast(rawLayout)) { + bool updateLayout = false; + auto axis = static_cast(layout->getAxis()); + ImGui::Text("Axis"); + auto updateAxis = false; + updateAxis |= ImGui::RadioButton("Row", &axis, static_cast(Axis::Row)); + ImGui::SameLine(); + updateAxis |= ImGui::RadioButton("Column", &axis, static_cast(Axis::Column)); + if (updateAxis) { + if (layout->getAxis() != static_cast(axis)) { + node->setContentSize({ + node->getContentSize().height, + node->getContentSize().width + }); + } + layout->setAxis(static_cast(axis)); + updateLayout = true; + } + { + auto axisScaling = static_cast(layout->getMainAxisScaling()); + ImGui::Text("Main Axis Scaling"); + bool updateScaling = false; + updateScaling |= ImGui::RadioButton( + "None", &axisScaling, static_cast(AxisScaling::None) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale Down", &axisScaling, static_cast(AxisScaling::ScaleDown) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale", &axisScaling, static_cast(AxisScaling::Scale) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Grow", &axisScaling, static_cast(AxisScaling::Grow) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Fit", &axisScaling, static_cast(AxisScaling::Fit) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale Down Gaps", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) + ); + if (updateScaling) { + layout->setMainAxisScaling(static_cast(axisScaling)); + updateLayout = true; + } + } + { + auto axisScaling = static_cast(layout->getCrossAxisScaling()); + ImGui::Text("Cross Axis Scaling"); + bool updateScaling = false; + updateScaling |= ImGui::RadioButton( + "None", &axisScaling, static_cast(AxisScaling::None) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale Down", &axisScaling, static_cast(AxisScaling::ScaleDown) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale", &axisScaling, static_cast(AxisScaling::Scale) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Grow", &axisScaling, static_cast(AxisScaling::Grow) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Fit", &axisScaling, static_cast(AxisScaling::Fit) + ); + ImGui::SameLine(); + updateScaling |= ImGui::RadioButton( + "Scale Down Gaps", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) + ); + if (updateScaling) { + layout->setCrossAxisScaling(static_cast(axisScaling)); + updateLayout = true; + } + } + { + auto align = static_cast(layout->getMainAxisAlignment()); + ImGui::Text("Main Axis Alignment"); + bool updateAlign = false; + updateAlign |= ImGui::RadioButton( + "Start", &align, static_cast(MainAxisAlignment::Start) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "Center", &align, static_cast(MainAxisAlignment::Center) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "End", &align, static_cast(MainAxisAlignment::End) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "Even", &align, static_cast(MainAxisAlignment::Even) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "Between", &align, static_cast(MainAxisAlignment::Between) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "Around", &align, static_cast(MainAxisAlignment::Around) + ); + if (updateAlign) { + layout->setMainAxisAlignment(static_cast(align)); + updateLayout = true; + } + } + { + auto align = static_cast(layout->getCrossAxisAlignment()); + ImGui::Text("Cross Axis Alignment"); + bool updateAlign = false; + updateAlign |= ImGui::RadioButton( + "Start", &align, static_cast(CrossAxisAlignment::Start) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "Center", &align, static_cast(CrossAxisAlignment::Center) + ); + ImGui::SameLine(); + updateAlign |= ImGui::RadioButton( + "End", &align, static_cast(CrossAxisAlignment::End) + ); + if (updateAlign) { + layout->setCrossAxisAlignment(static_cast(align)); + updateLayout = true; + } + } + { + auto direction = static_cast(layout->getMainAxisDirection()); + ImGui::Text("Main Axis Direction"); + bool updateDirection = false; + updateDirection |= ImGui::RadioButton( + "Front to Back", &direction, static_cast(AxisDirection::FrontToBack) + ); + ImGui::SameLine(); + updateDirection |= ImGui::RadioButton( + "Back to front", &direction, static_cast(AxisDirection::BackToFront) + ); + if (updateDirection) { + layout->setMainAxisDirection(static_cast(direction)); + updateLayout = true; + } + } + { + auto direction = static_cast(layout->getCrossAxisDirection()); + ImGui::Text("Cross Axis Direction"); + bool updateDirection = false; + updateDirection |= ImGui::RadioButton( + "Front to Back", &direction, static_cast(AxisDirection::FrontToBack) + ); + ImGui::SameLine(); + updateDirection |= ImGui::RadioButton( + "Back to front", &direction, static_cast(AxisDirection::BackToFront) + ); + if (updateDirection) { + layout->setCrossAxisDirection(static_cast(direction)); + updateLayout = true; + } + } + + auto gap = layout->getGap(); + if (ImGui::DragFloat("Gap", &gap)) { + layout->setGap(gap); + updateLayout = true; + } + + auto minRelativeScaleOpt = layout->getMinRelativeScale(); + float minRelativeScale = minRelativeScaleOpt.value_or(0); + bool hasMinRelativeScale = minRelativeScaleOpt.has_value(); + + if (ImGui::Checkbox("Has Min Relative Scale", &hasMinRelativeScale)) { + if (hasMinRelativeScale) { + layout->setMinRelativeScale(0); + } + else { + layout->setMinRelativeScale(std::nullopt); + } + updateLayout = true; + } + + if (ImGui::DragFloat("Min Relative Scale", &minRelativeScale)) { + if (hasMinRelativeScale) { + layout->setMinRelativeScale(minRelativeScale); + updateLayout = true; + } + } + + auto maxRelativeScaleOpt = layout->getMaxRelativeScale(); + float maxRelativeScale = maxRelativeScaleOpt.value_or(0); + bool hasMaxRelativeScale = maxRelativeScaleOpt.has_value(); + if (ImGui::Checkbox("Has Max Relative Scale", &hasMaxRelativeScale)) { + if (hasMaxRelativeScale) { + layout->setMaxRelativeScale(0); + } + else { + layout->setMaxRelativeScale(std::nullopt); + } + updateLayout = true; + } + + if (ImGui::DragFloat("Max Relative Scale", &maxRelativeScale)) { + if (hasMaxRelativeScale) { + layout->setMaxRelativeScale(maxRelativeScale); + updateLayout = true; + } + } + + if (updateLayout) { + node->updateLayout(); + } + } if (auto layout = typeinfo_cast(rawLayout)) { bool updateLayout = false; @@ -454,6 +672,9 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } else { + if (ImGui::Button(U8STR(FEATHER_PLUS " Add SimpleAxisLayout"))) { + node->setLayout(SimpleAxisLayout::create(Axis::Row)); + } if (ImGui::Button(U8STR(FEATHER_PLUS " Add AxisLayout"))) { node->setLayout(AxisLayout::create()); } From 8cd88ca70d06c33b4f72d774b7a7a5f126e2b9ae Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:08:07 -0400 Subject: [PATCH 02/36] Forgor IDs for duplicates, fixed :3 --- src/pages/Attributes.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 36295d5..cdc85c2 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -361,27 +361,27 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Cross Axis Scaling"); bool updateScaling = false; updateScaling |= ImGui::RadioButton( - "None", &axisScaling, static_cast(AxisScaling::None) + "None##crossscale0", &axisScaling, static_cast(AxisScaling::None) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale Down", &axisScaling, static_cast(AxisScaling::ScaleDown) + "Scale Down##crossscale1", &axisScaling, static_cast(AxisScaling::ScaleDown) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale", &axisScaling, static_cast(AxisScaling::Scale) + "Scale##crossscale2", &axisScaling, static_cast(AxisScaling::Scale) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Grow", &axisScaling, static_cast(AxisScaling::Grow) + "Grow##crossscale3", &axisScaling, static_cast(AxisScaling::Grow) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Fit", &axisScaling, static_cast(AxisScaling::Fit) + "Fit##crossscale4", &axisScaling, static_cast(AxisScaling::Fit) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale Down Gaps", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) + "Scale Down Gaps##crossscale5", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) ); if (updateScaling) { layout->setCrossAxisScaling(static_cast(axisScaling)); @@ -425,15 +425,15 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Cross Axis Alignment"); bool updateAlign = false; updateAlign |= ImGui::RadioButton( - "Start", &align, static_cast(CrossAxisAlignment::Start) + "Start##crossalign0", &align, static_cast(CrossAxisAlignment::Start) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Center", &align, static_cast(CrossAxisAlignment::Center) + "Center##crossalign1", &align, static_cast(CrossAxisAlignment::Center) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "End", &align, static_cast(CrossAxisAlignment::End) + "End##crossalign2", &align, static_cast(CrossAxisAlignment::End) ); if (updateAlign) { layout->setCrossAxisAlignment(static_cast(align)); @@ -461,11 +461,11 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Cross Axis Direction"); bool updateDirection = false; updateDirection |= ImGui::RadioButton( - "Front to Back", &direction, static_cast(AxisDirection::FrontToBack) + "Front to Back##crossdirection0", &direction, static_cast(AxisDirection::FrontToBack) ); ImGui::SameLine(); updateDirection |= ImGui::RadioButton( - "Back to front", &direction, static_cast(AxisDirection::BackToFront) + "Back to front##crossdirection1", &direction, static_cast(AxisDirection::BackToFront) ); if (updateDirection) { layout->setCrossAxisDirection(static_cast(direction)); From 472dcf554021d63acd63358d40d0cc24e033d5c2 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:16:30 -0400 Subject: [PATCH 03/36] Use correct direction names --- src/pages/Attributes.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index cdc85c2..730890a 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -440,16 +440,20 @@ void DevTools::drawNodeAttributes(CCNode* node) { updateLayout = true; } } + + std::string axisDirection = axis ? "Left to Right" : "Bottom to Top"; + std::string secondAxisDirection = axis ? "Right to Left" : "Top to Bottom"; { auto direction = static_cast(layout->getMainAxisDirection()); ImGui::Text("Main Axis Direction"); bool updateDirection = false; + updateDirection |= ImGui::RadioButton( - "Front to Back", &direction, static_cast(AxisDirection::FrontToBack) + axisDirection.c_str(), &direction, static_cast(AxisDirection::FrontToBack) ); ImGui::SameLine(); updateDirection |= ImGui::RadioButton( - "Back to front", &direction, static_cast(AxisDirection::BackToFront) + secondAxisDirection.c_str(), &direction, static_cast(AxisDirection::BackToFront) ); if (updateDirection) { layout->setMainAxisDirection(static_cast(direction)); @@ -461,11 +465,11 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Cross Axis Direction"); bool updateDirection = false; updateDirection |= ImGui::RadioButton( - "Front to Back##crossdirection0", &direction, static_cast(AxisDirection::FrontToBack) + fmt::format("{}##crossdirection0", axisDirection).c_str(), &direction, static_cast(AxisDirection::FrontToBack) ); ImGui::SameLine(); updateDirection |= ImGui::RadioButton( - "Back to front##crossdirection1", &direction, static_cast(AxisDirection::BackToFront) + fmt::format("{}##crossdirection0", secondAxisDirection).c_str(), &direction, static_cast(AxisDirection::BackToFront) ); if (updateDirection) { layout->setCrossAxisDirection(static_cast(direction)); From 30f4cbadf086a587c78b6e90dfc11824e1d5d669 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:18:15 -0400 Subject: [PATCH 04/36] Accidentally flipped them --- src/pages/Attributes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 730890a..d6aa5ea 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -441,8 +441,8 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } - std::string axisDirection = axis ? "Left to Right" : "Bottom to Top"; - std::string secondAxisDirection = axis ? "Right to Left" : "Top to Bottom"; + std::string axisDirection = axis ? "Bottom to Top" : "Left to Right"; + std::string secondAxisDirection = axis ? "Top to Bottom" : "Right to Left"; { auto direction = static_cast(layout->getMainAxisDirection()); ImGui::Text("Main Axis Direction"); @@ -469,7 +469,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { ); ImGui::SameLine(); updateDirection |= ImGui::RadioButton( - fmt::format("{}##crossdirection0", secondAxisDirection).c_str(), &direction, static_cast(AxisDirection::BackToFront) + fmt::format("{}##crossdirection1", secondAxisDirection).c_str(), &direction, static_cast(AxisDirection::BackToFront) ); if (updateDirection) { layout->setCrossAxisDirection(static_cast(direction)); From 63a93bfb4ee5b7483bd7fa5879ff18bdb795db82 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:20:59 -0400 Subject: [PATCH 05/36] Actually not fuck it up this time --- src/pages/Attributes.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index d6aa5ea..86cbc27 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -443,6 +443,9 @@ void DevTools::drawNodeAttributes(CCNode* node) { std::string axisDirection = axis ? "Bottom to Top" : "Left to Right"; std::string secondAxisDirection = axis ? "Top to Bottom" : "Right to Left"; + + std::string crossAxisDirection = !axis ? "Bottom to Top" : "Left to Right"; + std::string secondcrossAxisDirection = !axis ? "Top to Bottom" : "Right to Left"; { auto direction = static_cast(layout->getMainAxisDirection()); ImGui::Text("Main Axis Direction"); @@ -465,11 +468,11 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Cross Axis Direction"); bool updateDirection = false; updateDirection |= ImGui::RadioButton( - fmt::format("{}##crossdirection0", axisDirection).c_str(), &direction, static_cast(AxisDirection::FrontToBack) + crossAxisDirection.c_str(), &direction, static_cast(AxisDirection::FrontToBack) ); ImGui::SameLine(); updateDirection |= ImGui::RadioButton( - fmt::format("{}##crossdirection1", secondAxisDirection).c_str(), &direction, static_cast(AxisDirection::BackToFront) + secondcrossAxisDirection.c_str(), &direction, static_cast(AxisDirection::BackToFront) ); if (updateDirection) { layout->setCrossAxisDirection(static_cast(direction)); From 9d6e05fd5231ce164248281f988be1166927cbf5 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:04:24 -0400 Subject: [PATCH 06/36] Remove layout button for convenience --- src/pages/Attributes.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 86cbc27..f2b85f3 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -300,6 +300,10 @@ void DevTools::drawNodeAttributes(CCNode* node) { node->updateLayout(); } ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_TRASH_2 " Remove Layout"))) { + node->setLayout(nullptr); + } + ImGui::SameLine(); if (ImGui::Button(U8STR(FEATHER_PLUS " Add Test Child"))) { auto spr = CCSprite::create("GJ_button_01.png"); auto btn = CCMenuItemSpriteExtra::create(spr, node, nullptr); From 5fb72bdc73a45e0f25b1270232f9301a50ef760a Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:06:19 -0400 Subject: [PATCH 07/36] Hide input if unchecked --- src/pages/Attributes.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index f2b85f3..88442b3 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -503,11 +503,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { } updateLayout = true; } - - if (ImGui::DragFloat("Min Relative Scale", &minRelativeScale)) { - if (hasMinRelativeScale) { + if (hasMinRelativeScale) { + if (ImGui::DragFloat("Min Relative Scale", &minRelativeScale)) { + layout->setMinRelativeScale(minRelativeScale); updateLayout = true; + } } @@ -524,8 +525,8 @@ void DevTools::drawNodeAttributes(CCNode* node) { updateLayout = true; } - if (ImGui::DragFloat("Max Relative Scale", &maxRelativeScale)) { - if (hasMaxRelativeScale) { + if (hasMaxRelativeScale) { + if (ImGui::DragFloat("Max Relative Scale", &maxRelativeScale)) { layout->setMaxRelativeScale(maxRelativeScale); updateLayout = true; } From ab6410fbd45e474e50f47e42b2ea6ca593606aca Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:51:40 -0400 Subject: [PATCH 08/36] Layout Options and cleanup - Add missing AxisLayoutOptions options - Fix AxisLayoutOptions Auto Scale being inversed - Add SimpleAxisLayoutOptions - Add the ability to remove Layout Options - Move Touch Prio into attributes - Preemptively add IDs to prevent future collisions --- src/pages/Attributes.cpp | 303 ++++++++++++++++++++++++++++++++++----- 1 file changed, 265 insertions(+), 38 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 88442b3..e538b49 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -177,6 +177,16 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } + if (auto delegate = typeinfo_cast(node)) { + if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { + auto priority = handler->getPriority(); + + if (ImGui::DragInt("Touch Priority", &priority, .03f)) { + CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); + } + } + } + ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine(); @@ -189,26 +199,207 @@ void DevTools::drawNodeAttributes(CCNode* node) { parent->updateLayout(); } } + ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_TRASH_2 " Remove Layout Options"))) { + node->setLayoutOptions(nullptr); + } + if (auto opts = typeinfo_cast(rawOpts)) { + bool updateLayout = false; + auto minRelativeScaleOpt = opts->getMinRelativeScale(); + float minRelativeScale = minRelativeScaleOpt.value_or(0); + bool hasMinRelativeScale = minRelativeScaleOpt.has_value(); + + if (ImGui::Checkbox("Has Min Relative Scale##simplescale0", &hasMinRelativeScale)) { + if (hasMinRelativeScale) { + opts->setMinRelativeScale(0); + } + else { + opts->setMinRelativeScale(std::nullopt); + } + updateLayout = true; + } + if (hasMinRelativeScale) { + if (ImGui::DragFloat("Min Relative Scale##simplescale1", &minRelativeScale)) { + + opts->setMinRelativeScale(minRelativeScale); + updateLayout = true; + } + } + + auto maxRelativeScaleOpt = opts->getMaxRelativeScale(); + float maxRelativeScale = maxRelativeScaleOpt.value_or(0); + bool hasMaxRelativeScale = maxRelativeScaleOpt.has_value(); + if (ImGui::Checkbox("Has Max Relative Scale##simplescale2", &hasMaxRelativeScale)) { + if (hasMaxRelativeScale) { + opts->setMaxRelativeScale(0); + } + else { + opts->setMaxRelativeScale(std::nullopt); + } + updateLayout = true; + } + + if (hasMaxRelativeScale) { + if (ImGui::DragFloat("Max Relative Scale##simplescale3", &maxRelativeScale)) { + opts->setMaxRelativeScale(maxRelativeScale); + updateLayout = true; + } + } + + int scalingPriority = static_cast(opts->getScalingPriority()); + + ImGui::Text("Scaling Priority"); + bool updateScalePrio = false; + updateScalePrio |= ImGui::RadioButton( + "First##scalepriooption1", &scalingPriority, static_cast(ScalingPriority::First) + ); + ImGui::SameLine(); + updateScalePrio |= ImGui::RadioButton( + "Early##scalepriooption2", &scalingPriority, static_cast(ScalingPriority::Early) + ); + ImGui::SameLine(); + updateScalePrio |= ImGui::RadioButton( + "Normal##scalepriooption3", &scalingPriority, static_cast(ScalingPriority::Normal) + ); + ImGui::SameLine(); + updateScalePrio |= ImGui::RadioButton( + "Late##scalepriooption4", &scalingPriority, static_cast(ScalingPriority::Late) + ); + ImGui::SameLine(); + updateScalePrio |= ImGui::RadioButton( + "Last##scalepriooption4", &scalingPriority, static_cast(ScalingPriority::Last) + ); + ImGui::SameLine(); + updateScalePrio |= ImGui::RadioButton( + "Never##alignmentoption0", &scalingPriority, static_cast(ScalingPriority::Never) + ); + if (updateScalePrio) { + opts->setScalingPriority(static_cast(scalingPriority)); + updateLayout = true; + } + + if (updateLayout && node->getParent()) { + node->getParent()->updateLayout(); + } + } if (auto opts = typeinfo_cast(rawOpts)) { bool updateLayout = false; ImGui::Text("Auto Scale"); auto updateAxis = false; - int autoScale = opts->getAutoScale() ? opts->getAutoScale().value() + 1 : 0; - updateAxis |= ImGui::RadioButton("Default", &autoScale, 0); + int autoScale = opts->getAutoScale().has_value() ? opts->getAutoScale().value() : -1; + updateAxis |= ImGui::RadioButton("Default##autoscale0", &autoScale, -1); ImGui::SameLine(); - updateAxis |= ImGui::RadioButton("Enable", &autoScale, 1); + updateAxis |= ImGui::RadioButton("Enable##autoscale1", &autoScale, 1); ImGui::SameLine(); - updateAxis |= ImGui::RadioButton("Disable", &autoScale, 2); + updateAxis |= ImGui::RadioButton("Disable##autoscale2", &autoScale, 0); if (updateAxis) { switch (autoScale) { - case 0: opts->setAutoScale(std::nullopt); break; + case -1: opts->setAutoScale(std::nullopt); break; + case 0: opts->setAutoScale(false); break; case 1: opts->setAutoScale(true); break; - case 2: opts->setAutoScale(false); break; } updateLayout = true; } + auto minScale = opts->getMinScale(); + bool hasMinScale = opts->hasExplicitMinScale(); + auto maxScale = opts->getMaxScale(); + bool hasMaxScale = opts->hasExplicitMaxScale(); + + if (ImGui::Checkbox("Has Min Scale", &hasMinScale)) { + if (hasMinScale) { + opts->setScaleLimits(minScale, hasMaxScale ? std::optional(maxScale) : std::nullopt); + } + else { + opts->setScaleLimits(std::nullopt, hasMaxScale ? std::optional(maxScale) : std::nullopt); + } + updateLayout = true; + } + if (hasMinScale) { + if (ImGui::DragFloat("Min Scale", &minScale)) { + opts->setScaleLimits(minScale, maxScale); + updateLayout = true; + } + } + + if (ImGui::Checkbox("Has Max Scale", &hasMaxScale)) { + if (hasMaxScale) { + opts->setScaleLimits(hasMinScale ? std::optional(minScale) : std::nullopt, maxScale); + } + else { + opts->setScaleLimits(hasMinScale ? std::optional(minScale) : std::nullopt, std::nullopt); + } + updateLayout = true; + } + + if (hasMaxScale) { + if (ImGui::DragFloat("Max Scale", &maxScale)) { + opts->setScaleLimits(minScale, maxScale); + updateLayout = true; + } + } + + auto lengthOpt = opts->getLength(); + float length = lengthOpt.value_or(0); + bool hasLength = lengthOpt.has_value(); + + if (ImGui::Checkbox("Has Length", &hasLength)) { + if (hasLength) { + opts->setLength(0); + } + else { + opts->setLength(std::nullopt); + } + updateLayout = true; + } + if (hasLength) { + if (ImGui::DragFloat("Length", &length)) { + opts->setLength(length); + updateLayout = true; + } + } + + auto prevGapOpt = opts->getPrevGap(); + float prevGap = prevGapOpt.value_or(0); + bool hasPrevGap = prevGapOpt.has_value(); + + if (ImGui::Checkbox("Has Prev Gap", &hasPrevGap)) { + if (hasPrevGap) { + opts->setPrevGap(0); + } + else { + opts->setPrevGap(std::nullopt); + } + updateLayout = true; + } + if (hasPrevGap) { + if (ImGui::DragFloat("Prev Gap", &prevGap)) { + opts->setPrevGap(prevGap); + updateLayout = true; + } + } + + auto nextGapOpt = opts->getNextGap(); + float nextGap = nextGapOpt.value_or(0); + bool hasNextGap = nextGapOpt.has_value(); + + if (ImGui::Checkbox("Has Next Gap", &hasNextGap)) { + if (hasNextGap) { + opts->setNextGap(0); + } + else { + opts->setNextGap(std::nullopt); + } + updateLayout = true; + } + if (hasNextGap) { + if (ImGui::DragFloat("Next Gap", &nextGap)) { + opts->setNextGap(nextGap); + updateLayout = true; + } + } + if (checkbox("Break Line", opts, AXIS_GET(BreakLine))) { updateLayout = true; } @@ -216,12 +407,60 @@ void DevTools::drawNodeAttributes(CCNode* node) { updateLayout = true; } + auto relativeScale = opts->getRelativeScale(); + if (ImGui::DragFloat("Relative Scale", &relativeScale)) { + opts->setRelativeScale(relativeScale); + updateLayout = true; + } + auto prio = opts->getScalePriority(); if (ImGui::DragInt("Scale Priority", &prio, .03f)) { opts->setScalePriority(prio); updateLayout = true; } + auto crossAxisAlignmentOpt = opts->getCrossAxisAlignment(); + int crossAxisAlignment = static_cast(crossAxisAlignmentOpt.value_or(AxisAlignment::Start)); + bool hasCrossAxisAlignment = crossAxisAlignmentOpt.has_value(); + + if (ImGui::Checkbox("Has Cross Axis Alignment", &hasCrossAxisAlignment)) { + if (hasCrossAxisAlignment) { + opts->setCrossAxisAlignment(AxisAlignment::Start); + } + else { + opts->setCrossAxisAlignment(std::nullopt); + } + updateLayout = true; + } + if (hasCrossAxisAlignment) { + + ImGui::Text("Cross Axis Alignment"); + bool updateAlignment = false; + updateAlignment |= ImGui::RadioButton( + "Start##alignmentoption0", &crossAxisAlignment, static_cast(AxisAlignment::Start) + ); + ImGui::SameLine(); + updateAlignment |= ImGui::RadioButton( + "Center##alignmentoption1", &crossAxisAlignment, static_cast(AxisAlignment::Center) + ); + ImGui::SameLine(); + updateAlignment |= ImGui::RadioButton( + "End##alignmentoption2", &crossAxisAlignment, static_cast(AxisAlignment::End) + ); + ImGui::SameLine(); + updateAlignment |= ImGui::RadioButton( + "Even##alignmentoption3", &crossAxisAlignment, static_cast(AxisAlignment::Even) + ); + ImGui::SameLine(); + updateAlignment |= ImGui::RadioButton( + "Between##alignmentoption4", &crossAxisAlignment, static_cast(AxisAlignment::Between) + ); + if (updateAlignment) { + opts->setCrossAxisAlignment(static_cast(crossAxisAlignment)); + updateLayout = true; + } + } + if (updateLayout && node->getParent()) { node->getParent()->updateLayout(); } @@ -266,6 +505,9 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } else { + if (ImGui::Button(U8STR(FEATHER_PLUS " Add SimpleAxisLayoutOptions"))) { + node->setLayoutOptions(SimpleAxisLayoutOptions::create()); + } if (ImGui::Button(U8STR(FEATHER_PLUS " Add AxisLayoutOptions"))) { node->setLayoutOptions(AxisLayoutOptions::create()); } @@ -274,21 +516,6 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } - ImGui::NewLine(); - ImGui::Separator(); - ImGui::NewLine(); - - if (auto delegate = typeinfo_cast(node)) { - if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { - auto priority = handler->getPriority(); - - if (ImGui::DragInt("Touch Priority", &priority, .03f)) { - CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); - } - } - } - - ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine(); @@ -333,27 +560,27 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Main Axis Scaling"); bool updateScaling = false; updateScaling |= ImGui::RadioButton( - "None", &axisScaling, static_cast(AxisScaling::None) + "None##mainscale0", &axisScaling, static_cast(AxisScaling::None) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale Down", &axisScaling, static_cast(AxisScaling::ScaleDown) + "Scale Down##mainscale1", &axisScaling, static_cast(AxisScaling::ScaleDown) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale", &axisScaling, static_cast(AxisScaling::Scale) + "Scale##mainscale2", &axisScaling, static_cast(AxisScaling::Scale) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Grow", &axisScaling, static_cast(AxisScaling::Grow) + "Grow##mainscale3", &axisScaling, static_cast(AxisScaling::Grow) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Fit", &axisScaling, static_cast(AxisScaling::Fit) + "Fit##mainscale4", &axisScaling, static_cast(AxisScaling::Fit) ); ImGui::SameLine(); updateScaling |= ImGui::RadioButton( - "Scale Down Gaps", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) + "Scale Down Gaps##mainscale5", &axisScaling, static_cast(AxisScaling::ScaleDownGaps) ); if (updateScaling) { layout->setMainAxisScaling(static_cast(axisScaling)); @@ -397,27 +624,27 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Main Axis Alignment"); bool updateAlign = false; updateAlign |= ImGui::RadioButton( - "Start", &align, static_cast(MainAxisAlignment::Start) + "Start##mainalign0", &align, static_cast(MainAxisAlignment::Start) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Center", &align, static_cast(MainAxisAlignment::Center) + "Center##mainalign1", &align, static_cast(MainAxisAlignment::Center) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "End", &align, static_cast(MainAxisAlignment::End) + "End##mainalign2", &align, static_cast(MainAxisAlignment::End) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Even", &align, static_cast(MainAxisAlignment::Even) + "Even##mainalign3", &align, static_cast(MainAxisAlignment::Even) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Between", &align, static_cast(MainAxisAlignment::Between) + "Between##mainalign4", &align, static_cast(MainAxisAlignment::Between) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Around", &align, static_cast(MainAxisAlignment::Around) + "Around##mainalign5", &align, static_cast(MainAxisAlignment::Around) ); if (updateAlign) { layout->setMainAxisAlignment(static_cast(align)); @@ -572,23 +799,23 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Axis Alignment"); bool updateAlign = false; updateAlign |= ImGui::RadioButton( - "Start", &align, static_cast(AxisAlignment::Start) + "Start##axisalign0", &align, static_cast(AxisAlignment::Start) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Center", &align, static_cast(AxisAlignment::Center) + "Center##axisalign1", &align, static_cast(AxisAlignment::Center) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "End", &align, static_cast(AxisAlignment::End) + "End##axisalign2", &align, static_cast(AxisAlignment::End) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Even", &align, static_cast(AxisAlignment::Even) + "Even##axisalign3", &align, static_cast(AxisAlignment::Even) ); ImGui::SameLine(); updateAlign |= ImGui::RadioButton( - "Between", &align, static_cast(AxisAlignment::Between) + "Between##axisalign4", &align, static_cast(AxisAlignment::Between) ); if (updateAlign) { layout->setAxisAlignment(static_cast(align)); From ef128ed3780bbaee47800f6f58180917dc92819f Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Wed, 30 Apr 2025 18:07:05 -0400 Subject: [PATCH 09/36] Add arrows --- src/pages/GeometryDash.cpp | 107 ++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/src/pages/GeometryDash.cpp b/src/pages/GeometryDash.cpp index fdd2c5f..3e2c1e8 100644 --- a/src/pages/GeometryDash.cpp +++ b/src/pages/GeometryDash.cpp @@ -164,6 +164,103 @@ void drawLayoutArrows( ); } +AxisAlignment translateToAxisAlignment(const MainAxisAlignment& alignment) { + switch (alignment) { + case MainAxisAlignment::Start: return AxisAlignment::Start; + case MainAxisAlignment::Between: return AxisAlignment::Between; + case MainAxisAlignment::Even: return AxisAlignment::Even; + case MainAxisAlignment::Center: return AxisAlignment::Center; + case MainAxisAlignment::Around: + case MainAxisAlignment::End: return AxisAlignment::End; + } + return AxisAlignment::Start; +} + +AxisAlignment translateToAxisAlignment(const CrossAxisAlignment& alignment) { + switch (alignment) { + case CrossAxisAlignment::Start: return AxisAlignment::Start; + case CrossAxisAlignment::Center: return AxisAlignment::Center; + case CrossAxisAlignment::End: return AxisAlignment::End; + } + return AxisAlignment::Start; +} + +void drawLayoutArrows( + ImDrawList& foreground, + SimpleAxisLayout* layout, + ImVec2 const& tmax, ImVec2 const& tmin +) { + auto row = layout->getAxis() == Axis::Row; + + float x; + float y; + + // cheating + AxisAlignment mainAxisAlignment = translateToAxisAlignment(layout->getMainAxisAlignment()); + AxisAlignment crossAxisAlignment = translateToAxisAlignment(layout->getCrossAxisAlignment()); + + switch (row ? mainAxisAlignment : crossAxisAlignment) { + case AxisAlignment::Start: + case AxisAlignment::Between: + case AxisAlignment::Even: x = tmin.x; break; + case AxisAlignment::Center: x = tmin.x + (tmax.x - tmin.x) / 2; break; + case AxisAlignment::End: x = tmax.x; break; + } + switch (row ? crossAxisAlignment : mainAxisAlignment) { + case AxisAlignment::Start: + case AxisAlignment::Between: + case AxisAlignment::Even: y = tmin.y; break; + case AxisAlignment::Center: y = tmin.y + (tmax.y - tmin.y) / 2; break; + case AxisAlignment::End: y = tmax.y; break; + } + + bool mainReverse = layout->getMainAxisDirection() == static_cast(1); + bool crossReverse = layout->getCrossAxisDirection() == static_cast(1); + + bool growCrossAxis = layout->getCrossAxisScaling() == AxisScaling::Grow; + + if (row) { + drawRowAxisArrow( + foreground, + x, y, tmax, tmin, + mainAxisAlignment, + mainReverse, + IM_COL32(255, 55, 55, 255) + ); + if (growCrossAxis) { + drawColAxisArrow( + foreground, + x, y, tmax, tmin, + crossAxisAlignment, + crossReverse, + IM_COL32(55, 55, 255, 255) + ); + } + } + else { + drawColAxisArrow( + foreground, + x, y, tmax, tmin, + mainAxisAlignment, + !mainReverse, + IM_COL32(255, 55, 55, 255) + ); + if (growCrossAxis) { + drawRowAxisArrow( + foreground, + x, y, tmax, tmin, + crossAxisAlignment, + !crossReverse, + IM_COL32(55, 55, 255, 255) + ); + } + } + + foreground.AddCircleFilled( + ImVec2(x, y), 6.f, IM_COL32(255, 55, 55, 255) + ); +} + void DevTools::drawHighlight(CCNode* node, HighlightMode mode) { auto& foreground = *ImGui::GetWindowDrawList(); auto parent = node->getParent(); @@ -230,6 +327,9 @@ void DevTools::drawHighlight(CCNode* node, HighlightMode mode) { if (auto layout = typeinfo_cast(node->getLayout())) { drawLayoutArrows(foreground, layout, tmax, tmin); } + if (auto layout = typeinfo_cast(node->getLayout())) { + drawLayoutArrows(foreground, layout, tmax, tmin); + } } break; case HighlightMode::Layout: { @@ -241,6 +341,9 @@ void DevTools::drawHighlight(CCNode* node, HighlightMode mode) { if (auto layout = typeinfo_cast(node->getLayout())) { drawLayoutArrows(foreground, layout, tmax, tmin); } + if (auto layout = typeinfo_cast(node->getLayout())) { + drawLayoutArrows(foreground, layout, tmax, tmin); + } } break; default: @@ -285,8 +388,8 @@ void DevTools::drawGD(GLRenderCtx* gdCtx) { auto pad = ImGui::GetStyle().FramePadding.x; - auto winPos = ImGui::GetCursorScreenPos(); - auto winSize = ImGui::GetContentRegionAvail(); + auto winPos = ImGui::GetCursorScreenPos(); + auto winSize = ImGui::GetContentRegionAvail(); ImVec2 imgSize = { (winSize.y - pad * 2) * ratio, From bf719c809a5b330ce8f69290198b120a9886a393 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Wed, 30 Apr 2025 18:38:21 -0400 Subject: [PATCH 10/36] Add adding and modifying AxisGap --- src/pages/Attributes.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index e538b49..8c7dd38 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -177,6 +177,16 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } + if (AxisGap* gap = typeinfo_cast(node)){ + float axisGap = gap->getGap(); + if (ImGui::DragFloat("Axis Gap", &axisGap)) { + gap->setGap(axisGap); + if (CCNode* parent = node->getParent()) { + parent->updateLayout(); + } + } + } + if (auto delegate = typeinfo_cast(node)) { if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { auto priority = handler->getPriority(); @@ -538,6 +548,11 @@ void DevTools::drawNodeAttributes(CCNode* node) { node->updateLayout(); } if (auto layout = typeinfo_cast(rawLayout)) { + ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_PLUS " Add AxisGap"))) { + node->addChild(AxisGap::create(5)); + node->updateLayout(); + } bool updateLayout = false; auto axis = static_cast(layout->getAxis()); ImGui::Text("Axis"); From 3f5523da08a856bb18f982d05a633fa3480d3f10 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 07:44:49 -0400 Subject: [PATCH 11/36] Separate Texture name and path, make copyable, rearrange --- src/pages/Attributes.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 8c7dd38..368d756 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -151,14 +151,6 @@ void DevTools::drawNodeAttributes(CCNode* node) { if (auto textureProtocol = typeinfo_cast(node)) { if (auto texture = textureProtocol->getTexture()) { - auto* cachedTextures = CCTextureCache::sharedTextureCache()->m_pTextures; - for (auto [key, obj] : CCDictionaryExt(cachedTextures)) { - if (obj == texture) { - ImGui::TextWrapped("Texture name: %s", key.c_str()); - break; - } - } - if (auto spriteNode = typeinfo_cast(node)) { auto* cachedFrames = CCSpriteFrameCache::sharedSpriteFrameCache()->m_pSpriteFrames; const auto rect = spriteNode->getTextureRect(); @@ -173,7 +165,24 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } } + auto* cachedTextures = CCTextureCache::sharedTextureCache()->m_pTextures; + for (auto [key, obj] : CCDictionaryExt(cachedTextures)) { + if (obj == texture) { + std::string fileName = std::filesystem::path(key).filename().string(); + ImGui::TextWrapped("Texture name: %s", fileName.c_str()); + ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copytexturename"))) { + clipboard::write(fileName); + } + ImGui::TextWrapped("Texture path: %s", key.c_str()); + ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copytexturepath"))) { + clipboard::write(key); + } + break; + } + } } } From 90eb214457caf81a7702ac49a66aab789b72dd37 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 07:58:47 -0400 Subject: [PATCH 12/36] More cleanup on order, add gradient support --- src/pages/Attributes.cpp | 102 +++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 35 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 368d756..28194f7 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -129,16 +129,46 @@ void DevTools::drawNodeAttributes(CCNode* node) { ); if (auto rgbaNode = typeinfo_cast(node)) { - auto color = rgbaNode->getColor(); - float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, rgbaNode->getOpacity() / 255.f }; - if (ImGui::ColorEdit4("Color", _color)) { - rgbaNode->setColor(ccColor3B{ - static_cast(_color[0] * 255), - static_cast(_color[1] * 255), - static_cast(_color[2] * 255) - }); - - rgbaNode->setOpacity(static_cast(_color[3] * 255)); + if (CCLayerGradient* gradient = typeinfo_cast(node)) { + { + auto color = gradient->getStartColor(); + float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, gradient->getStartOpacity() / 255.f }; + if (ImGui::ColorEdit4("Color 1", _color)) { + gradient->setStartColor(ccColor3B{ + static_cast(_color[0] * 255), + static_cast(_color[1] * 255), + static_cast(_color[2] * 255) + }); + + gradient->setStartOpacity(static_cast(_color[3] * 255)); + } + } + { + auto color = gradient->getEndColor(); + float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, gradient->getEndOpacity() / 255.f }; + if (ImGui::ColorEdit4("Color 2", _color)) { + gradient->setEndColor(ccColor3B{ + static_cast(_color[0] * 255), + static_cast(_color[1] * 255), + static_cast(_color[2] * 255) + }); + + gradient->setEndOpacity(static_cast(_color[3] * 255)); + } + } + } + else { + auto color = rgbaNode->getColor(); + float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, rgbaNode->getOpacity() / 255.f }; + if (ImGui::ColorEdit4("Color", _color)) { + rgbaNode->setColor(ccColor3B{ + static_cast(_color[0] * 255), + static_cast(_color[1] * 255), + static_cast(_color[2] * 255) + }); + + rgbaNode->setOpacity(static_cast(_color[3] * 255)); + } } } @@ -148,6 +178,30 @@ void DevTools::drawNodeAttributes(CCNode* node) { labelNode->setString(str.c_str()); } } + + if (AxisGap* gap = typeinfo_cast(node)){ + float axisGap = gap->getGap(); + if (ImGui::DragFloat("Axis Gap", &axisGap)) { + gap->setGap(axisGap); + if (CCNode* parent = node->getParent()) { + parent->updateLayout(); + } + } + } + + if (auto delegate = typeinfo_cast(node)) { + if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { + auto priority = handler->getPriority(); + + if (ImGui::DragInt("Touch Priority", &priority, .03f)) { + CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); + } + } + } + + ImGui::NewLine(); + ImGui::Separator(); + ImGui::NewLine(); if (auto textureProtocol = typeinfo_cast(node)) { if (auto texture = textureProtocol->getTexture()) { @@ -170,14 +224,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { if (obj == texture) { std::string fileName = std::filesystem::path(key).filename().string(); ImGui::TextWrapped("Texture name: %s", fileName.c_str()); - ImGui::SameLine(); - if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copytexturename"))) { + ImGui::TextWrapped("Texture path: %s", key.c_str()); + if (ImGui::Button(U8STR(FEATHER_COPY " Copy Texture Name##copytexturename"))) { clipboard::write(fileName); } - - ImGui::TextWrapped("Texture path: %s", key.c_str()); ImGui::SameLine(); - if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copytexturepath"))) { + if (ImGui::Button(U8STR(FEATHER_COPY " Copy Texture Path##copytexturepath"))) { clipboard::write(key); } break; @@ -186,26 +238,6 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } - if (AxisGap* gap = typeinfo_cast(node)){ - float axisGap = gap->getGap(); - if (ImGui::DragFloat("Axis Gap", &axisGap)) { - gap->setGap(axisGap); - if (CCNode* parent = node->getParent()) { - parent->updateLayout(); - } - } - } - - if (auto delegate = typeinfo_cast(node)) { - if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { - auto priority = handler->getPriority(); - - if (ImGui::DragInt("Touch Priority", &priority, .03f)) { - CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); - } - } - } - ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine(); From 71272e5477bfb0f56e60005f97ad1ada1e6e1b89 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:02:48 -0400 Subject: [PATCH 13/36] Add Flip X and Flip Y for CCSprite --- src/pages/Attributes.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 28194f7..2a987e1 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -119,6 +119,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { if (node->getZOrder() != zOrder) { node->setZOrder(zOrder); } + + if (auto sprite = typeinfo_cast(node)) { + checkbox("Flip X", sprite, &CCSprite::isFlipX, &CCSprite::setFlipX); + ImGui::SameLine(); + checkbox("Flip Y", sprite, &CCSprite::isFlipY, &CCSprite::setFlipY); + } checkbox("Visible", node, &CCNode::isVisible, &CCNode::setVisible); checkbox( @@ -129,7 +135,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { ); if (auto rgbaNode = typeinfo_cast(node)) { - if (CCLayerGradient* gradient = typeinfo_cast(node)) { + if (auto gradient = typeinfo_cast(node)) { { auto color = gradient->getStartColor(); float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, gradient->getStartOpacity() / 255.f }; @@ -179,7 +185,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } - if (AxisGap* gap = typeinfo_cast(node)){ + if (auto gap = typeinfo_cast(node)){ float axisGap = gap->getGap(); if (ImGui::DragFloat("Axis Gap", &axisGap)) { gap->setGap(axisGap); From 2e212c78d7788090473b3ec421c29247b77b090e Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:07:47 -0400 Subject: [PATCH 14/36] Add Cascade color and opacity --- src/pages/Attributes.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 2a987e1..36808f5 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -135,6 +135,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { ); if (auto rgbaNode = typeinfo_cast(node)) { + if (auto gradient = typeinfo_cast(node)) { { auto color = gradient->getStartColor(); @@ -176,6 +177,8 @@ void DevTools::drawNodeAttributes(CCNode* node) { rgbaNode->setOpacity(static_cast(_color[3] * 255)); } } + checkbox("Cascade Color", rgbaNode, &CCRGBAProtocol::isCascadeColorEnabled, &CCRGBAProtocol::setCascadeColorEnabled); + checkbox("Cascade Opacity", rgbaNode, &CCRGBAProtocol::isCascadeOpacityEnabled, &CCRGBAProtocol::setCascadeOpacityEnabled); } if (auto labelNode = typeinfo_cast(node)) { From 4b630a817afb8f2578b4e9afcad9841c97d09984 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:34:58 -0400 Subject: [PATCH 15/36] Add CCMenuItemSpriteExtra attributes --- src/pages/Attributes.cpp | 89 ++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 36808f5..2eb808a 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -57,22 +57,6 @@ void DevTools::drawNodeAttributes(CCNode* node) { ImGui::Text("Node ID: N/A"); } - if (auto menuItemNode = typeinfo_cast(node)) { - const auto selector = menuItemNode->m_pfnSelector; - if (!selector) { - std::string addr = "N/A"; - ImGui::Text("CCMenuItem selector: %s", addr.c_str()); - } else { - const auto addr = formatAddressIntoOffset(addresser::getNonVirtual(selector), true); - ImGui::Text("CCMenuItem selector: %s", addr.c_str()); - ImGui::SameLine(); - if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copymenuitem"))) { - const auto addrNoModule = formatAddressIntoOffset(addresser::getNonVirtual(selector), false); - clipboard::write(addrNoModule); - } - } - } - float pos[2] = { node->getPositionX(), node->getPositionY() @@ -120,6 +104,16 @@ void DevTools::drawNodeAttributes(CCNode* node) { node->setZOrder(zOrder); } + if (auto delegate = typeinfo_cast(node)) { + if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { + auto priority = handler->getPriority(); + + if (ImGui::InputInt("Touch Priority", &priority)) { + CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); + } + } + } + if (auto sprite = typeinfo_cast(node)) { checkbox("Flip X", sprite, &CCSprite::isFlipX, &CCSprite::setFlipX); ImGui::SameLine(); @@ -178,9 +172,10 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } checkbox("Cascade Color", rgbaNode, &CCRGBAProtocol::isCascadeColorEnabled, &CCRGBAProtocol::setCascadeColorEnabled); + ImGui::SameLine(); checkbox("Cascade Opacity", rgbaNode, &CCRGBAProtocol::isCascadeOpacityEnabled, &CCRGBAProtocol::setCascadeOpacityEnabled); } - + if (auto labelNode = typeinfo_cast(node)) { std::string str = labelNode->getString(); if (ImGui::InputText("Text", &str, 256)) { @@ -198,16 +193,6 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } - if (auto delegate = typeinfo_cast(node)) { - if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { - auto priority = handler->getPriority(); - - if (ImGui::DragInt("Touch Priority", &priority, .03f)) { - CCTouchDispatcher::get()->setPriority(priority, handler->getDelegate()); - } - } - } - ImGui::NewLine(); ImGui::Separator(); ImGui::NewLine(); @@ -245,12 +230,54 @@ void DevTools::drawNodeAttributes(CCNode* node) { } } } + ImGui::NewLine(); + ImGui::Separator(); + ImGui::NewLine(); } - - ImGui::NewLine(); - ImGui::Separator(); - ImGui::NewLine(); + if (auto menuItemNode = typeinfo_cast(node)) { + const auto selector = menuItemNode->m_pfnSelector; + if (!selector) { + std::string addr = "N/A"; + ImGui::Text("CCMenuItem selector: %s", addr.c_str()); + } else { + const auto addr = formatAddressIntoOffset(addresser::getNonVirtual(selector), true); + ImGui::Text("CCMenuItem selector: %s", addr.c_str()); + ImGui::SameLine(); + if (ImGui::Button(U8STR(FEATHER_COPY " Copy##copymenuitem"))) { + const auto addrNoModule = formatAddressIntoOffset(addresser::getNonVirtual(selector), false); + clipboard::write(addrNoModule); + } + } + if (ImGui::Button(U8STR(FEATHER_LINK " Activate##activatemenuitem"))) { + menuItemNode->activate(); + } + checkbox("Enabled##enabledmenuitem", menuItemNode, &CCMenuItem::isEnabled, &CCMenuItem::setEnabled); + + if (auto menuItemSpriteExtra = typeinfo_cast(menuItemNode)) { + bool animationEnabled = menuItemSpriteExtra->m_animationEnabled; + if (ImGui::Checkbox("Animation Enabled##menuitemanimationenabled", &animationEnabled)) { + menuItemSpriteExtra->m_animationEnabled = animationEnabled; + } + float sizeMult = menuItemSpriteExtra->m_fSizeMult; + if (ImGui::DragFloat("Size Multiplier##menuitemsizemult", &sizeMult, .1f)) { + menuItemSpriteExtra->setSizeMult(sizeMult); + } + float scaleMultiplier = menuItemSpriteExtra->m_scaleMultiplier; + if (ImGui::DragFloat("Scale Multipler##menuitemscalemultiplier", &scaleMultiplier, .03f)) { + menuItemSpriteExtra->m_scaleMultiplier = scaleMultiplier; + } + float baseScale = menuItemSpriteExtra->m_baseScale; + if (ImGui::DragFloat("Base Scale##menuitembasescale", &baseScale, .03f)) { + menuItemSpriteExtra->m_baseScale = baseScale; + } + } + + ImGui::NewLine(); + ImGui::Separator(); + ImGui::NewLine(); + } + if (auto rawOpts = node->getLayoutOptions()) { ImGui::Text("Layout options: %s", typeid(*rawOpts).name()); From bcce0a1b8d2c0ccee962e702a485c28ccf780e8b Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:42:53 -0400 Subject: [PATCH 16/36] Add copy class name and move getNodeName to utils --- src/pages/Attributes.cpp | 4 ++++ src/pages/Tree.cpp | 22 ++-------------------- src/platform/utils.hpp | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 2eb808a..aea8065 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -35,6 +35,10 @@ void DevTools::drawNodeAttributes(CCNode* node) { if (ImGui::Button("Deselect")) { return this->selectNode(nullptr); } + ImGui::SameLine(); + if (ImGui::Button("Copy Class Name")) { + clipboard::write(getNodeName(node)); + } ImGui::Text("Address: %s", fmt::to_string(fmt::ptr(node)).c_str()); ImGui::SameLine(); if (ImGui::Button(U8STR(FEATHER_COPY " Copy"))) { diff --git a/src/pages/Tree.cpp b/src/pages/Tree.cpp index 681ae5c..51f1faa 100644 --- a/src/pages/Tree.cpp +++ b/src/pages/Tree.cpp @@ -1,31 +1,13 @@ #include "../fonts/FeatherIcons.hpp" #include #include "../DevTools.hpp" +#include "../platform/utils.hpp" #ifndef GEODE_IS_WINDOWS #include #endif using namespace geode::prelude; -std::string getNodeName(CCObject* node) { -#ifdef GEODE_IS_WINDOWS - return typeid(*node).name() + 6; -#else - { - std::string ret; - - int status = 0; - auto demangle = abi::__cxa_demangle(typeid(*node).name(), 0, 0, &status); - if (status == 0) { - ret = demangle; - } - free(demangle); - - return ret; - } -#endif -} - void DevTools::drawTreeBranch(CCNode* node, size_t index) { auto selected = DevTools::get()->getSelectedNode() == node; @@ -58,7 +40,7 @@ void DevTools::drawTreeBranch(CCNode* node, size_t index) { DevTools::get()->selectNode(node); selected = true; } - if (ImGui::IsItemHovered() && (m_settings.alwaysHighlight || ImGui::IsKeyDown(ImGuiMod_Shift))) { + if (ImGui::IsItemHovered() && (m_settings.alwaysHighlight || ImGui::IsKeyDown(ImGuiMod_Shift))) { DevTools::get()->highlightNode(node, HighlightMode::Hovered); } if (expanded) { diff --git a/src/platform/utils.hpp b/src/platform/utils.hpp index 6653d53..2d68411 100644 --- a/src/platform/utils.hpp +++ b/src/platform/utils.hpp @@ -3,6 +3,23 @@ #include #include +static inline std::string getNodeName(cocos2d::CCObject* node) { +#ifdef GEODE_IS_WINDOWS + return typeid(*node).name() + 6; +#else + std::string ret; + + int status = 0; + auto demangle = abi::__cxa_demangle(typeid(*node).name(), 0, 0, &status); + if (status == 0) { + ret = demangle; + } + free(demangle); + + return ret; +#endif +} + std::string formatAddressIntoOffset(uintptr_t addr, bool module); std::string formatAddressIntoOffsetImpl(uintptr_t addr, bool module); From 3c84a26f62a4f8b219af33a8572d3e1243790fff Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:43:40 -0400 Subject: [PATCH 17/36] Add copy symbol --- src/pages/Attributes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index aea8065..ca3eb9c 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -36,7 +36,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { return this->selectNode(nullptr); } ImGui::SameLine(); - if (ImGui::Button("Copy Class Name")) { + if (ImGui::Button(U8STR(FEATHER_COPY "Copy Class Name"))) { clipboard::write(getNodeName(node)); } ImGui::Text("Address: %s", fmt::to_string(fmt::ptr(node)).c_str()); From 3570b8444fe3d83ec54667ed7678edc09ffd2d54 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 08:51:14 -0400 Subject: [PATCH 18/36] Add changing tag --- src/pages/Attributes.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index ca3eb9c..9721019 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -36,7 +36,7 @@ void DevTools::drawNodeAttributes(CCNode* node) { return this->selectNode(nullptr); } ImGui::SameLine(); - if (ImGui::Button(U8STR(FEATHER_COPY "Copy Class Name"))) { + if (ImGui::Button(U8STR(FEATHER_COPY " Copy Class Name"))) { clipboard::write(getNodeName(node)); } ImGui::Text("Address: %s", fmt::to_string(fmt::ptr(node)).c_str()); @@ -107,6 +107,10 @@ void DevTools::drawNodeAttributes(CCNode* node) { if (node->getZOrder() != zOrder) { node->setZOrder(zOrder); } + int tag = node->getTag(); + if (ImGui::InputInt("Tag", &tag)) { + node->setTag(tag); + } if (auto delegate = typeinfo_cast(node)) { if (auto handler = CCTouchDispatcher::get()->findHandler(delegate)) { From e98c56a23805deea3bd78f3b2be7328c7d48e4f7 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 09:56:08 -0400 Subject: [PATCH 19/36] Custom Theme Primary Color, why not? --- src/DevTools.cpp | 8 ++ src/DevTools.hpp | 3 +- src/pages/Settings.cpp | 13 ++++ src/themes.cpp | 162 +++++++++++++++++++++++++---------------- src/themes.hpp | 2 +- 5 files changed, 122 insertions(+), 66 deletions(-) diff --git a/src/DevTools.cpp b/src/DevTools.cpp index e33b581..de5b118 100644 --- a/src/DevTools.cpp +++ b/src/DevTools.cpp @@ -16,6 +16,11 @@ struct matjson::Serialize { static Result fromJson(const matjson::Value& value) { Settings defaults; + ccColor4B themeColor = {2, 119, 189, 255}; + if (value["theme_color"].as().isOk()) { + themeColor = value["theme_color"].as().unwrap(); + } + return Ok(Settings { .GDInWindow = value["game_in_window"].asBool().unwrapOr(std::move(defaults.GDInWindow)), .attributesInTree = value["attributes_in_tree"].asBool().unwrapOr(std::move(defaults.attributesInTree)), @@ -26,6 +31,7 @@ struct matjson::Serialize { .advancedSettings = value["advanced_settings"].asBool().unwrapOr(std::move(defaults.advancedSettings)), .showMemoryViewer = value["show_memory_viewer"].asBool().unwrapOr(std::move(defaults.showMemoryViewer)), .theme = value["theme"].asString().unwrapOr(std::move(defaults.theme)), + .themeColor = themeColor }); } @@ -40,6 +46,7 @@ struct matjson::Serialize { { "advanced_settings", settings.advancedSettings }, { "show_memory_viewer", settings.showMemoryViewer }, { "theme", settings.theme }, + { "theme_color", settings.themeColor }, }); } }; @@ -53,6 +60,7 @@ DevTools* DevTools::get() { void DevTools::loadSettings() { m_settings = Mod::get()->getSavedValue("settings"); } void DevTools::saveSettings() { Mod::get()->setSavedValue("settings", m_settings); } +Settings DevTools::getSettings() { return m_settings; } bool DevTools::shouldPopGame() const { return m_visible && m_settings.GDInWindow; diff --git a/src/DevTools.hpp b/src/DevTools.hpp index 8b5816e..590d5ea 100644 --- a/src/DevTools.hpp +++ b/src/DevTools.hpp @@ -28,6 +28,7 @@ struct Settings { bool advancedSettings = false; bool showMemoryViewer = false; std::string theme = DARK_THEME; + ccColor4B themeColor = {2, 119, 189, 255}; }; class DevTools { @@ -81,7 +82,7 @@ class DevTools { static DevTools* get(); void loadSettings(); void saveSettings(); - + Settings getSettings(); bool shouldUseGDWindow() const; bool shouldPopGame() const; diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 42ad6ba..114b663 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -178,6 +178,19 @@ void DevTools::drawSettings() { ImGui::SetTooltip("Select Theme"); } + if (m_settings.theme == "Dark") { + auto color = m_settings.themeColor; + float _color[4] = { color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f }; + if (ImGui::ColorEdit4("Primary Color", _color)) { + color.r = _color[0] * 255; + color.g = _color[1] * 255; + color.b = _color[2] * 255; + color.a = _color[3] * 255; + m_settings.themeColor = color; + m_reloadTheme = true; + } + } + ImGui::Separator(); ImGui::TextWrapped("Developed by "); diff --git a/src/themes.cpp b/src/themes.cpp index 0d1ea84..c194d6d 100644 --- a/src/themes.cpp +++ b/src/themes.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "DevTools.hpp" using namespace geode::prelude; @@ -28,6 +29,33 @@ namespace { }; } + constexpr ImVec4 colorFromCocos(const ccColor4B& color) { + return { + color.r / 255.f, + color.g / 255.f, + color.b / 255.f, + color.a / 255.f + }; + } + + constexpr ImVec4 lighterColor(ImVec4 color, float factor = 1.2f) { + return ImVec4{ + (color.x * factor > 1.0f ? 1.0f : color.x * factor), + (color.y * factor > 1.0f ? 1.0f : color.y * factor), + (color.z * factor > 1.0f ? 1.0f : color.z * factor), + color.w + }; + } + + constexpr ImVec4 darkerColor(ImVec4 color, float factor = 0.6f) { + return ImVec4{ + color.x * factor, + color.y * factor, + color.z * factor, + color.w + }; + } + constexpr ImVec4 operator+(ImVec4 const& vec, int value) { return { clamp(vec.x + value / 255.f), @@ -73,64 +101,70 @@ namespace { } } -constexpr ImVec4 DARK_THEME_BG = color(33, 33, 33, 255); -constexpr ImVec4 DARK_THEME_BG_DARK = color(22, 22, 22, 255); -constexpr ImVec4 DARK_THEME_TEXT = color(255, 255, 255, 255); -constexpr ImVec4 DARK_THEME_LIGHT = color(255, 255, 255, 255); -constexpr ImVec4 DARK_THEME_PRIMARY = color(2, 119, 189, 255); -constexpr ImVec4 DARK_THEME_PRIMARY_DARK = color(2, 66, 104, 255); -constexpr ImVec4 DARK_THEME_PRIMARY_LIGHT = color(73, 164, 216, 255); -ThemeDef DARK_THEME_DEF { - .text = DARK_THEME_TEXT, - .textDisabled = DARK_THEME_TEXT - 102, - .textSelectedBG = DARK_THEME_PRIMARY - 60 - alpha(180), - .windowBG = DARK_THEME_BG, - .childBG = DARK_THEME_BG, - .popupBG = DARK_THEME_BG, - .border = DARK_THEME_BG + 23, - .borderShadow = DARK_THEME_BG + 50, - .frameBG = DARK_THEME_BG_DARK, - .frameBGHovered = DARK_THEME_BG_DARK + 20, - .frameBGActive = DARK_THEME_BG_DARK, - .titleBarBG = DARK_THEME_PRIMARY_DARK, - .titleBarBGCollapsed = DARK_THEME_PRIMARY_DARK - alpha(150), - .titleBarBGActive = DARK_THEME_PRIMARY, - .menuBarBG = DARK_THEME_BG_DARK, - .scrollbarBG = DARK_THEME_BG_DARK, - .scrollbarGrab = DARK_THEME_PRIMARY, - .scrollbarGrabHovered = DARK_THEME_PRIMARY_LIGHT, - .scrollbarGrabActive = DARK_THEME_PRIMARY_DARK, - .checkMark = DARK_THEME_PRIMARY, - .sliderGrab = DARK_THEME_PRIMARY, - .sliderGrabActive = DARK_THEME_PRIMARY_DARK, - .button = DARK_THEME_PRIMARY, - .buttonHovered = DARK_THEME_PRIMARY_LIGHT, - .buttonActive = DARK_THEME_PRIMARY_DARK, - .header = DARK_THEME_PRIMARY - alpha(140), - .headerHovered = DARK_THEME_PRIMARY_LIGHT - alpha(40), - .headerActive = DARK_THEME_PRIMARY_DARK, - .separator = DARK_THEME_LIGHT - alpha(140), - .separatorHovered = DARK_THEME_LIGHT - alpha(40), - .separatorActive = DARK_THEME_PRIMARY_DARK, - .resizeGrip = DARK_THEME_LIGHT - alpha(200), - .resizeGripHovered = DARK_THEME_LIGHT - alpha(100), - .resizeGripActive = DARK_THEME_PRIMARY_DARK, - .plotLines = DARK_THEME_PRIMARY - alpha(140), - .plotLinesHovered = DARK_THEME_PRIMARY - alpha(40), - .plotHistogram = DARK_THEME_PRIMARY - alpha(140), - .plotHistogramHovered = DARK_THEME_PRIMARY - alpha(40), - .dragDropTarget = DARK_THEME_PRIMARY - 60 - alpha(20), - .navHighlight = DARK_THEME_PRIMARY - 30 - alpha(40), - .navWindowingHighlight = DARK_THEME_PRIMARY - 40 - alpha(40), - .tab = DARK_THEME_PRIMARY - alpha(200), - .tabHovered = DARK_THEME_PRIMARY, - .tabActive = DARK_THEME_PRIMARY_LIGHT, - .tabUnfocused = DARK_THEME_PRIMARY_DARK - alpha(140), - .tabUnfocusedActive = DARK_THEME_PRIMARY - alpha(140), - .tableBorderStrong = DARK_THEME_LIGHT - alpha(50), - .tableBorderLight = DARK_THEME_LIGHT - alpha(100), -}; + +ThemeDef createDarkTheme() { + + constexpr ImVec4 DARK_THEME_BG = color(33, 33, 33, 255); + constexpr ImVec4 DARK_THEME_BG_DARK = color(22, 22, 22, 255); + constexpr ImVec4 DARK_THEME_TEXT = color(255, 255, 255, 255); + constexpr ImVec4 DARK_THEME_LIGHT = color(255, 255, 255, 255); + ImVec4 DARK_THEME_PRIMARY = colorFromCocos(DevTools::get()->getSettings().themeColor); + ImVec4 DARK_THEME_PRIMARY_DARK = darkerColor(DARK_THEME_PRIMARY); + ImVec4 DARK_THEME_PRIMARY_LIGHT = lighterColor(DARK_THEME_PRIMARY); + + ThemeDef DARK_THEME_DEF { + .text = DARK_THEME_TEXT, + .textDisabled = DARK_THEME_TEXT - 102, + .textSelectedBG = DARK_THEME_PRIMARY - 60 - alpha(180), + .windowBG = DARK_THEME_BG, + .childBG = DARK_THEME_BG, + .popupBG = DARK_THEME_BG, + .border = DARK_THEME_BG + 23, + .borderShadow = DARK_THEME_BG + 50, + .frameBG = DARK_THEME_BG_DARK, + .frameBGHovered = DARK_THEME_BG_DARK + 20, + .frameBGActive = DARK_THEME_BG_DARK, + .titleBarBG = DARK_THEME_PRIMARY_DARK, + .titleBarBGCollapsed = DARK_THEME_PRIMARY_DARK - alpha(150), + .titleBarBGActive = DARK_THEME_PRIMARY, + .menuBarBG = DARK_THEME_BG_DARK, + .scrollbarBG = DARK_THEME_BG_DARK, + .scrollbarGrab = DARK_THEME_PRIMARY, + .scrollbarGrabHovered = DARK_THEME_PRIMARY_LIGHT, + .scrollbarGrabActive = DARK_THEME_PRIMARY_DARK, + .checkMark = DARK_THEME_PRIMARY, + .sliderGrab = DARK_THEME_PRIMARY, + .sliderGrabActive = DARK_THEME_PRIMARY_DARK, + .button = DARK_THEME_PRIMARY, + .buttonHovered = DARK_THEME_PRIMARY_LIGHT, + .buttonActive = DARK_THEME_PRIMARY_DARK, + .header = DARK_THEME_PRIMARY - alpha(140), + .headerHovered = DARK_THEME_PRIMARY_LIGHT - alpha(40), + .headerActive = DARK_THEME_PRIMARY_DARK, + .separator = DARK_THEME_LIGHT - alpha(140), + .separatorHovered = DARK_THEME_LIGHT - alpha(40), + .separatorActive = DARK_THEME_PRIMARY_DARK, + .resizeGrip = DARK_THEME_LIGHT - alpha(200), + .resizeGripHovered = DARK_THEME_LIGHT - alpha(100), + .resizeGripActive = DARK_THEME_PRIMARY_DARK, + .plotLines = DARK_THEME_PRIMARY - alpha(140), + .plotLinesHovered = DARK_THEME_PRIMARY - alpha(40), + .plotHistogram = DARK_THEME_PRIMARY - alpha(140), + .plotHistogramHovered = DARK_THEME_PRIMARY - alpha(40), + .dragDropTarget = DARK_THEME_PRIMARY - 60 - alpha(20), + .navHighlight = DARK_THEME_PRIMARY - 30 - alpha(40), + .navWindowingHighlight = DARK_THEME_PRIMARY - 40 - alpha(40), + .tab = DARK_THEME_PRIMARY - alpha(200), + .tabHovered = DARK_THEME_PRIMARY, + .tabActive = DARK_THEME_PRIMARY_LIGHT, + .tabUnfocused = DARK_THEME_PRIMARY_DARK - alpha(140), + .tabUnfocusedActive = DARK_THEME_PRIMARY - alpha(140), + .tableBorderStrong = DARK_THEME_LIGHT - alpha(50), + .tableBorderLight = DARK_THEME_LIGHT - alpha(100), + }; + return DARK_THEME_DEF; +} constexpr ImVec4 MATERIAL_DARK_THEME_BG = color(33, 33, 33, 255); constexpr ImVec4 MATERIAL_DARK_THEME_BG_DARK = color(22, 22, 22, 255); @@ -279,20 +313,20 @@ void applyCommon(ImGuiStyle& style) { // style.ColorButtonPosition = ImGuiDir_Left; } -ThemeDef& getThemeDef(std::string const& name) { +ThemeDef getThemeDef(std::string const& name) { switch (hash(name.c_str())) { - case hash(DARK_THEME): return DARK_THEME_DEF; + case hash(DARK_THEME): return createDarkTheme(); case hash(MATERIAL_DARK_THEME): return MATERIAL_DARK_THEME_DEF; case hash(LIGHT_THEME): return LIGHT_THEME_DEF; } - return DARK_THEME_DEF; + return createDarkTheme(); } void applyTheme(std::string const& name) { auto& style = ImGui::GetStyle(); applyCommon(style); - auto& theme = getThemeDef(name); + auto theme = getThemeDef(name); style.Colors[ImGuiCol_Text] = theme.text; style.Colors[ImGuiCol_TextDisabled] = theme.textDisabled; style.Colors[ImGuiCol_TextSelectedBg] = theme.textSelectedBG; @@ -336,9 +370,9 @@ void applyTheme(std::string const& name) { style.Colors[ImGuiCol_NavWindowingHighlight] = theme.navWindowingHighlight; style.Colors[ImGuiCol_Tab] = theme.tab; style.Colors[ImGuiCol_TabHovered] = theme.tabHovered; - style.Colors[ImGuiCol_TabSelected] = theme.tabActive; - style.Colors[ImGuiCol_TabDimmed] = theme.tabUnfocused; - style.Colors[ImGuiCol_TabDimmedSelected] = theme.tabUnfocusedActive; + style.Colors[ImGuiCol_TabSelected] = theme.tabActive; + style.Colors[ImGuiCol_TabDimmed] = theme.tabUnfocused; + style.Colors[ImGuiCol_TabDimmedSelected] = theme.tabUnfocusedActive; style.Colors[ImGuiCol_TableBorderStrong] = theme.tableBorderStrong; style.Colors[ImGuiCol_TableBorderLight] = theme.tableBorderLight; } diff --git a/src/themes.hpp b/src/themes.hpp index 1e4910a..3448115 100644 --- a/src/themes.hpp +++ b/src/themes.hpp @@ -59,7 +59,7 @@ constexpr const char* DARK_THEME = "Dark"; constexpr const char* MATERIAL_DARK_THEME = "Material Dark"; constexpr const char* LIGHT_THEME = "Light"; -ThemeDef& getThemeDef(std::string const& theme); +ThemeDef getThemeDef(std::string const& theme); void applyTheme(std::string const& theme); std::vector getThemeOptions(); From 33953c18afe44c4adc2e3c4d2366ded877ea1c0a Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 10:15:06 -0400 Subject: [PATCH 20/36] Add setting texture rect --- src/pages/Attributes.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 9721019..941d30b 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -220,7 +220,17 @@ void DevTools::drawNodeAttributes(CCNode* node) { break; } } + float textureRect[4] = { + spriteNode->getTextureRect().getMinX(), + spriteNode->getTextureRect().getMinY(), + spriteNode->getTextureRect().size.width, + spriteNode->getTextureRect().size.height, + }; + if (ImGui::DragFloat4("Rect", textureRect), 0.03f) { + spriteNode->setTextureRect({textureRect[0], textureRect[1], textureRect[2], textureRect[3]}); + } } + ImGui::NewLine(); auto* cachedTextures = CCTextureCache::sharedTextureCache()->m_pTextures; for (auto [key, obj] : CCDictionaryExt(cachedTextures)) { if (obj == texture) { From 2068de3e22f6b7c35f0d80d97a99303124c55ff3 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 11:51:46 -0400 Subject: [PATCH 21/36] Fix resizing (cheating) --- src/pages/GeometryDash.cpp | 43 ++++++++++++++++++++++++++++++++++++++ src/pages/Settings.cpp | 3 +-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/pages/GeometryDash.cpp b/src/pages/GeometryDash.cpp index 3e2c1e8..d1b8186 100644 --- a/src/pages/GeometryDash.cpp +++ b/src/pages/GeometryDash.cpp @@ -429,3 +429,46 @@ void DevTools::drawGD(GLRenderCtx* gdCtx) { ImGui::End(); } } + +// cheaty way to detect resize and update the render +class ResizeWatcher : public CCObject { +private: + int m_lastWidth; + int m_lastHeight; + float m_resizeTimer; + bool m_hasPendingResize; +public: + static ResizeWatcher* create() { + auto ret = new ResizeWatcher(); + ret->autorelease(); + return ret; + } + + void update(float dt) { + auto view = CCDirector::sharedDirector()->getOpenGLView(); + int w = view->getFrameSize().width; + int h = view->getFrameSize().height; + + if (w != m_lastWidth || h != m_lastHeight) { + m_lastWidth = w; + m_lastHeight = h; + m_resizeTimer = 0.0f; + m_hasPendingResize = true; + return; + } + + if (m_hasPendingResize) { + m_resizeTimer += dt; + if (m_resizeTimer > 0.2f) { + m_hasPendingResize = false; + shouldUpdateGDRenderBuffer() = true; + } + } + } +}; + +$execute { + Loader::get()->queueInMainThread([]{ + CCScheduler::get()->scheduleUpdateForTarget(ResizeWatcher::create(), INT_MAX, false); + }); +} \ No newline at end of file diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 114b663..f718c7e 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -80,7 +80,6 @@ void DevTools::drawSettings() { ImGui::Text("GD Window"); // TODO: undo later -#if 0 auto winSize = CCDirector::get()->getWinSize(); auto frameSize = GameManager::get()->resolutionForKey(GameManager::get()->m_resolution); auto fps = roundf(1 / CCDirector::get()->getAnimationInterval()); @@ -149,7 +148,7 @@ void DevTools::drawSettings() { static_cast(frameSize.width / ratio), static_cast(frameSize.height / ratio) ); - +#if 0 static Ref PAUSED_TARGETS = nullptr; if (ImGui::Button(m_pauseGame ? "Resume Game" : "Pause Game")) { m_pauseGame ^= 1; From 8dfbd072a8a92608ca736466b0a998bc1252c249 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 12:16:37 -0400 Subject: [PATCH 22/36] Show Mod Graph saves and moved to settings, fixes --- src/DevTools.cpp | 19 +++++++++++-------- src/DevTools.hpp | 1 + src/pages/Advanced.cpp | 1 - src/pages/Settings.cpp | 6 ++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/DevTools.cpp b/src/DevTools.cpp index de5b118..3742d7a 100644 --- a/src/DevTools.cpp +++ b/src/DevTools.cpp @@ -16,11 +16,6 @@ struct matjson::Serialize { static Result fromJson(const matjson::Value& value) { Settings defaults; - ccColor4B themeColor = {2, 119, 189, 255}; - if (value["theme_color"].as().isOk()) { - themeColor = value["theme_color"].as().unwrap(); - } - return Ok(Settings { .GDInWindow = value["game_in_window"].asBool().unwrapOr(std::move(defaults.GDInWindow)), .attributesInTree = value["attributes_in_tree"].asBool().unwrapOr(std::move(defaults.attributesInTree)), @@ -30,8 +25,9 @@ struct matjson::Serialize { .orderChildren = value["order_children"].asBool().unwrapOr(std::move(defaults.orderChildren)), .advancedSettings = value["advanced_settings"].asBool().unwrapOr(std::move(defaults.advancedSettings)), .showMemoryViewer = value["show_memory_viewer"].asBool().unwrapOr(std::move(defaults.showMemoryViewer)), + .showModGraph = value["show_mod_graph"].asBool().unwrapOr(std::move(defaults.showModGraph)), .theme = value["theme"].asString().unwrapOr(std::move(defaults.theme)), - .themeColor = themeColor + .themeColor = value["theme_color"].as().isOk() ? value["theme_color"].as().unwrap() : std::move(defaults.themeColor) }); } @@ -45,6 +41,7 @@ struct matjson::Serialize { { "order_children", settings.orderChildren }, { "advanced_settings", settings.advancedSettings }, { "show_memory_viewer", settings.showMemoryViewer }, + { "show_mod_graph", settings.showModGraph }, { "theme", settings.theme }, { "theme_color", settings.themeColor }, }); @@ -135,12 +132,15 @@ void DevTools::drawPages() { &DevTools::drawSettings ); + // if advanced ever has more than one option, add it back +#if 0 if (m_settings.advancedSettings) { this->drawPage( U8STR(FEATHER_SETTINGS " Advanced Settings###devtools/advanced/settings"), &DevTools::drawAdvancedSettings ); } +#endif this->drawPage( U8STR(FEATHER_TOOL " Attributes###devtools/attributes"), @@ -155,7 +155,7 @@ void DevTools::drawPages() { ); #endif - if (m_showModGraph) { + if (m_settings.showModGraph) { this->drawPage( U8STR(FEATHER_SHARE_2 " Mod Graph###devtools/advanced/mod-graph"), &DevTools::drawModGraph @@ -163,7 +163,10 @@ void DevTools::drawPages() { } if (m_settings.showMemoryViewer) { - this->drawPage("Memory viewer", &DevTools::drawMemory); + this->drawPage( + U8STR(FEATHER_TERMINAL " Memory viewer"), + &DevTools::drawMemory + ); } } diff --git a/src/DevTools.hpp b/src/DevTools.hpp index 590d5ea..83352ad 100644 --- a/src/DevTools.hpp +++ b/src/DevTools.hpp @@ -27,6 +27,7 @@ struct Settings { bool orderChildren = true; bool advancedSettings = false; bool showMemoryViewer = false; + bool showModGraph = false; std::string theme = DARK_THEME; ccColor4B themeColor = {2, 119, 189, 255}; }; diff --git a/src/pages/Advanced.cpp b/src/pages/Advanced.cpp index 88751e4..b7eb159 100644 --- a/src/pages/Advanced.cpp +++ b/src/pages/Advanced.cpp @@ -7,7 +7,6 @@ using namespace geode::prelude; void DevTools::drawAdvancedSettings() { ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 1.f, 1.f }); - ImGui::Checkbox("Show Mod Graph", &m_showModGraph); ImGui::PopStyleVar(); } diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index f718c7e..7def15f 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -69,6 +69,12 @@ void DevTools::drawSettings() { "Shows the memory viewer window." ); } + ImGui::Checkbox("Show Mod Graph", &m_settings.showModGraph); + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip( + "Shows the mod graph window." + ); + } ImGui::PopStyleVar(); ImGui::Separator(); From 87056432dd67ce0e643d48b205ba334e4c8afc5d Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 12:26:25 -0400 Subject: [PATCH 23/36] Add Rotate Rect checkbox for CCSprite --- src/pages/Attributes.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 941d30b..a717b0c 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -227,7 +227,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { spriteNode->getTextureRect().size.height, }; if (ImGui::DragFloat4("Rect", textureRect), 0.03f) { - spriteNode->setTextureRect({textureRect[0], textureRect[1], textureRect[2], textureRect[3]}); + spriteNode->setTextureRect({textureRect[0], textureRect[1], textureRect[2], textureRect[3]}, spriteNode->isTextureRectRotated(), spriteNode->getContentSize()); + } + + bool isRectRotated = spriteNode->isTextureRectRotated();; + if (ImGui::Checkbox("Rotate Rect", &isRectRotated)) { + spriteNode->setTextureRect(spriteNode->getTextureRect(), isRectRotated, spriteNode->getContentSize()); } } ImGui::NewLine(); From f10491127bef2b06eb05b7c427dfd9dbf5668a7b Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 12:32:17 -0400 Subject: [PATCH 24/36] Use delta time for Geode Team logo --- src/pages/Settings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 7def15f..1446633 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -200,7 +200,9 @@ void DevTools::drawSettings() { ImGui::TextWrapped("Developed by "); - RAINBOW_HUE += 0.01f; + float dt = CCDirector::get()->getDeltaTime(); + + RAINBOW_HUE += 0.25f * dt; if (RAINBOW_HUE >= 1.f) { RAINBOW_HUE = 0.f; } From c44d64f764ed8030474cfe9ab135330afc5a0c3e Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 12:43:32 -0400 Subject: [PATCH 25/36] Add Gradient Vector --- src/pages/Attributes.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index a717b0c..3ff3c52 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -165,6 +165,14 @@ void DevTools::drawNodeAttributes(CCNode* node) { gradient->setEndOpacity(static_cast(_color[3] * 255)); } } + CCPoint gradientVector = gradient->getVector(); + float vector[2] = { + gradientVector.x, + gradientVector.y + }; + if (ImGui::DragFloat2("Vector", vector, 0.05f)) { + gradient->setVector({vector[0], vector[1]}); + } } else { auto color = rgbaNode->getColor(); From 892e4e619de163655b2bc5727010c716f78d24fe Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 13:07:11 -0400 Subject: [PATCH 26/36] Add Auto Grow Axis to AxisLayout attributes --- src/pages/Attributes.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 3ff3c52..7248b1e 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -1028,6 +1028,26 @@ void DevTools::drawNodeAttributes(CCNode* node) { updateLayout = true; } + auto maxAutoGrowAxisOpt = layout->getAutoGrowAxis(); + float autoGrowAxis = maxAutoGrowAxisOpt.value_or(0); + bool hasAutoGrowAxis = maxAutoGrowAxisOpt.has_value(); + if (ImGui::Checkbox("Has Auto Grow Axis", &hasAutoGrowAxis)) { + if (hasAutoGrowAxis) { + layout->setAutoGrowAxis(0); + } + else { + layout->setAutoGrowAxis(std::nullopt); + } + updateLayout = true; + } + + if (hasAutoGrowAxis) { + if (ImGui::DragFloat("Auto Grow Axis", &autoGrowAxis)) { + layout->setAutoGrowAxis(autoGrowAxis); + updateLayout = true; + } + } + if (updateLayout) { node->updateLayout(); } From dedfdd7d8bf11407b84f29645855d97ce00ce8dd Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Thu, 1 May 2025 15:43:24 -0400 Subject: [PATCH 27/36] Add Ignore Invisible Children checkbox --- src/pages/Attributes.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/Attributes.cpp b/src/pages/Attributes.cpp index 7248b1e..9dc5c55 100644 --- a/src/pages/Attributes.cpp +++ b/src/pages/Attributes.cpp @@ -839,6 +839,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { layout->setGap(gap); updateLayout = true; } + + auto ignoreInvisibleChildren = layout->isIgnoreInvisibleChildren(); + if (ImGui::Checkbox("Ignore Invisible Children", &ignoreInvisibleChildren)) { + layout->ignoreInvisibleChildren(ignoreInvisibleChildren); + updateLayout = true; + } auto minRelativeScaleOpt = layout->getMinRelativeScale(); float minRelativeScale = minRelativeScaleOpt.value_or(0); @@ -1010,6 +1016,12 @@ void DevTools::drawNodeAttributes(CCNode* node) { updateLayout = true; } + auto ignoreInvisibleChildren = layout->isIgnoreInvisibleChildren(); + if (ImGui::Checkbox("Ignore Invisible Children", &ignoreInvisibleChildren)) { + layout->ignoreInvisibleChildren(ignoreInvisibleChildren); + updateLayout = true; + } + auto autoScale = layout->getAutoScale(); if (ImGui::Checkbox("Auto Scale", &autoScale)) { layout->setAutoScale(autoScale); From d4498494bba19494ed48beacd4ac2e6e1411589a Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:14:37 -0400 Subject: [PATCH 28/36] Fix mac --- src/platform/utils.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platform/utils.hpp b/src/platform/utils.hpp index 2d68411..4181404 100644 --- a/src/platform/utils.hpp +++ b/src/platform/utils.hpp @@ -2,6 +2,7 @@ #include #include +#include static inline std::string getNodeName(cocos2d::CCObject* node) { #ifdef GEODE_IS_WINDOWS From efd9558e57525880de650de0d8bb100fd03b9385 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:23:26 -0400 Subject: [PATCH 29/36] One more include to make mac happy --- src/platform/utils.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/utils.hpp b/src/platform/utils.hpp index 4181404..6a23e99 100644 --- a/src/platform/utils.hpp +++ b/src/platform/utils.hpp @@ -2,6 +2,9 @@ #include #include +#ifndef GEODE_IS_WINDOWS +#include +#endif #include static inline std::string getNodeName(cocos2d::CCObject* node) { From ca12c888846cc39fa27411d12b5d211005425db9 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:30:31 -0400 Subject: [PATCH 30/36] Make resolution changing windows only --- src/pages/Settings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index a9c5458..6784d2b 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -86,7 +86,7 @@ void DevTools::drawSettings() { ImGui::Text("GD Window"); - // TODO: undo later + #ifdef GEODE_IS_WINDOWS auto winSize = CCDirector::get()->getWinSize(); auto frameSize = GameManager::get()->resolutionForKey(GameManager::get()->m_resolution); auto fps = roundf(1 / CCDirector::get()->getAnimationInterval()); @@ -108,7 +108,6 @@ void DevTools::drawSettings() { GameManager::get()->m_resolution = selectedResolution; // TODO: idk how to do this on macos - #ifdef GEODE_IS_WINDOWS if (selectedResolution != 0) { auto size = GameManager::get()->resolutionForKey(selectedResolution); CCEGLView::get()->resizeWindow(size.width, size.height); From 4b576d0e6d1d85996a82f7b044fd12799136d805 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:32:18 -0400 Subject: [PATCH 31/36] I once again typoed --- src/pages/Settings.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 6784d2b..1764fe9 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -116,7 +116,6 @@ void DevTools::drawSettings() { CCEGLView::get()->resizeWindow(customResolution.width, customResolution.height); } CCEGLView::get()->centerWindow(); - #endif } if (selectedResolution == 0) { @@ -129,14 +128,14 @@ void DevTools::drawSettings() { size[1] = std::fabs(size[1]); customResolution = CCSizeMake(size[0], size[1]); } - #ifdef GEODE_IS_WINDOWS if (ImGui::Button("Apply##size-apply")) { GameManager::get()->m_resolution = 0; CCEGLView::get()->resizeWindow(customResolution.width, customResolution.height); CCEGLView::get()->centerWindow(); } - #endif } + #endif + ImGui::TextWrapped( "GL Size: %dx%d", From 92cadf4aa46fdb2be0bdb5b058dff24fa5ec301d Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:33:41 -0400 Subject: [PATCH 32/36] Gah, I hate ifdefs cuz I am blindsighted by it building for me --- src/pages/Settings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 1764fe9..40da74c 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -134,7 +134,6 @@ void DevTools::drawSettings() { CCEGLView::get()->centerWindow(); } } - #endif ImGui::TextWrapped( @@ -153,6 +152,8 @@ void DevTools::drawSettings() { static_cast(frameSize.width / ratio), static_cast(frameSize.height / ratio) ); + #endif + #if 0 static Ref PAUSED_TARGETS = nullptr; if (ImGui::Button(m_pauseGame ? "Resume Game" : "Pause Game")) { From 0cc7342f9841434d0138b08876522b8744069fe0 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 10:35:33 -0400 Subject: [PATCH 33/36] the #github channel will hate me, one more fix --- src/pages/Settings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index 40da74c..eab552c 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -81,12 +81,13 @@ void DevTools::drawSettings() { ImGui::Separator(); ImGui::DragFloat("Font Size", &ImGui::GetIO().FontGlobalScale, 0.01f, 1.0f, 3.0f); + + #ifdef GEODE_IS_WINDOWS ImGui::Separator(); ImGui::Text("GD Window"); - #ifdef GEODE_IS_WINDOWS auto winSize = CCDirector::get()->getWinSize(); auto frameSize = GameManager::get()->resolutionForKey(GameManager::get()->m_resolution); auto fps = roundf(1 / CCDirector::get()->getAnimationInterval()); From f84dda2622c75b9905aa21149cf2c1e093e24e73 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 11:08:02 -0400 Subject: [PATCH 34/36] Mac Support back --- src/pages/Settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index eab552c..e882988 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -82,7 +82,7 @@ void DevTools::drawSettings() { ImGui::DragFloat("Font Size", &ImGui::GetIO().FontGlobalScale, 0.01f, 1.0f, 3.0f); - #ifdef GEODE_IS_WINDOWS + #ifdef GEODE_IS_DESKTOP ImGui::Separator(); From a7a6fdee2430d618a58bc959f1c08c52b25c48b0 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Fri, 2 May 2025 11:12:55 -0400 Subject: [PATCH 35/36] This part is windows only though --- src/pages/Settings.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/Settings.cpp b/src/pages/Settings.cpp index e882988..20e852f 100644 --- a/src/pages/Settings.cpp +++ b/src/pages/Settings.cpp @@ -82,7 +82,7 @@ void DevTools::drawSettings() { ImGui::DragFloat("Font Size", &ImGui::GetIO().FontGlobalScale, 0.01f, 1.0f, 3.0f); - #ifdef GEODE_IS_DESKTOP +#ifdef GEODE_IS_DESKTOP ImGui::Separator(); @@ -92,6 +92,7 @@ void DevTools::drawSettings() { auto frameSize = GameManager::get()->resolutionForKey(GameManager::get()->m_resolution); auto fps = roundf(1 / CCDirector::get()->getAnimationInterval()); auto ratio = std::gcd(static_cast(frameSize.width), static_cast(frameSize.height)); +#ifdef GEODE_IS_WINDOWS std::string text = ""; text += "Custom"; @@ -135,6 +136,7 @@ void DevTools::drawSettings() { CCEGLView::get()->centerWindow(); } } +#endif ImGui::TextWrapped( @@ -153,7 +155,7 @@ void DevTools::drawSettings() { static_cast(frameSize.width / ratio), static_cast(frameSize.height / ratio) ); - #endif +#endif #if 0 static Ref PAUSED_TARGETS = nullptr; From f74dadedd8a194aef9cfc69d38920120752eaed9 Mon Sep 17 00:00:00 2001 From: Alphalaneous <38200084+Alphalaneous@users.noreply.github.com> Date: Sat, 3 May 2025 10:57:44 -0400 Subject: [PATCH 36/36] Update mod.json --- mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod.json b/mod.json index 529364e..761f20f 100644 --- a/mod.json +++ b/mod.json @@ -1,5 +1,5 @@ { - "geode": "4.3.1", + "geode": "4.4.0", "version": "v1.8.0", "gd": { "win": "*",