Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
OmgRod committed Nov 19, 2024
1 parent d2e2ce5 commit 9118b70
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.6.0

- Added color offset option

# v1.5.2

- Added macOS support
Expand Down
8 changes: 7 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"win": "2.2074",
"mac": "2.2074"
},
"version": "v1.5.2",
"version": "v1.6.0",
"id": "omgrod.geodify",
"name": "Geodify",
"developers": ["OmgRod", "Viper"],
Expand All @@ -15,6 +15,12 @@
"sprites": ["res/*.png"]
},
"settings": {
"color": {
"name": "Color Offset",
"description": "The color offset of the background.",
"type": "color",
"default": "#FF0000"
}
"show-main": {
"name": "Show in main menu",
"description": "MenuLayer",
Expand Down
19 changes: 18 additions & 1 deletion src/SwelvyBG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
float y = m_obContentSize.height + 5;
int idx = 0;

// Retrieve the color offset setting
auto mod = Loader::get()->getMod("omgrod.geodify");
ccColor3B colorOffset = {255, 0, 0}; // Default color offset
if (mod) {
auto colorSetting = mod->getSettingValue<std::string>("color");
if (!colorSetting.empty()) {
sscanf(colorSetting.c_str(), "%hhu,%hhu,%hhu", &colorOffset.r, &colorOffset.g, &colorOffset.b);
}
}

for (auto layer : std::initializer_list<std::pair<ccColor3B, const char*>> {
{ ccc3(244, 212, 142), "geode.loader/swelve-layer3.png" },
{ ccc3(245, 174, 125), "geode.loader/swelve-layer0.png" },
Expand All @@ -28,6 +38,13 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
{ ccc3(173, 84, 146), "geode.loader/swelve-layer1.png" },
{ ccc3(113, 74, 154), "geode.loader/swelve-layer0.png" },
}) {
// Apply the color offset
ccColor3B adjustedColor = {
static_cast<GLubyte>(std::min(255, layer.first.r + colorOffset.r)),
static_cast<GLubyte>(std::min(255, layer.first.g + colorOffset.g)),
static_cast<GLubyte>(std::min(255, layer.first.b + colorOffset.b))
};

float speed = dis(gen);
if (sign(gen) == 0) {
speed = -speed;
Expand All @@ -45,7 +62,7 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
sprite->setTextureRect(rect);
sprite->setAnchorPoint({ 0, 1 });
sprite->setContentSize({winSize.width * widthmult, sprite->getContentSize().height});
sprite->setColor(layer.first);
sprite->setColor(adjustedColor);
sprite->setPosition({0, y});
sprite->schedule(schedule_selector(SwelvyBG::updateSpritePosition));
sprite->setUserObject("speed", CCFloat::create(speed));
Expand Down

0 comments on commit 9118b70

Please sign in to comment.