Skip to content

Commit

Permalink
change to map, remove incompat with capeling, add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Mar 24, 2024
1 parent d944623 commit e05d2fb
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 26 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 8 additions & 11 deletions mod.json
Original file line number Diff line number Diff line change
@@ -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"
}
31 changes: 16 additions & 15 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,43 @@ 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<std::string, CCMenuItemSpriteExtra*> 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();

if (!superExpertLoaded) {
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;
}
Expand Down

0 comments on commit e05d2fb

Please sign in to comment.