From e05d2fb9dc87201ccbaa0a514cac5b4106e81f4b Mon Sep 17 00:00:00 2001 From: Erymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> Date: Sat, 23 Mar 2024 20:45:27 -0400 Subject: [PATCH] change to map, remove incompat with capeling, add github action --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++++++++++ mod.json | 19 ++++++------- src/main.cpp | 31 +++++++++++----------- 3 files changed, 77 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..327bdf1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: Build Geode Mod + +on: + workflow_dispatch: + push: + branches: + - "**" + +jobs: + build: + strategy: + fail-fast: false + matrix: + config: + - name: Windows + os: windows-latest + + - name: macOS + os: macos-latest + + - name: Android32 + os: ubuntu-latest + target: Android32 + + - name: Android64 + os: ubuntu-latest + target: Android64 + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Build the mod + uses: geode-sdk/build-geode-mod@main + with: + combine: true + target: ${{ matrix.config.target }} + + package: + name: Package builds + runs-on: ubuntu-latest + needs: ['build'] + + steps: + - uses: geode-sdk/build-geode-mod/combine@main + id: build + + - uses: actions/upload-artifact@v4 + with: + name: Build Output + path: ${{ steps.build.outputs.build-output }} diff --git a/mod.json b/mod.json index 21899e9..fef6867 100644 --- a/mod.json +++ b/mod.json @@ -1,24 +1,21 @@ { "geode": "2.0.0-beta.21", - "gd": "2.204", - "version": "v1.0.3", + "gd": { + "mac": "2.200", + "android": "2.205", + "win": "2.204" + }, + "version": "v1.1.0", "id": "petitfrapo.nomoregrayfilter", "name": "NoMoreGrayFilter", "developer": "PetitFrapo", - "description": "Removes the filthy gray filter from the Event, Map and Versus button. Should be compatible with any mod, but please report any issue on the GitHub repo. Cosmetic only, of course.", + "description": "Removes the gray filter from the Event, Map and Versus buttons. Cosmetic only, of course.", "dependencies": [ { "id": "geode.node-ids", - "version": "v1.8.1", + "version": ">=v1.8.1", "importance": "required" } ], - "incompatibilities": [ - { - "id": "capeling.goodbye_unnecessary_buttons", - "version": "*", - "importance": "breaking" - } - ], "repository": "https://github.com/petitfrapo/nomoregrayfilter" } diff --git a/src/main.cpp b/src/main.cpp index 7549bad..ce3e5e1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,27 +12,29 @@ class $modify(CreatorLayer) { }; auto sprev = CCSprite::createWithSpriteFrameName("GJ_eventBtn_001.png"); - sprev->setScale(0.750f); + sprev->setScale(.75f); auto sprmap = CCSprite::createWithSpriteFrameName("GJ_mapBtn_001.png"); - sprmap->setScale(0.750f); + sprmap->setScale(.75f); auto sprvers = CCSprite::createWithSpriteFrameName("GJ_versusBtn_001.png"); - sprvers->setScale(0.750f); - - auto eventBtn = CCMenuItemSpriteExtra::create(sprev, this, menu_selector(CreatorLayer::onEventLevel)); - auto mapBtn = CCMenuItemSpriteExtra::create(sprmap, this, menu_selector(CreatorLayer::onAdventureMap)); - auto versusBtn = CCMenuItemSpriteExtra::create(sprvers, this, menu_selector(CreatorLayer::onMultiplayer)); + sprvers->setScale(.75f); auto menu = this->getChildByID("creator-buttons-menu"); - const char * ids[3] = {"event-button", "map-button", "versus-button"}; - CCMenuItemSpriteExtra * btns[3] = {eventBtn, mapBtn, versusBtn}; - for (int i = 0; i < 3; i++) { + std::map idsToBtns = { + { "event-button", CCMenuItemSpriteExtra::create(sprev, this, menu_selector(CreatorLayer::onEventLevel)) }, + { "map-button", CCMenuItemSpriteExtra::create(sprmap, this, menu_selector(CreatorLayer::onAdventureMap)) }, + { "versus-button", CCMenuItemSpriteExtra::create(sprvers, this, menu_selector(CreatorLayer::onMultiplayer)) } + }; + + for (auto pair = idsToBtns.begin(); pair != idsToBtns.end(); pair++) { + auto id = pair->first.c_str(); + auto superExpertLoaded = ((strcmp("versus-button", id) == 0) && (Loader::get()->isModLoaded("xanii.super_expert"))); - auto superExpertLoaded = ((i = 2) && (Loader::get()->isModLoaded("xanii.super_expert"))); + if (!menu->getChildByID(id)) continue; // avoid crash if child not found - auto btn = menu->getChildByID(ids[i]); + auto btn = menu->getChildByID(id); auto evx = btn->getPositionX(); auto evy = btn->getPositionY(); @@ -40,14 +42,13 @@ class $modify(CreatorLayer) { btn->removeFromParent(); } - auto saidBtn = btns[i]; - saidBtn->setID(ids[i]); + auto saidBtn = pair->second; + saidBtn->setID(id); saidBtn->setPosition({ evx, evy }); if (!superExpertLoaded) { menu->addChild(saidBtn); }; - } return true; }