Skip to content

Commit 420fa43

Browse files
committed
BoomScrollLayer, EditButtonBar, and ExtendedLayer
1 parent 910872c commit 420fa43

2 files changed

Lines changed: 92 additions & 34 deletions

File tree

bindings/2.2074/Cocos2d.bro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ class cocos2d::CCLayer : cocos2d::CCNode, cocos2d::CCTouchDelegate, cocos2d::CCA
24692469
static cocos2d::CCLayer* create() = imac 0x49d570, m1 0x408478, ios 0x14bd1c;
24702470

24712471
// CCLayer(cocos2d::CCLayer const&);
2472-
CCLayer() = imac 0x49cfb0, m1 0x408108, ios 0x14bb5c;
2472+
CCLayer() = imac 0x49cfb0, m1 0x40805c, ios 0x14bb5c;
24732473
virtual ~CCLayer() = imac 0x49d170, m1 0x4081b4, ios 0x14bc08;
24742474

24752475
cocos2d::CCScriptHandlerEntry* getScriptAccelerateHandlerEntry();

bindings/2.2074/GeometryDash.bro

Lines changed: 91 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,9 @@ class BoomScrollLayer : cocos2d::CCLayer {
10441044
CC_SAFE_RELEASE(m_dots);
10451045
}
10461046

