Skip to content

Commit 9118b70

Browse files
committed
v1.6.0
1 parent d2e2ce5 commit 9118b70

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.6.0
2+
3+
- Added color offset option
4+
15
# v1.5.2
26

37
- Added macOS support

mod.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"win": "2.2074",
66
"mac": "2.2074"
77
},
8-
"version": "v1.5.2",
8+
"version": "v1.6.0",
99
"id": "omgrod.geodify",
1010
"name": "Geodify",
1111
"developers": ["OmgRod", "Viper"],
@@ -15,6 +15,12 @@
1515
"sprites": ["res/*.png"]
1616
},
1717
"settings": {
18+
"color": {
19+
"name": "Color Offset",
20+
"description": "The color offset of the background.",
21+
"type": "color",
22+
"default": "#FF0000"
23+
}
1824
"show-main": {
1925
"name": "Show in main menu",
2026
"description": "MenuLayer",

src/SwelvyBG.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
2020
float y = m_obContentSize.height + 5;
2121
int idx = 0;
2222

23+
// Retrieve the color offset setting
24+
auto mod = Loader::get()->getMod("omgrod.geodify");
25+
ccColor3B colorOffset = {255, 0, 0}; // Default color offset
26+
if (mod) {
27+
auto colorSetting = mod->getSettingValue<std::string>("color");
28+
if (!colorSetting.empty()) {
29+
sscanf(colorSetting.c_str(), "%hhu,%hhu,%hhu", &colorOffset.r, &colorOffset.g, &colorOffset.b);
30+
}
31+
}
32+
2333
for (auto layer : std::initializer_list<std::pair<ccColor3B, const char*>> {
2434
{ ccc3(244, 212, 142), "geode.loader/swelve-layer3.png" },
2535
{ ccc3(245, 174, 125), "geode.loader/swelve-layer0.png" },
@@ -28,6 +38,13 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
2838
{ ccc3(173, 84, 146), "geode.loader/swelve-layer1.png" },
2939
{ ccc3(113, 74, 154), "geode.loader/swelve-layer0.png" },
3040
}) {
41+
// Apply the color offset
42+
ccColor3B adjustedColor = {
43+
static_cast<GLubyte>(std::min(255, layer.first.r + colorOffset.r)),
44+
static_cast<GLubyte>(std::min(255, layer.first.g + colorOffset.g)),
45+
static_cast<GLubyte>(std::min(255, layer.first.b + colorOffset.b))
46+
};
47+
3148
float speed = dis(gen);
3249
if (sign(gen) == 0) {
3350
speed = -speed;
@@ -45,7 +62,7 @@ bool SwelvyBG::init(float widthmult, float hightmult, float minspeed, float maxs
4562
sprite->setTextureRect(rect);
4663
sprite->setAnchorPoint({ 0, 1 });
4764
sprite->setContentSize({winSize.width * widthmult, sprite->getContentSize().height});
48-
sprite->setColor(layer.first);
65+
sprite->setColor(adjustedColor);
4966
sprite->setPosition({0, y});
5067
sprite->schedule(schedule_selector(SwelvyBG::updateSpritePosition));
5168
sprite->setUserObject("speed", CCFloat::create(speed));

0 commit comments

Comments
 (0)