Skip to content

Commit

Permalink
I'm tired
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Oct 9, 2024
1 parent a700919 commit b02a83f
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

project(MoreIcons VERSION 1.2.2)
project(MoreIcons VERSION 1.2.3)

add_library(${PROJECT_NAME} SHARED
src/classes/DummyNode.cpp
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A mod that loads custom icons.
## Adding Icons
To add a custom icon, you need an icon spritesheet (.plist) and an icon atlas (.png). Tools like [GDBrowser's Icon Kit](https://gdbrowser.com/iconkit) can be used to create these spritesheets and atlases, with the "Developer Mode" option enabled in the settings.

With trails, you will only need the trail image (.png). It will be automatically resized to fit the game's resolution.

The spritesheet should be in the format of a typical Geometry Dash icon spritesheet, with the primary sprite, secondary sprite, glow sprite, and an optional detail sprite. UFOs contain a fifth sprite for the dome.

The atlas should be a single image containing all the sprites in the spritesheet. Tools like [Colon's Spritesheet Splitter](https://gdcolon.com/gdsplitter) can be used to split a spritesheet into individual sprites and combine them into an atlas.
Expand Down
2 changes: 2 additions & 0 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A mod that loads custom icons.
## Adding Icons
To add a custom icon, you need an icon spritesheet (.plist) and an icon atlas (.png). Tools like [GDBrowser's Icon Kit](https://gdbrowser.com/iconkit) can be used to create these spritesheets and atlases, with the "Developer Mode" option enabled in the settings.

With trails, you will only need the trail image (.png). It will be automatically resized to fit the game's resolution.

The spritesheet should be in the format of a typical Geometry Dash icon spritesheet, with the primary sprite, secondary sprite, glow sprite, and an optional detail sprite. UFOs contain a fifth sprite for the dome.

The atlas should be a single image containing all the sprites in the spritesheet. Tools like [Colon's Spritesheet Splitter](https://gdcolon.com/gdsplitter) can be used to split a spritesheet into individual sprites and combine them into an atlas.
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# More Icons Changelog
## v1.2.3 (2024-10-08)
- Fixed blend mode not working properly ([#5](https://github.com/hiimjustin000/MoreIcons/issues/5))
- Fixed trail customization resetting when reloading textures
- Fixed trail display in the icon kit
- Fixed loading text not showing up

## v1.2.2 (2024-10-08)
- Added support for individual images per icon piece
- Added trail customization options ([#5](https://github.com/hiimjustin000/MoreIcons/issues/5))
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"win": "2.206",
"mac": "2.206"
},
"version": "v1.2.2",
"version": "v1.2.3",
"id": "hiimjustin000.more_icons",
"name": "More Icons",
"developer": "hiimjustin000",
Expand Down
13 changes: 1 addition & 12 deletions src/MoreIcons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@

using namespace geode::prelude;

$on_mod(Loaded) {
MoreIcons::load();
}

$on_mod(DataSaved) {
for (auto& [trail, info] : MoreIcons::TRAIL_INFO) {
std::fstream file(std::filesystem::path(info.texture).replace_extension(".json"), std::ios::out);
file << matjson::Value(matjson::Object{
{ "blend", info.blend },
{ "tint", info.tint },
}).dump();
file.close();
}
MoreIcons::saveTrails();
}

// https://github.com/GlobedGD/globed2/blob/v1.6.2/src/util/cocos.cpp#L44
Expand Down
11 changes: 11 additions & 0 deletions src/MoreIcons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class MoreIcons {
JETPACKS.clear();
geode::Mod::get()->setSavedValue("jetpacks", JETPACKS);
TRAILS.clear();
saveTrails();
TRAIL_INFO.clear();
geode::Mod::get()->setSavedValue("trails", TRAILS);
}
Expand Down Expand Up @@ -107,6 +108,16 @@ class MoreIcons {
IconType type, bool create
);
static void loadTrails(const std::filesystem::path& path, std::vector<std::string>& duplicates, bool create);
static void saveTrails() {
for (auto& [trail, info] : MoreIcons::TRAIL_INFO) {
std::fstream file(std::filesystem::path(info.texture).replace_extension(".json"), std::ios::out);
file << matjson::Value(matjson::Object{
{ "blend", info.blend },
{ "tint", info.tint },
}).dump();
file.close();
}
}
static void changeSimplePlayer(SimplePlayer* player, IconType type) {
changeSimplePlayer(player, geode::Mod::get()->getSavedValue<std::string>(savedForType(type), ""), type);
}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/GJGarageLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class $modify(MIGarageLayer, GJGarageLayer) {
auto texture = CCTextureCache::get()->textureForKey(MoreIcons::TRAIL_INFO[name].texture.c_str());
auto streak = CCSprite::createWithTexture(texture);
limitNodeWidth(streak, 27.0f, 99.0f, 0.01f);
streak->setRotation(90.0f);
streak->setRotation(-90.0f);
square->addChild(streak);
streak->setPosition(square->getContentSize() / 2);
square->setScale(0.8f);
Expand All @@ -342,7 +342,7 @@ class $modify(MIGarageLayer, GJGarageLayer) {
square->setColor({ 150, 150, 150 });
auto streak = CCSprite::createWithTexture(texture);
limitNodeWidth(streak, 27.0f, 99.0f, 0.01f);
streak->setRotation(90.0f);
streak->setRotation(-90.0f);
square->addChild(streak);
streak->setPosition(square->getContentSize() / 2);
square->setPosition(popupIcon->getPosition());
Expand Down
6 changes: 0 additions & 6 deletions src/hooks/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@ class $modify(MIGameManager, GameManager) {

if (m_unkBool1) MoreIcons::clear();
}

void reloadAllStep5() {
GameManager::reloadAllStep5();

if (m_unkBool1) MoreIcons::load();
}
};
21 changes: 5 additions & 16 deletions src/hooks/LoadingLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,14 @@ using namespace geode::prelude;

#include <Geode/modify/LoadingLayer.hpp>
class $modify(MILoadingLayer, LoadingLayer) {
bool init(bool refresh) {
if (!LoadingLayer::init(refresh)) return false;

MoreIcons::LOADING_LAYER = this;

return true;
}

#ifndef GEODE_IS_ANDROID // Compiler optimizations that aren't present in the Android version
void loadAssets() {
LoadingLayer::loadAssets();

if (m_loadStep == 14) MoreIcons::LOADING_LAYER = nullptr;
}
#else
void loadingFinished() {
LoadingLayer::loadingFinished();
if (m_loadStep == 1) {
MoreIcons::LOADING_LAYER = this;
MoreIcons::load();
}

MoreIcons::LOADING_LAYER = nullptr;
if (m_loadStep == 14) MoreIcons::LOADING_LAYER = nullptr;
}
#endif
};
4 changes: 2 additions & 2 deletions src/hooks/PlayerObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ class $modify(MIPlayerObject, PlayerObject) {
m_streakRelated2 = !trailInfo.tint;
m_streakRelated3 = false;
if (m_regularTrail) m_regularTrail->removeFromParent();
m_regularTrail = CCMotionStreak::create(trailInfo.blend ? 0.3f : 1.0f, 5.0f, 14.0f, { 255, 255, 255 },
CCTextureCache::get()->textureForKey(trailInfo.texture.c_str()));
m_regularTrail = CCMotionStreak::create(0.3f, 5.0f, 14.0f, { 255, 255, 255 }, CCTextureCache::get()->textureForKey(trailInfo.texture.c_str()));
if (trailInfo.blend) m_regularTrail->setBlendFunc({ GL_SRC_ALPHA, GL_ONE });
#if defined(GEODE_IS_ANDROID32)
*reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(m_regularTrail) + 0x168) = 50.0f;
#elif defined(GEODE_IS_ANDROID64)
Expand Down

0 comments on commit b02a83f

Please sign in to comment.