get codegen sources to compile

This commit is contained in:
altalk23 2023-12-21 17:13:39 +03:00
parent c33ec9942f
commit 7b793a4d1d
7 changed files with 46 additions and 16 deletions

View file

@ -9,6 +9,8 @@ if (GEODE_BUILDING_DOCS)
set(GEODE_DISABLE_PRECOMPILED_HEADERS On)
endif()
set(GEODE_GD_VERSION 2.200)
# Read version
file(READ VERSION GEODE_VERSION)
string(STRIP "${GEODE_VERSION}" GEODE_VERSION)
@ -156,13 +158,13 @@ ExternalProject_Add(CodegenProject
file(GLOB CODEGEN_DEPENDS CONFIGURE_DEPENDS
${GEODE_BINDINGS_REPO_PATH}/bindings/2.2/*.bro
${GEODE_BINDINGS_REPO_PATH}/bindings/${GEODE_GD_VERSION}/*.bro
${GEODE_BINDINGS_REPO_PATH}/codegen/src/*.cpp
${GEODE_BINDINGS_REPO_PATH}/codegen/src/*.hpp
)
if (NOT GEODE_BINDINGS_PATH)
set(GEODE_BINDINGS_PATH ${GEODE_BINDINGS_REPO_PATH}/bindings/2.2)
set(GEODE_BINDINGS_PATH ${GEODE_BINDINGS_REPO_PATH}/bindings/${GEODE_GD_VERSION})
endif()
file(GLOB CODEGEN_OUTPUTS CONFIGURE_DEPENDS

View file

@ -3,6 +3,9 @@
#include <algorithm>
#include <map>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
namespace geode::base {
@ -544,6 +547,16 @@ namespace gd {
return const_cast<vector&>(*this)[index];
}
};
// 2.2 TODO: Implement set, unordered_map and unordered_set
template <class V>
using set = std::set<V>;
template <class K, class V>
using unordered_map = std::unordered_map<K, V>;
template <class V>
using unordered_set = std::unordered_set<V>;
};
#elif defined(GEODE_IS_IOS)

View file

@ -43,7 +43,7 @@ public:
CCBool(bool v)
: m_bValue(v) {}
bool getValue() const {return m_bValue;}
bool setValue(bool value) { m_bValue = value; }
bool setValue(bool value) { m_bValue = value; return value; }
static CCBool* create(bool v)
{

View file

@ -119,6 +119,9 @@ void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsi
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
RT_ADD(void CC_DLL ccDrawFilledCircle( const CCPoint& center, float radius, float angle, unsigned int segments);)
// 2.2 additions
void ccDrawCircleSegment(cocos2d::CCPoint const&, float, float, float, unsigned int, bool, float, float);
/** draws a quad bezier path
@warning This function could be pretty slow. Use it only for debugging purposes.
@since v0.8

View file

@ -369,6 +369,8 @@ class CC_DLL CCLayerGradient : public CCLayerColor
{
GEODE_FRIEND_MODIFY
public:
GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCLayerGradient, CCLayerColor)
/** Creates a full-screen CCLayer with a gradient between start and end. */
static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end);

View file

@ -28,6 +28,11 @@ namespace geode::addresser {
template <class Function, class Class>
Class rthunkAdjust(Function func, Class self);
template <class Class>
concept HasZeroConstructor = requires {
new Class(ZeroConstructor);
};
class GEODE_DLL Addresser final {
template <char C>
struct SingleInheritance {
@ -65,11 +70,16 @@ namespace geode::addresser {
}
template <class Class>
static Class* cachedInstance() {
static Class* cachedInstance() requires HasZeroConstructor<Class> {
static auto ret = new Class(ZeroConstructor);
return ret;
}
template <class Class>
static Class* cachedInstance() requires (!HasZeroConstructor<Class>) {
return nullptr;
}
/**
* Specialized functionss
*/

View file

@ -92,12 +92,12 @@ protected:
} else {
btnSpr->setColor({ 200, 200, 200 });
}
auto btn = CCMenuItemSpriteExtra::create(
btnSpr, this, menu_selector(MySettingNode::onSelect)
);
btn->setTag(static_cast<int>(icon));
btn->setPosition(x, 0);
menu->addChild(btn);
// auto btn = CCMenuItemSpriteExtra::create(
// btnSpr, this, menu_selector(MySettingNode::onSelect)
// );
// btn->setTag(static_cast<int>(icon));
// btn->setPosition(x, 0);
// menu->addChild(btn);
x += 50.f;
}
@ -152,14 +152,14 @@ struct MyMenuLayer : Modify<MyMenuLayer, MenuLayer> {
void onMoreGames(CCObject*) {
TestEvent("Event system works!").post();
if (Mod::get()->getSettingValue<bool>("its-raining-after-all")) {
FLAlertLayer::create("Damn", ":(", "OK")->show();
// FLAlertLayer::create("Damn", ":(", "OK")->show();
}
else {
FLAlertLayer::create(
"Yay",
"The weather report said it wouldn't rain today :)",
"OK"
)->show();
// FLAlertLayer::create(
// "Yay",
// "The weather report said it wouldn't rain today :)",
// "OK"
// )->show();
}
}
};