diff --git a/CHANGELOG.md b/CHANGELOG.md index efae4031..e5cbe57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Geode Changelog +## v0.6.1 + - Add `geode::cocos::switchToScene` utility for easily switching to a layer with the default fade transition + - Add `Mod::getPackagePath` as a replacement for `Mod::getPath` + - Add `geode/config` directory as a standardized place for mods to add their config files + - Add `Mod::getConfigDir` for getting a mods' config directory + - Add open config directory button to mods with a config directory + - Add open save directory button to mods' settings popup + - Removed deprecation from `Result` (it still will be replaced in v1.0.0, we just got tired of the warnings) + - `JsonChecker` and `JsonChecker` are now defined in-source as exported symbols to speed up compilation times + - Add more bindings + ## v0.6.0 - Mod resource loading has been reworked again, with the intent of adding support for texture pack loaders diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 987405c9..84b39f50 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -126,6 +126,7 @@ class cocos2d::CCDirector { auto calculateMPF() = mac 0x19eac0; auto convertToGL(cocos2d::CCPoint const&) = mac 0x24a210; auto drawScene() = mac 0x249690; + auto willSwitchToScene(cocos2d::CCScene* scene); auto setNextScene() = mac 0x2498d0; auto showStats() = mac 0x2499e0; @@ -206,6 +207,11 @@ class cocos2d::CCFileUtils : cocos2d::TypeInfo { virtual std::string fullPathForFilename(const char* filename, bool unk); } +class cocos2d::CCGLProgram { + auto setUniformsForBuiltins() = mac 0x232c70; + auto use() = mac 0x231d70; +} + class cocos2d::CCHide { static cocos2d::CCHide* create() = mac 0x4543e0; } @@ -698,6 +704,11 @@ class cocos2d::CCSet { auto anyObject() = mac 0x45b410; } +class cocos2d::CCShaderCache { + static auto sharedShaderCache() = mac 0xe6d10; + auto programForKey(const char*) = mac 0xe7d40; +} + class cocos2d::CCSprite { virtual ~CCSprite() = mac 0x133430, ios 0x15b92c; virtual auto init() = mac 0x132ef0, ios 0x15b488; @@ -1014,6 +1025,8 @@ class cocos2d::extension::CCScrollView { class cocos2d { static auto ccGLBlendFunc(GLenum, GLenum) = mac 0x1ae560; static auto ccDrawSolidRect(cocos2d::CCPoint, cocos2d::CCPoint, cocos2d::_ccColor4F) = mac 0xecf00; + static auto ccGLEnableVertexAttribs(unsigned int) = mac 0x1ae740; + static auto ccGLBindTexture2D(GLuint) = mac 0x1ae610; } // class DS_Dictionary { diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index baefccb2..82e6f1e1 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -346,8 +346,26 @@ class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite { void setSizeMult(float) = mac 0x1255e0, win 0x19080; CCMenuItemSpriteExtra() = mac 0x32670, win 0x18db0; ~CCMenuItemSpriteExtra() = win 0x18eb0; - bool init(cocos2d::CCNode*, cocos2d::CCNode*, cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x125450, win 0x18fa0; - bool init(cocos2d::CCNode* spr) = win 0x18fa0; + bool init( + cocos2d::CCNode* normalImage, + cocos2d::CCNode* selectedImage, + cocos2d::CCObject* target, + cocos2d::SEL_MenuHandler callback + ) { + if (!cocos2d::CCMenuItemSprite::initWithNormalSprite( + normalImage, selectedImage, nullptr, target, callback + )) return false; + + this->setAnchorPoint({ .5f, .5f }); + this->setContentSize(normalImage->getScaledContentSize()); + normalImage->setPosition(m_obContentSize / 2); + + m_baseScale = 1.f; + m_animationEnabled = true; + m_scaleMultiplier = 1.26f; + + return true; + } void activate() = mac 0x125730, win 0x191c0; void selected() = mac 0x125840, win 0x19270; void unselected() = mac 0x125a70, win 0x19430; diff --git a/loader/include/Geode/ui/SceneManager.hpp b/loader/include/Geode/ui/SceneManager.hpp index 899562f4..b55df386 100644 --- a/loader/include/Geode/ui/SceneManager.hpp +++ b/loader/include/Geode/ui/SceneManager.hpp @@ -1,5 +1,8 @@ #pragma once +#include "../DefaultInclude.hpp" +#include + namespace cocos2d { class CCArray; class CCNode; diff --git a/loader/include/Geode/utils/JsonValidation.hpp b/loader/include/Geode/utils/JsonValidation.hpp index bd0c5773..19618f2f 100644 --- a/loader/include/Geode/utils/JsonValidation.hpp +++ b/loader/include/Geode/utils/JsonValidation.hpp @@ -242,7 +242,7 @@ namespace geode { return T(); } - JsonMaybeObject obj(); + GEODE_DLL JsonMaybeObject obj(); template struct Iterator { diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index cf7232de..7ed58a14 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -123,6 +123,14 @@ namespace geode::cocos { */ GEODE_DLL cocos2d::CCRect calculateChildCoverage(cocos2d::CCNode* parent); + /** + * Create a CCScene from a layer and switch to it with the default fade + * transition + * @param layer Layer to create a scene from + * @returns Created scene (not the fade transition) + */ + GEODE_DLL cocos2d::CCScene* switchToScene(cocos2d::CCLayer* layer); + /** * Rescale node to fit inside given size * @param node Node to rescale diff --git a/loader/src/utils/cocos.cpp b/loader/src/utils/cocos.cpp index 2751a052..8e3061ec 100644 --- a/loader/src/utils/cocos.cpp +++ b/loader/src/utils/cocos.cpp @@ -99,3 +99,12 @@ bool geode::cocos::fileExistsInSearchPaths(const char* filename) { auto utils = CCFileUtils::sharedFileUtils(); return utils->isFileExist(utils->fullPathForFilename(filename, false)); } + +CCScene* geode::cocos::switchToScene(CCLayer* layer) { + auto scene = CCScene::create(); + scene->addChild(layer); + CCDirector::get()->replaceScene(CCTransitionFade::create( + .5f, scene + )); + return scene; +}