11#include " ../Menu.h"
22
3- #include " ../MenuCredits.h"
4-
53#include " ../MenuOption.hpp"
4+ #include " ../MenuCredits.hpp"
65#include " ../MenuFilterCells.hpp"
76
87#include < Utils.h>
@@ -117,6 +116,16 @@ class Menu::Impl final {
117116 log::error (" Option list layer not found" );
118117 };
119118 };
119+
120+ CCLabelBMFont* createFilterLabel (ZStringView text, std::string id, CCPoint const & pos) {
121+ auto label = CCLabelBMFont::create (text.c_str (), " bigFont.fnt" );
122+ label->setID (std::move (id));
123+ label->setScale (0 .375f );
124+ label->setAnchorPoint ({0.5 , 0.5 });
125+ label->setPosition (pos);
126+
127+ return label;
128+ };
120129};
121130
122131Menu::Menu () : m_impl(std::make_unique<Impl>()) {};
@@ -147,8 +156,8 @@ void Menu::setupSafeModeNode(bool safeMode) {
147156void Menu::setupImageBackground (fs::path const & path) {
148157 cue::resetNode (m_impl->themeBackground );
149158
150- if (m_impl-> themeBgContainer ) {
151- if (fs::exists (path) ) {
159+ if (fs::exists (path) ) {
160+ if (m_impl-> themeBgContainer ) {
152161 m_impl->themeBackground = LazySprite::create (m_bgSprite->getScaledContentSize (), false );
153162 m_impl->themeBackground ->setID (" theme-bg" );
154163 m_impl->themeBackground ->setPosition (m_bgSprite->getScaledContentSize () / 2 .f );
@@ -157,9 +166,7 @@ void Menu::setupImageBackground(fs::path const& path) {
157166 if (auto s = self.lock ()) {
158167 if (auto bg = themeBg.lock ()) {
159168 if (res.isOk ()) {
160- bg->setScaleX (s->m_bgSprite ->getScaledContentWidth () / bg->getScaledContentWidth ());
161- bg->setScaleY (s->m_bgSprite ->getScaledContentHeight () / bg->getScaledContentHeight ());
162-
169+ cue::rescaleToMatch (bg, s->m_bgSprite , true );
163170 bg.take ()->setOpacity (100 );
164171
165172 log::debug (" Successfully loaded theme background" );
@@ -217,11 +224,11 @@ bool Menu::init() {
217224 m_mainLayer->addChild (border, -1 );
218225
219226 // scroll layer
220- m_impl->categoryList = ScrollLayer::create ({(mainLayerSize.width / 3 .f ) - 20 .f , 125 .f });
227+ m_impl->categoryList = ScrollLayer::create ({(mainLayerSize.width / 3 .f ) - 20 .f , 100 .f });
221228 m_impl->categoryList ->setID (" category-list" );
222229 m_impl->categoryList ->setAnchorPoint ({0.5 , 0.5 });
223230 m_impl->categoryList ->ignoreAnchorPointForPosition (false );
224- m_impl->categoryList ->setPosition ({mainLayerSize.width - 82 .5f , (mainLayerSize.height - 57 . 5f ) - (m_impl->categoryList ->getScaledContentHeight () / 2 .f )});
231+ m_impl->categoryList ->setPosition ({mainLayerSize.width - 82 .5f , (mainLayerSize.height - 70 . f ) - (m_impl->categoryList ->getScaledContentHeight () / 2 .f )});
225232
226233 m_impl->categoryList ->m_contentLayer ->setLayout (ScrollLayer::createDefaultListLayout ());
227234
@@ -240,7 +247,7 @@ bool Menu::init() {
240247 auto miscCat = *misc;
241248
242249 sortedCats.erase (misc);
243- sortedCats.push_back (miscCat);
250+ sortedCats.push_back (std::move ( miscCat) );
244251 };
245252
246253 for (auto const & category : sortedCats) {
@@ -282,6 +289,8 @@ bool Menu::init() {
282289
283290 m_mainLayer->addChild (categoryListBg);
284291
292+ m_mainLayer->addChild (m_impl->createFilterLabel (" Categories" , " category-list-label" , {m_impl->categoryList ->getPositionX (), mainLayerSize.height - 57 .5f }), 1 );
293+
285294 m_impl->optionList = ScrollLayer::create ({(mainLayerSize.width / 1 .5f ) - 43 .75f , mainLayerSize.height - 93 .25f });
286295 m_impl->optionList ->setID (" options-list" );
287296 m_impl->optionList ->setAnchorPoint ({0.5 , 0.5 });
@@ -338,20 +347,21 @@ bool Menu::init() {
338347
339348 auto filterContainerLabel = CCLabelBMFont::create (" Filters" , " goldFont.fnt" );
340349 filterContainerLabel->setID (" filter-container-label" );
350+ filterContainerLabel->setScale (0 .375f );
341351 filterContainerLabel->setAnchorPoint ({0.5 , 0 });
342352 filterContainerLabel->setAlignment (kCCTextAlignmentCenter );
343353 filterContainerLabel->setPosition ({filterContainerBg->getPositionX (), mainLayerSize.height - 50 .f });
344- filterContainerLabel->setScale (0 .375f );
345354
346355 m_mainLayer->addChild (filterContainerLabel);
347356
348- // TODO: fix the nodes on this !!!
349357 auto sillyDropdown = cue::DropdownNode::create (
350- to4B (categoryListBg->getColor (), categoryListBg->getOpacity ()),
351- categoryListBg->getScaledContentWidth (),
352- 15 .f );
358+ to4B (colors::black, 0 ),
359+ m_impl->categoryList ->getScaledContentWidth (),
360+ 17 .5f ,
361+ 40 .f );
353362 sillyDropdown->setID (" silly-filter-dropdown" );
354- sillyDropdown->setPosition ({filterContainerLabel->getPositionX (), 75 .f });
363+ sillyDropdown->setAnchorPoint ({0.5 , 1 });
364+ sillyDropdown->setPosition ({filterContainerLabel->getPositionX (), 87 .5f });
355365
356366 sillyDropdown->setCallback ([this ](auto , CCNode* node) {
357367 if (auto cell = typeinfo_cast<MenuSillyFilterCell*>(node)) {
@@ -368,14 +378,30 @@ bool Menu::init() {
368378 };
369379
370380 for (auto const & filterBtn : filterBtns) {
371- if (auto cell = MenuSillyFilterCell::create ({sillyDropdown->getScaledContentWidth () * 0 .75f , 15 .f }, filterBtn.tier , filterBtn.id , filterBtn.label , filterBtn.color )) {
381+ if (auto cell = MenuSillyFilterCell::create (
382+ {sillyDropdown->getScaledContentWidth (), 16 .5f },
383+ filterBtn.tier ,
384+ filterBtn.id ,
385+ filterBtn.label ,
386+ filterBtn.color )) {
372387 sillyDropdown->addCell (cell);
373388 } else {
374389 log::error (" Failed to create filter button" );
375390 };
376391 };
377392
378- m_mainLayer->addChild (sillyDropdown);
393+ m_mainLayer->addChild (sillyDropdown, 9 );
394+
395+ m_mainLayer->addChild (m_impl->createFilterLabel (" Silly Tier" , " silly-filter-label" , {m_impl->categoryList ->getPositionX (), sillyDropdown->getPositionY () + 7 .5f }), 1 );
396+
397+ auto filterHint = CCLabelBMFont::create (" Use different filters to search for options quicker. Press the pin icon on an option cell to pin it to the top." , " chatFont.fnt" , m_impl->categoryList ->getScaledContentWidth ());
398+ filterHint->setID (" filter-hint" );
399+ filterHint->setScale (0 .5f );
400+ filterHint->setAnchorPoint ({0.5 , 0.5 });
401+ filterHint->setAlignment (kCCTextAlignmentCenter );
402+ filterHint->setPosition ({filterContainerBg->getPositionX (), 47 .5f });
403+
404+ m_mainLayer->addChild (filterHint, 1 );
379405
380406 // get all the options data
381407 m_impl->filterOptions (options::getAll ());
0 commit comments