mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-24 13:23:50 -04:00
Merge branch 'main' of https://github.com/geode-sdk/geode into cceaserateaction
This commit is contained in:
commit
bd336e20b9
3 changed files with 30 additions and 9 deletions
|
@ -15,6 +15,12 @@ endif()
|
|||
|
||||
option(GEODE_USE_BREAKPAD "Enables the use of the Breakpad library for crash dumps." ON)
|
||||
|
||||
# Check if git is installed, raise a fatal error if not
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "Git not found! Please install Git and try again.\nhttps://git-scm.com/")
|
||||
endif()
|
||||
|
||||
# Read version
|
||||
file(READ VERSION GEODE_VERSION)
|
||||
string(STRIP "${GEODE_VERSION}" GEODE_VERSION)
|
||||
|
@ -238,7 +244,7 @@ endif()
|
|||
set(MAT_JSON_AS_INTERFACE ON)
|
||||
CPMAddPackage("gh:geode-sdk/result@1.3.3")
|
||||
CPMAddPackage("gh:geode-sdk/json@3.2.1")
|
||||
CPMAddPackage("gh:fmtlib/fmt#11.0.2")
|
||||
CPMAddPackage("gh:fmtlib/fmt#11.1.4")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)
|
||||
|
||||
|
|
|
@ -15,9 +15,19 @@ constexpr auto METADATA_TAG = 0xB324ABC;
|
|||
|
||||
struct ProxyCCNode;
|
||||
|
||||
static uint64_t fnv1aHash(char const* str) {
|
||||
uint64_t hash = 0xcbf29ce484222325;
|
||||
while (*str) {
|
||||
hash ^= *str++;
|
||||
hash *= 0x100000001b3;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
class GeodeNodeMetadata final : public cocos2d::CCObject {
|
||||
private:
|
||||
std::unordered_map<std::string, FieldContainer*> m_classFieldContainers;
|
||||
// for performance reasons, this key is the hash of the class name
|
||||
std::unordered_map<uint64_t, FieldContainer*> m_classFieldContainers;
|
||||
std::string m_id = "";
|
||||
Ref<Layout> m_layout = nullptr;
|
||||
Ref<LayoutOptions> m_layoutOptions = nullptr;
|
||||
|
@ -63,10 +73,14 @@ public:
|
|||
}
|
||||
|
||||
FieldContainer* getFieldContainer(char const* forClass) {
|
||||
if (!m_classFieldContainers.count(forClass)) {
|
||||
m_classFieldContainers[forClass] = new FieldContainer();
|
||||
auto hash = fnv1aHash(forClass);
|
||||
|
||||
auto& container = m_classFieldContainers[hash];
|
||||
if (!container) {
|
||||
container = new FieldContainer();
|
||||
}
|
||||
return m_classFieldContainers[forClass];
|
||||
|
||||
return container;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,7 +92,7 @@ struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
|
|||
return asNode->getUserObject("");
|
||||
}
|
||||
else {
|
||||
// apparently this function is the same as
|
||||
// apparently this function is the same as
|
||||
// CCDirector::getNextScene so yeah
|
||||
return m_pUserObject;
|
||||
}
|
||||
|
@ -224,7 +238,7 @@ public:
|
|||
}
|
||||
collectedID.push_back(c);
|
||||
}
|
||||
// Any other character is syntax error due to needing to reserve
|
||||
// Any other character is syntax error due to needing to reserve
|
||||
// stuff for possible future features
|
||||
else {
|
||||
return Err("Unexpected character '{}' at index {}", c, i);
|
||||
|
|
|
@ -25,10 +25,11 @@ void GenericContentLayer::setPosition(CCPoint const& pos) {
|
|||
|
||||
for (auto child : CCArrayExt<CCNode*>(m_pChildren)) {
|
||||
float childY = this->getPositionY() + child->getPositionY();
|
||||
float childTop = childY + (1.f - child->getAnchorPoint().y) * child->getScaledContentSize().height;
|
||||
auto anchor = child->isIgnoreAnchorPointForPosition() ? CCPoint{ 0, 0 } : child->getAnchorPoint();
|
||||
float childTop = childY + (1.f - anchor.y) * child->getScaledContentSize().height;
|
||||
float childBottom = childY - child->getAnchorPoint().y * child->getScaledContentSize().height;
|
||||
bool visible = childTop > 0 && childBottom < scrollLayerSize.height;
|
||||
|
||||
|
||||
child->setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue