@@ -65,10 +65,10 @@ bool GYSettingSelectLayer::init() {
6565 setKeypadEnabled (true );
6666
6767 auto winSize = CCDirector::sharedDirector ()->getWinSize ();
68- auto menu = CCMenu::create ();
68+ CCMenu* menu = CCMenu::create ();
6969 menu->setID (" menu" );
7070
71- auto background = CCSprite::create (" GJ_gradientBG.png" );
71+ CCSprite* background = CCSprite::create (" GJ_gradientBG.png" );
7272 background->setScaleX (CCDirector::sharedDirector ()->getWinSize ().width / background->getContentSize ().width );
7373 background->setScaleY (CCDirector::sharedDirector ()->getWinSize ().height / background->getContentSize ().height );
7474 background->setZOrder (-1 );
@@ -77,20 +77,20 @@ bool GYSettingSelectLayer::init() {
7777 background->setPosition ({ winSize.width / 2 , winSize.height / 2 });
7878 this ->addChild (background);
7979
80- auto cornerLeft = CCSprite::createWithSpriteFrameName (" GJ_sideArt_001.png" );
80+ CCSprite* cornerLeft = CCSprite::createWithSpriteFrameName (" GJ_sideArt_001.png" );
8181 cornerLeft->setPosition (CCPoint (winSize.width * 0 , winSize.height * 0 ));
8282 cornerLeft->setAnchorPoint (CCPoint (0 , 0 ));
8383 cornerLeft->setID (" corner-left" );
8484 this ->addChild (cornerLeft);
8585
86- auto cornerRight = CCSprite::createWithSpriteFrameName (" GJ_sideArt_001.png" );
86+ CCSprite* cornerRight = CCSprite::createWithSpriteFrameName (" GJ_sideArt_001.png" );
8787 cornerRight->setPosition (CCPoint (winSize.width * 1 , winSize.height * 0 ));
8888 cornerRight->setAnchorPoint (CCPoint (1 , 0 ));
8989 cornerRight->setFlipX (true );
9090 cornerRight->setID (" corner-right" );
9191 this ->addChild (cornerRight);
9292
93- auto backBtn = CCMenuItemSpriteExtra::create (
93+ CCMenuItemSpriteExtra* backBtn = CCMenuItemSpriteExtra::create (
9494 CCSprite::createWithSpriteFrameName (" GJ_arrow_01_001.png" ),
9595 this ,
9696 menu_selector (GYSettingSelectLayer::backWrapper)
@@ -99,12 +99,15 @@ bool GYSettingSelectLayer::init() {
9999 backBtn->setID (" back-btn" );
100100 menu->addChild (backBtn);
101101
102- auto title = CCLabelBMFont::create (" Geodify Settings" , " bigFont.fnt" );
102+ CCLabelBMFont* title = CCLabelBMFont::create (" Geodify Settings" , " bigFont.fnt" );
103103 title->setPosition (winSize.width / 2 , winSize.height * 0.9 );
104104 title->setID (" title" );
105105 this ->addChild (title);
106106
107- auto contentBox = CCScale9Sprite::create (" GJ_square01.png" );
107+
108+ // START OF CONTENT
109+
110+ CCScale9Sprite* contentBox = CCScale9Sprite::create (" GJ_square01.png" );
108111 contentBox->setContentSize ({ winSize.width * 0 .7f , winSize.height * 0 .7f });
109112 contentBox->setPosition ({ winSize.width / 2 , winSize.height / 2 - winSize.height * 0 .05f });
110113 contentBox->setAnchorPoint ({ 0 .5f , 0 .5f });
@@ -115,21 +118,92 @@ bool GYSettingSelectLayer::init() {
115118 scroll->setID (" scroll" );
116119 contentBox->addChild (scroll);
117120
118- scroll->m_contentLayer ->setLayout (ColumnLayout::create ()->setAxisReverse (true ));
121+ auto contentLeft = CCLayer::create ();
122+ contentLeft->setContentSize ({ winSize.width * 0 .3f , 0 .f });
123+ contentLeft->setID (" content-left" );
124+ contentLeft->setPosition ({ winSize.width * 0 .0125f , 0 });
125+ contentLeft->setAnchorPoint ({ 0 , 0 });
126+
127+ auto contentRight = CCLayer::create ();
128+ contentRight->setContentSize ({ winSize.width * 0 .3f , 0 .f });
129+ contentRight->setID (" content-right" );
130+ contentRight->setPosition ({ winSize.width * 0 .3625f , 0 });
131+ contentRight->setAnchorPoint ({ 0 , 0 });
132+
133+ auto leftColumn = ColumnLayout::create ();
134+ leftColumn->setAxis (Axis::Column);
135+ leftColumn->setGap (10 .f );
136+ leftColumn->setAxisReverse (false );
137+ leftColumn->setAutoGrowAxis (0 .f );
138+ contentLeft->setLayout (leftColumn);
139+
140+ auto rightColumn = ColumnLayout::create ();
141+ rightColumn->setAxis (Axis::Column);
142+ rightColumn->setGap (10 .f );
143+ rightColumn->setAxisReverse (false );
144+ rightColumn->setAutoGrowAxis (0 .f );
145+ contentRight->setLayout (rightColumn);
146+
147+ auto modTiles = { GYModTile::create (" Geometry Dash" , " RobTop" , " gd" , 0 ), GYModTile::create (" Garage Plus" , " OmgRod" , " omgrod.garage_plus" , 1 ) };
148+
149+ bool addToLeft = true ;
150+ for (auto & tile : modTiles) {
151+ if (addToLeft) {
152+ contentLeft->addChild (tile);
153+ } else {
154+ contentRight->addChild (tile);
155+ }
156+ addToLeft = !addToLeft;
157+ }
158+
159+ auto updateContentSize = [&](CCLayer* layer) {
160+ float totalHeight = 0 .f ;
161+
162+ auto children = layer->getChildren ();
163+ if (children) {
164+ for (unsigned int i = 0 ; i < children->count (); ++i) {
165+ auto node = typeinfo_cast<CCNode*>(children->objectAtIndex (i));
166+ if (node) {
167+ totalHeight += node->getContentSize ().height + 10 .f ;
168+ }
169+ }
170+ }
171+
172+ layer->setContentSize ({ layer->getContentSize ().width , totalHeight });
173+ };
119174
120- auto leftMenu = CCMenu::create ();
175+ updateContentSize (contentLeft);
176+ updateContentSize (contentRight);
177+
178+ scroll->m_contentLayer ->addChild (contentLeft);
179+ scroll->m_contentLayer ->addChild (contentRight);
180+
181+ contentLeft->updateLayout ();
182+ contentRight->updateLayout ();
183+
184+ scroll->m_contentLayer ->setContentSize ({
185+ contentLeft->getContentSize ().width + contentRight->getContentSize ().width + 20 .f ,
186+ std::max (contentLeft->getContentSize ().height , contentRight->getContentSize ().height )
187+ });
188+
189+ scroll->m_contentLayer ->setAnchorPoint ({ 0 , 0 });
190+
191+ // END OF CONTENT
192+
193+
194+ CCMenu* leftMenu = CCMenu::create ();
121195 leftMenu->setAnchorPoint ({ 0 , 0 });
122196 leftMenu->setContentSize ({ 0 .f , winSize.height * 0 .6f });
123197 leftMenu->setPosition ({ winSize.width * 0 .05f , winSize.height * 0 .15f });
124198 leftMenu->setID (" left-menu" );
125199
126- auto leftLayout = ColumnLayout::create ();
200+ ColumnLayout* leftLayout = ColumnLayout::create ();
127201 leftLayout->setAxis (Axis::Column);
128202 leftLayout->setGap (10 .f );
129203
130204 leftMenu->setLayout (leftLayout);
131205
132- auto colorBtn = CCMenuItemSpriteExtra::create (
206+ CCMenuItemSpriteExtra* colorBtn = CCMenuItemSpriteExtra::create (
133207 CCSprite::createWithSpriteFrameName (
134208 " GJ_paintBtn_001.png"
135209 ),
@@ -139,7 +213,7 @@ bool GYSettingSelectLayer::init() {
139213 colorBtn->setID (" color-button" );
140214 leftMenu->addChild (colorBtn);
141215
142- auto settingsBtn = CCMenuItemSpriteExtra::create (
216+ CCMenuItemSpriteExtra* settingsBtn = CCMenuItemSpriteExtra::create (
143217 CircleButtonSprite::create (
144218 CCSprite::createWithSpriteFrameName (" geode.loader/settings.png" ),
145219 CircleBaseColor::DarkPurple,
@@ -153,24 +227,6 @@ bool GYSettingSelectLayer::init() {
153227
154228 leftMenu->updateLayout ();
155229
156- scroll->m_contentLayer ->addChild (GYModTile::create ());
157- scroll->m_contentLayer ->addChild (GYModTile::create ());
158- scroll->m_contentLayer ->addChild (GYModTile::create ());
159- scroll->m_contentLayer ->addChild (GYModTile::create ());
160- scroll->m_contentLayer ->addChild (GYModTile::create ());
161- scroll->m_contentLayer ->addChild (GYModTile::create ());
162- scroll->m_contentLayer ->addChild (GYModTile::create ());
163- scroll->m_contentLayer ->addChild (GYModTile::create ());
164- scroll->m_contentLayer ->addChild (GYModTile::create ());
165- scroll->m_contentLayer ->addChild (GYModTile::create ());
166- scroll->m_contentLayer ->addChild (GYModTile::create ());
167- scroll->m_contentLayer ->addChild (GYModTile::create ());
168- scroll->m_contentLayer ->addChild (GYModTile::create ());
169- scroll->m_contentLayer ->addChild (GYModTile::create ());
170- scroll->m_contentLayer ->addChild (GYModTile::create ());
171- scroll->m_contentLayer ->addChild (GYModTile::create ());
172- scroll->m_contentLayer ->addChild (GYModTile::create ());
173-
174230 GYSettingSelectLayer::generateModsList ();
175231
176232 this ->addChild (leftMenu);
0 commit comments