1047-
static BoomScrollLayer* create(cocos2d::CCArray* pages, int unk1, bool unk2, cocos2d::CCArray* unk3, DynamicScrollDelegate* delegate) = win 0x3d060, imac 0x391a10, m1 0x3204b4, ios 0x12e27c;
1048-
static BoomScrollLayer* create(cocos2d::CCArray* pages, int unk1, bool unk2) = win inline, imac 0x391e00, m1 0x320880, ios 0x12e5b4 {
1049-
return BoomScrollLayer::create(pages, unk1, unk2, nullptr, nullptr);
1047+
static BoomScrollLayer* create(cocos2d::CCArray* pages, int offset, bool looped, cocos2d::CCArray* dynamicObjects, DynamicScrollDelegate* delegate) = win 0x3d060, imac 0x391a10, m1 0x3204b4, ios 0x12e27c;
1048+
static BoomScrollLayer* create(cocos2d::CCArray* pages, int offset, bool looped) = win inline, imac 0x391e00, m1 0x320880, ios 0x12e5b4 {
1049+
return BoomScrollLayer::create(pages, offset, looped, nullptr, nullptr);
10501050
}
10511051

10521052
virtual void visit() = win 0x3dbd0, imac 0x393220, m1 0x321ae4, ios 0x12f1dc;
@@ -1056,30 +1056,58 @@ class BoomScrollLayer : cocos2d::CCLayer {
10561056
virtual void ccTouchCancelled(cocos2d::CCTouch*, cocos2d::CCEvent*) = win 0x3e630, imac 0x393b90, m1 0x32241c, ios 0x12f780;
10571057
virtual void registerWithTouchDispatcher() = win 0x3e5a0, imac 0x393a00, m1 0x3222a4, ios 0x12f648;
10581058

1059-
void addPage(cocos2d::CCLayer*, int) = m1 0x3220e0, imac 0x393840;
1060-
void addPage(cocos2d::CCLayer*) = m1 0x322070, imac 0x3937c0;
1061-
void cancelAndStoleTouch(cocos2d::CCTouch*, cocos2d::CCEvent*) = imac 0x393ab0, m1 0x322340;
1062-
void claimTouch(cocos2d::CCTouch*);
1063-
cocos2d::CCLayer* getPage(int) = win inline, imac 0x392d00, m1 0x3216c0, ios 0x12ef14 {
1064-
auto index = m_page;
1065-
if (m_dynamic) index = index % m_pages->count();
1066-
return static_cast<cocos2d::CCLayer*>(m_pages->objectAtIndex(index));
1059+
void addPage(cocos2d::CCLayer* page, int index) = win inline, m1 0x3220e0, imac 0x393840, ios inline {
1060+
index = std::clamp<int>(index, 0, m_pages->count());
1061+
m_pages->insertObject(page, index);
1062+
this->updatePages();
1063+
this->moveToPage(m_page);
1064+
}
1065+
void addPage(cocos2d::CCLayer* page) = win inline, m1 0x322070, imac 0x3937c0, ios inline {
1066+
this->addPage(page, m_pages->count());
1067+
}
1068+
void cancelAndStoleTouch(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) = win inline, imac 0x393ab0, m1 0x322340, ios 0x12f6e4 {
1069+
auto touches = new cocos2d::CCSet();
1070+
touches->addObject(touch);
1071+
touches->autorelease();
1072+
m_ignoreTouchCancel = true;
1073+
cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->touchesCancelled(touches, event);
1074+
m_ignoreTouchCancel = false;
1075+
this->claimTouch(touch);
1076+
}
1077+
void claimTouch(cocos2d::CCTouch* touch) = win inline, m1 0x3222dc, imac 0x393a40, ios 0x12f680 {
1078+
auto handler = static_cast<cocos2d::CCTargetedTouchHandler*>(cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->findHandler(this));
1079+
if (!handler->getClaimedTouches()->containsObject(touch)) {
1080+
handler->getClaimedTouches()->addObject(touch);
1081+
}
1082+
}
1083+
cocos2d::CCLayer* getPage(int page) = win inline, imac 0x392d00, m1 0x3216c0, ios 0x12ef14 {
1084+
if (m_dynamic) {
1085+
auto pages = m_pages->count();
1086+
if (page > 0) page = page % pages;
1087+
else {
1088+
while (page < 0) page += pages;
1089+
}
1090+
}
1091+
return static_cast<cocos2d::CCLayer*>(m_pages->objectAtIndex(page));
10671092
}
1068-
int getRelativePageForNum(int page) = win inline, imac 0x393150, m1 0x321a10 {
1069-
return page < 1 ? page : page % getTotalPages();
1093+
int getRelativePageForNum(int page) = win inline, imac 0x393150, m1 0x321a10, ios 0x12f108 {
1094+
auto pages = this->getTotalPages();
1095+
if (page > 0) return page % pages;
1096+
while (page < 0) page += pages;
1097+
return page;
10701098
}
1071-
cocos2d::CCPoint getRelativePosForPage(int page) = win inline, imac 0x392cb0, m1 0x321670 {
1099+
cocos2d::CCPoint getRelativePosForPage(int page) = win inline, imac 0x392cb0, m1 0x321670, ios inline {
10721100
return { this->getContentSize().width - m_pageOffset * page, 0.f };
10731101
}
1074-
int getTotalPages() = win inline, m1 0x32136c, imac 0x392960, ios inline {
1102+
int getTotalPages() = win inline, m1 0x32136c, imac 0x392960, ios 0x12ecf4 {
10751103
return m_dynamic ? m_dynamicObjects->count() : m_pages->count();
10761104
}
1077-
bool init(cocos2d::CCArray*, int, bool, cocos2d::CCArray*, DynamicScrollDelegate*) = ios 0x12e320, win 0x3d230, imac 0x391aa0, m1 0x32056c;
1078-
void instantMoveToPage(int) = ios 0x12f2c0, win 0x3ddc0, m1 0x321ccc, imac 0x393410;
1079-
void moveToPage(int) = ios 0x12f398, win 0x3dea0, imac 0x3934f0, m1 0x321da4;
1105+
bool init(cocos2d::CCArray* pages, int offset, bool looped, cocos2d::CCArray* dynamicObjects, DynamicScrollDelegate* delegate) = ios 0x12e320, win 0x3d230, imac 0x391aa0, m1 0x32056c;
1106+
void instantMoveToPage(int page) = ios 0x12f2c0, win 0x3ddc0, m1 0x321ccc, imac 0x393410;
1107+
void moveToPage(int page) = ios 0x12f398, win 0x3dea0, imac 0x3934f0, m1 0x321da4;
10801108
void moveToPageEnded() = ios 0x12f234, win 0x3dc30, imac 0x393280, m1 0x321b3c;
1081-
int pageNumberForPosition(cocos2d::CCPoint) = win 0x3dcc0, imac 0x393070, m1 0x321924, ios 0x12f030;
1082-
cocos2d::CCPoint positionForPageWithNumber(int page) = win inline, imac 0x3933c0, m1 0x321c78 {
1109+
int pageNumberForPosition(cocos2d::CCPoint position) = win 0x3dcc0, imac 0x393070, m1 0x321924, ios 0x12f030;
1110+
cocos2d::CCPoint positionForPageWithNumber(int page) = win inline, imac 0x3933c0, m1 0x321c78, ios inline {
10831111
return { this->getContentSize().width + m_pageOffset * page, 0.f };
10841112
}
10851113
void quickUpdate() = ios 0x12f5f0, win inline, imac 0x393760, m1 0x322018 {
@@ -1090,11 +1118,27 @@ class BoomScrollLayer : cocos2d::CCLayer {
10901118
this->moveToPageEnded();
10911119
}
10921120
}
1093-
void removePage(cocos2d::CCLayer*) = imac 0x3938b0, m1 0x322148;
1094-
void removePageWithNumber(int) = imac 0x393940, m1 0x3221dc;
1121+
void removePage(cocos2d::CCLayer* page) = win inline, imac 0x3938b0, m1 0x322148, ios inline {
1122+
m_pages->removeObject(page);
1123+
this->removeChild(page, true);
1124+
m_slowPage = m_page;
1125+
m_page = std::min<int>(m_page, m_pages->count() - 1);
1126+
this->moveToPage(m_page);
1127+
}
1128+
void removePageWithNumber(int page) = win inline, imac 0x393940, m1 0x3221dc, ios inline {
1129+
if (page > -1 && page < m_pages->count()) {
1130+
this->removePage(static_cast<cocos2d::CCLayer*>(m_pages->objectAtIndex(page)));
1131+
}
1132+
}
10951133
void repositionPagesLooped() = ios 0x12e79c, win 0x3e060, imac 0x392090, m1 0x320b14;
1096-
void selectPage(int);
1097-
void setDotScale(float scale) = win inline, m1 0x321608, imac 0x392c40 {
1134+
void selectPage(int page) = win inline, m1 0x321f60, imac 0x3936b0, ios 0x12f538 {
1135+
if (page > -1 && page < this->getTotalPages()) {
1136+
m_extendedLayer->setPosition(this->positionForPageWithNumber(page));
1137+
m_slowPage = m_page;
1138+
m_page = page;
1139+
}
1140+
}
1141+
void setDotScale(float scale) = win inline, m1 0x321608, imac 0x392c40, ios 0x12eeac {
10981142
for (int i = 0; i < m_dots->count(); i++) {
10991143
static_cast<cocos2d::CCSprite*>(m_dots->objectAtIndex(i))->setScale(scale);
11001144
}
@@ -1103,9 +1147,9 @@ class BoomScrollLayer : cocos2d::CCLayer {
11031147
m_dotPosition = pos;
11041148
this->updateDots(0.f);
11051149
}
1106-
void setupDynamicScrolling(cocos2d::CCArray*, DynamicScrollDelegate*) = ios 0x12eaac, win 0x3d5a0, imac 0x392710, m1 0x321124;
1107-
void togglePageIndicators(bool) = ios 0x12f170, win 0x3db60, imac 0x3931b0, m1 0x321a78;
1108-
void updateDots(float) = ios 0x12ed10, win 0x3d960, imac 0x392990, m1 0x321388;
1150+
void setupDynamicScrolling(cocos2d::CCArray* dynamicObjects, DynamicScrollDelegate* delegate) = ios 0x12eaac, win 0x3d5a0, imac 0x392710, m1 0x321124;
1151+
void togglePageIndicators(bool visible) = ios 0x12f170, win 0x3db60, imac 0x3931b0, m1 0x321a78;
1152+
void updateDots(float dt) = ios 0x12ed10, win 0x3d960, imac 0x392990, m1 0x321388;
11091153
void updatePages() = ios 0x12e684, win 0x3d840, m1 0x3209f4, imac 0x391f70;
11101154

11111155
cocos2d::CCArray* m_dots;
@@ -4963,12 +5007,26 @@ class DynamicScrollDelegate {
49635007
class EditButtonBar : cocos2d::CCNode {
49645008
// virtual ~EditButtonBar();
49655009

4966-
static EditButtonBar* create(cocos2d::CCArray* objects, cocos2d::CCPoint size, int tab, bool hasCreateItems, int columns, int rows) = ios 0x418b98, win 0xd2f40, imac 0x5c99e0, m1 0x4fe2c0;
5010+
static EditButtonBar* create(cocos2d::CCArray* objects, cocos2d::CCPoint position, int tab, bool hasCreateItems, int columns, int rows) = ios 0x418b98, win 0xd2f40, imac 0x5c99e0, m1 0x4fe2c0;
49675011

4968-
int getPage();
4969-
void goToPage(int);
4970-
bool init(cocos2d::CCArray* objects, cocos2d::CCPoint position, int tab, bool hasCreateItems, int columns, int rows) = imac 0x5c9ad0, m1 0x4fe3bc;
4971-
void loadFromItems(cocos2d::CCArray*, int, int, bool) = ios 0x418d0c, win 0xd30a0, imac 0x5c9b80, m1 0x4fe468;
5012+
int getPage() = win inline, m1 0x4feb24, imac 0x5ca2f0, ios 0x419350 {
5013+
return m_scrollLayer->getRelativePageForNum(m_scrollLayer->m_page);
5014+
}
5015+
void goToPage(int page) = win 0xd39c0, m1 0x4feb30, imac 0x5ca310, ios 0x41935c;
5016+
bool init(cocos2d::CCArray* objects, cocos2d::CCPoint position, int tab, bool hasCreateItems, int columns, int rows) = win inline, imac 0x5c9ad0, m1 0x4fe3bc, ios 0x418c60 {
5017+
if (!cocos2d::CCNode::init()) return false;
5018+
m_buttonArray = cocos2d::CCArray::create();
5019+
m_buttonArray->retain();
5020+
m_buttonArray->addObjectsFromArray(objects);
5021+
m_pagesArray = cocos2d::CCArray::create();
5022+
m_pagesArray->retain();
5023+
m_position = position;
5024+
m_tabIndex = tab;
5025+
m_hasCreateItems = hasCreateItems;
5026+
this->loadFromItems(m_buttonArray, rows, columns, false);
5027+
return true;
5028+
}
5029+
void loadFromItems(cocos2d::CCArray* objects, int rows, int columns, bool keepPage) = ios 0x418d0c, win 0xd30a0, imac 0x5c9b80, m1 0x4fe468;
49725030
void onLeft(cocos2d::CCObject* sender) = ios 0x419330, win 0xd3a90, m1 0x4fea94, imac 0x5ca250;
49735031
void onRight(cocos2d::CCObject* sender) = ios 0x419340, win 0xd3a20, m1 0x4feadc, imac 0x5ca2a0;
49745032
void reloadItems(int rowCount, int columnCount) = ios 0x419234, win inline, imac 0x5ca140, m1 0x4fe998 {
@@ -6761,7 +6819,7 @@ class ExtendedLayer : cocos2d::CCLayer {
67616819
m_delegate = nullptr;
67626820
}
67636821

6764-
static ExtendedLayer* create() = win inline {
6822+
static ExtendedLayer* create() = win inline, m1 0x320924, imac 0x391e80, ios 0x12e5c0 {
67656823
auto ret = new ExtendedLayer();
67666824
if (ret->init()) {
67676825
ret->autorelease();

0 commit comments

Comments
 (0)