This commit is contained in:
altalk23 2024-02-16 21:37:15 +03:00
commit 07dd379611
2 changed files with 24 additions and 0 deletions

View file

@ -1022,6 +1022,11 @@ public:
*/ */
GEODE_DLL void swapChildIndices(CCNode* first, CCNode* second); GEODE_DLL void swapChildIndices(CCNode* first, CCNode* second);
GEODE_DLL void setContentWidth(float width);
GEODE_DLL void setContentHeight(float width);
GEODE_DLL float getContentWidth() const;
GEODE_DLL float getContentHeight() const;
template <class Filter, class... Args> template <class Filter, class... Args>
geode::EventListenerProtocol* addEventListener( geode::EventListenerProtocol* addEventListener(
std::string const& id, std::string const& id,

View file

@ -47,6 +47,25 @@ bool CCNode::hasAncestor(CCNode* ancestor) {
return false; return false;
} }
// these use setContentSize and getContentSize because they're virtuals and
// some node may override those for wacky behaviour
void CCNode::setContentWidth(float width) {
this->setContentSize({ width, m_obContentSize.height });
}
void CCNode::setContentHeight(float height) {
this->setContentSize({ m_obContentSize.width, height });
}
float CCNode::getContentWidth() const {
return this->getContentSize().width;
}
float CCNode::getContentHeight() const {
return this->getContentSize().height;
}
CCArray* Layout::getNodesToPosition(CCNode* on) const { CCArray* Layout::getNodesToPosition(CCNode* on) const {
auto arr = CCArray::create(); auto arr = CCArray::create();
for (auto child : CCArrayExt<CCNode*>(on->getChildren())) { for (auto child : CCArrayExt<CCNode*>(on->getChildren())) {