Merge branch 'geode-sdk:main' into altalk

This commit is contained in:
alk 2022-10-30 21:25:03 +03:00 committed by GitHub
commit 444464b185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 65 additions and 3 deletions

View file

@ -1,5 +1,16 @@
# Geode Changelog # 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<nlohmann::json>` and `JsonChecker<nlohmann::ordered_json>` are now defined in-source as exported symbols to speed up compilation times
- Add more bindings
## v0.6.0 ## v0.6.0
- Mod resource loading has been reworked again, with the intent of adding support for texture pack loaders - Mod resource loading has been reworked again, with the intent of adding support for texture pack loaders

View file

@ -126,6 +126,7 @@ class cocos2d::CCDirector {
auto calculateMPF() = mac 0x19eac0; auto calculateMPF() = mac 0x19eac0;
auto convertToGL(cocos2d::CCPoint const&) = mac 0x24a210; auto convertToGL(cocos2d::CCPoint const&) = mac 0x24a210;
auto drawScene() = mac 0x249690; auto drawScene() = mac 0x249690;
auto willSwitchToScene(cocos2d::CCScene* scene);
auto setNextScene() = mac 0x2498d0; auto setNextScene() = mac 0x2498d0;
auto showStats() = mac 0x2499e0; auto showStats() = mac 0x2499e0;
@ -206,6 +207,11 @@ class cocos2d::CCFileUtils : cocos2d::TypeInfo {
virtual std::string fullPathForFilename(const char* filename, bool unk); virtual std::string fullPathForFilename(const char* filename, bool unk);
} }
class cocos2d::CCGLProgram {
auto setUniformsForBuiltins() = mac 0x232c70;
auto use() = mac 0x231d70;
}
class cocos2d::CCHide { class cocos2d::CCHide {
static cocos2d::CCHide* create() = mac 0x4543e0; static cocos2d::CCHide* create() = mac 0x4543e0;
} }
@ -698,6 +704,11 @@ class cocos2d::CCSet {
auto anyObject() = mac 0x45b410; auto anyObject() = mac 0x45b410;
} }
class cocos2d::CCShaderCache {
static auto sharedShaderCache() = mac 0xe6d10;
auto programForKey(const char*) = mac 0xe7d40;
}
class cocos2d::CCSprite { class cocos2d::CCSprite {
virtual ~CCSprite() = mac 0x133430, ios 0x15b92c; virtual ~CCSprite() = mac 0x133430, ios 0x15b92c;
virtual auto init() = mac 0x132ef0, ios 0x15b488; virtual auto init() = mac 0x132ef0, ios 0x15b488;
@ -1014,6 +1025,8 @@ class cocos2d::extension::CCScrollView {
class cocos2d { class cocos2d {
static auto ccGLBlendFunc(GLenum, GLenum) = mac 0x1ae560; static auto ccGLBlendFunc(GLenum, GLenum) = mac 0x1ae560;
static auto ccDrawSolidRect(cocos2d::CCPoint, cocos2d::CCPoint, cocos2d::_ccColor4F) = mac 0xecf00; 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 { // class DS_Dictionary {

View file

@ -346,8 +346,26 @@ class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite {
void setSizeMult(float) = mac 0x1255e0, win 0x19080; void setSizeMult(float) = mac 0x1255e0, win 0x19080;
CCMenuItemSpriteExtra() = mac 0x32670, win 0x18db0; CCMenuItemSpriteExtra() = mac 0x32670, win 0x18db0;
~CCMenuItemSpriteExtra() = win 0x18eb0; ~CCMenuItemSpriteExtra() = win 0x18eb0;
bool init(cocos2d::CCNode*, cocos2d::CCNode*, cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x125450, win 0x18fa0; bool init(
bool init(cocos2d::CCNode* spr) = win 0x18fa0; 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 activate() = mac 0x125730, win 0x191c0;
void selected() = mac 0x125840, win 0x19270; void selected() = mac 0x125840, win 0x19270;
void unselected() = mac 0x125a70, win 0x19430; void unselected() = mac 0x125a70, win 0x19430;

View file

@ -1,5 +1,8 @@
#pragma once #pragma once
#include "../DefaultInclude.hpp"
#include <cocos2d.h>
namespace cocos2d { namespace cocos2d {
class CCArray; class CCArray;
class CCNode; class CCNode;

View file

@ -242,7 +242,7 @@ namespace geode {
return T(); return T();
} }
JsonMaybeObject<Json> obj(); GEODE_DLL JsonMaybeObject<Json> obj();
template<class T> template<class T>
struct Iterator { struct Iterator {

View file

@ -123,6 +123,14 @@ namespace geode::cocos {
*/ */
GEODE_DLL cocos2d::CCRect calculateChildCoverage(cocos2d::CCNode* parent); 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 * Rescale node to fit inside given size
* @param node Node to rescale * @param node Node to rescale

View file

@ -99,3 +99,12 @@ bool geode::cocos::fileExistsInSearchPaths(const char* filename) {
auto utils = CCFileUtils::sharedFileUtils(); auto utils = CCFileUtils::sharedFileUtils();
return utils->isFileExist(utils->fullPathForFilename(filename, false)); 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;
}