@@ -178,19 +178,26 @@ bool OptionMenu::init() {
178178
179179 m_mainLayer->addChild (filtersLabel);
180180
181+ auto filterMenuLayout = ColumnLayout::create ()
182+ ->setGap (2 .5f )
183+ ->setAxisReverse (true ) // Top to bottom
184+ ->setAxisAlignment (AxisAlignment::End)
185+ ->setAutoGrowAxis (0 .f );
186+
181187 // filter buttons :o
182188 auto filterMenu = CCMenu::create ();
183189 filterMenu->setID (" filter-menu" );
184190 filterMenu->setAnchorPoint ({ 0.5 , 1 });
185- filterMenu->setPosition ({ filterMenuBg->getPositionX (), mainLayerSize.height - 65 .f });
186-
187- constexpr SillyFilter filterBtns[] = {
188- { SillyTier::Low, " Low" , colors::green },
189- { SillyTier::Medium, " Medium" , colors::yellow },
190- { SillyTier::High, " High" , colors::red },
191+ filterMenu->setPosition ({ filterMenuBg->getPositionX (), mainLayerSize.height - 55 .f });
192+ filterMenu->setContentHeight (0 .f );
193+ filterMenu->setLayout (filterMenuLayout);
194+
195+ constexpr SillyFilterBtnData filterBtns[] = {
196+ { SillyTier::Low, " Low" , " filter-low-btn" , colors::green },
197+ { SillyTier::Medium, " Medium" , " filter-medium-btn" , colors::yellow },
198+ { SillyTier::High, " High" , " filter-high-btn" , colors::red },
191199 };
192200
193- auto fBtnY = 0 .f ;
194201 for (auto const & filterBtn : filterBtns) {
195202 if (auto btnSprite = ButtonSprite::create (filterBtn.label , 150 , true , " bigFont.fnt" , " GJ_button_01.png" , 0 .f , 0 .8f )) {
196203 btnSprite->m_label ->setColor (filterBtn.color );
@@ -205,11 +212,9 @@ bool OptionMenu::init() {
205212 m_impl->filterOptions (options::getAll (), m_impl->selectedTier , m_impl->selectedCategory );
206213 }
207214 )) {
208- btn->setPosition ({ 0 . f , fBtnY } );
215+ btn->setID (filterBtn. id );
209216
210217 filterMenu->addChild (btn);
211-
212- fBtnY -= 35 .f ;
213218 } else {
214219 log::error (" Failed to create filter button" );
215220 };
@@ -218,11 +223,13 @@ bool OptionMenu::init() {
218223 };
219224 };
220225
221- // get the options data
222- m_impl->filterOptions (options::getAll ());
226+ filterMenu->updateLayout ();
223227
224228 m_mainLayer->addChild (filterMenu);
225229
230+ // get the options data
231+ m_impl->filterOptions (options::getAll ());
232+
226233 // add a mod settings at the bottom left
227234 // @geode-ignore(unknown-resource)
228235 auto settingsBtnSprite = CircleButtonSprite::createWithSpriteFrameName (" geode.loader/settings.png" );
@@ -262,62 +269,80 @@ bool OptionMenu::init() {
262269
263270 m_buttonMenu->addChild (resetFiltersBtn);
264271
265- auto seriesBtnSprite = CCSprite::createWithSpriteFrameName (" gj_ytIcon_001.png" );
266- seriesBtnSprite->setScale (0 .75f );
267-
268- auto seriesBtn = CCMenuItemExt::createSpriteExtra (
269- seriesBtnSprite,
270- [](auto ) {
271- createQuickPopup (
272- " Horrible Mods" ,
273- " Watch the series '<cr>Horrible Mods</c>' on <cl>Avalanche</c>'s YouTube channel?" ,
274- " Cancel" , " OK" ,
275- [](bool , bool ok) {
276- if (ok) web::openLinkInBrowser (" https://www.youtube.com/watch?v=Ssl49pNmW_0&list=PL0dsSu2pR5cERnq7gojZTKVRvUwWo2Ohu" );
277- }
278- );
272+ auto socialMenuLayout = RowLayout::create ()
273+ ->setGap (1 .25f )
274+ ->setAxisReverse (true )
275+ ->setAxisAlignment (AxisAlignment::End)
276+ ->setAutoGrowAxis (0 .f );
277+
278+ auto socialMenu = CCMenu::create ();
279+ socialMenu->setID (" social-menu" );
280+ socialMenu->setAnchorPoint ({ 1 , 0.5 });
281+ socialMenu->setPosition ({ mainLayerSize.width - 7 .5f , mainLayerSize.height - 20 .f });
282+ socialMenu->setContentWidth (0 .f );
283+ socialMenu->setLayout (socialMenuLayout);
284+
285+ constexpr SocialBtnData socialBtns[] = {
286+ {
287+ " gj_ytIcon_001.png" ,
288+ " horrible-mods-series-btn" ,
289+ [](auto ) {
290+ createQuickPopup (
291+ " Horrible Mods" ,
292+ " Watch the series '<cr>Horrible Mods</c>' on <cl>Avalanche</c>'s YouTube channel?" ,
293+ " Cancel" , " OK" ,
294+ [](bool , bool ok) {
295+ if (ok) web::openLinkInBrowser (" https://www.youtube.com/watch?v=Ssl49pNmW_0&list=PL0dsSu2pR5cERnq7gojZTKVRvUwWo2Ohu" );
296+ }
297+ );
298+ }
299+ },
300+ {
301+ " gj_discordIcon_001.png" ,
302+ " discord-btn" ,
303+ [](auto ) {
304+ createQuickPopup (
305+ " Discord" ,
306+ " Join the <cj>Cubic Studios</c> Discord community server?" ,
307+ " Cancel" , " OK" ,
308+ [](bool , bool ok) {
309+ if (ok) web::openLinkInBrowser (" https://www.dsc.gg/cubic" );
310+ }
311+ );
312+ }
313+ },
314+ {
315+ // @geode-ignore(unknown-resource)
316+ " geode.loader/gift.png" ,
317+ " support-btn" ,
318+ [](auto ) {
319+ openSupportPopup (horribleMod);
320+ }
279321 }
280- );
281- seriesBtn->setID (" horrible-mods-series-btn" );
282- seriesBtn->setPosition (mainLayerSize - 20 .f );
283-
284- m_buttonMenu->addChild (seriesBtn);
285-
286- auto discordBtnSprite = CCSprite::createWithSpriteFrameName (" gj_discordIcon_001.png" );
287- discordBtnSprite->setScale (0 .75f );
322+ };
288323
289- auto discordBtn = CCMenuItemExt::createSpriteExtra (
290- discordBtnSprite,
291- [](auto ) {
292- createQuickPopup (
293- " Discord" ,
294- " Join the <cj>Cubic Studios</c> official Discord community server?" ,
295- " Cancel" , " OK" ,
296- [](bool , bool ok) {
297- if (ok) web::openLinkInBrowser (" https://www.dsc.gg/cubic" );
298- }
299- );
300- }
301- );
302- discordBtn->setID (" discord-btn" );
303- discordBtn->setPosition ({ mainLayerSize.width - 45 .f , mainLayerSize.height - 20 .f });
324+ for (auto const & socialBtn : socialBtns) {
325+ if (auto sprite = CCSprite::createWithSpriteFrameName (socialBtn.sprite )) {
326+ sprite->setScale (0 .75f );
304327
305- m_buttonMenu->addChild (discordBtn);
328+ if (auto btn = CCMenuItemExt::createSpriteExtra (
329+ sprite,
330+ socialBtn.callback
331+ )) {
332+ btn->setID (socialBtn.id );
306333
307- // @geode-ignore(unknown-resource)
308- auto supporterBtnSprite = CCSprite::createWithSpriteFrameName (" geode.loader/gift.png" );
309- supporterBtnSprite->setScale (0 .75f );
334+ socialMenu->addChild (btn);
335+ } else {
336+ log::error (" Failed to create social button" );
337+ };
338+ } else {
339+ log::error (" Failed to create social button sprite" );
340+ };
341+ };
310342
311- auto supporterBtn = CCMenuItemExt::createSpriteExtra (
312- supporterBtnSprite,
313- [](auto ) {
314- openSupportPopup (horribleMod);
315- }
316- );
317- supporterBtn->setID (" support-btn" );
318- supporterBtn->setPosition ({ mainLayerSize.width - 70 .f , mainLayerSize.height - 20 .f });
343+ socialMenu->updateLayout ();
319344
320- m_buttonMenu ->addChild (supporterBtn );
345+ m_mainLayer ->addChild (socialMenu );
321346
322347 auto safeModeLabel = CCLabelBMFont::create (" Safe Mode OFF" , " bigFont.fnt" );
323348 safeModeLabel->setID (" safe-mode-label" );
0 commit comments