mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
add CCNode::setContentWidth
etc.
This commit is contained in:
parent
3802af1e70
commit
e06b9070d0
2 changed files with 24 additions and 0 deletions
|
@ -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,
|
||||||
|
|
|
@ -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())) {
|
||||||
|
|
Loading…
Reference in a new issue