55#include < Geode/ui/GeodeUI.hpp>
66
77#define REST_OF_THE_OWL this ->m_songControlsMenu, this
8- #define REST_OF_THE_CAT this ->m_theTimeoutCorner, this
9- #define REST_OF_THE_DOG this ->m_buttonMenu, this
108
119bool SongControlMenu::setup (const std::string&) {
1210 this ->setTitle (" Menu Loop Randomizer - Control Panel" );
@@ -44,23 +42,24 @@ bool SongControlMenu::setup(const std::string&) {
4442 this ->m_songControlsMenu ->setContentSize ({idealWidth, 32 .f });
4543 this ->m_songControlsMenu ->setLayout (layout);
4644
47- this ->m_buttonMenu ->setTag (7212025 );
4845 this ->m_theTimeoutCorner = cocos2d::CCMenu::create ();
46+ Utils::addButton (" controls" , menu_selector (SongControlMenu::onSettingsButton), this ->m_theTimeoutCorner , this );
47+ geode::AxisLayout* layoutTimeout = geode::ColumnLayout::create ()->setGap (0 .f )->setDefaultScaleLimits (.0001f , 1 .0f )->setAutoScale (true );
4948
50- Utils::addButton (" playlist" , menu_selector (SongControlMenu::onPlaylistButton), REST_OF_THE_CAT);
51- Utils::addButton (" controls" , menu_selector (SongControlMenu::onSettingsButton), REST_OF_THE_DOG);
49+ this ->m_openSongListMenu = cocos2d::CCMenu::create ();
50+ Utils::addButton (" playlist" , menu_selector (SongControlMenu::onPlaylistButton), this ->m_openSongListMenu , this );
51+ geode::AxisLayout* layoutSongList = geode::RowLayout::create ()->setGap (0 .f )->setDefaultScaleLimits (.0001f , 1 .0f )->setAutoScale (true );
5252
53- geode::AxisLayout* layoutTimeout = geode::ColumnLayout::create ()->setGap (0 .f )->setDefaultScaleLimits (.0001f , .65f )->setAutoScale (true );
54-
55- if (CCNode* controlsButton = this ->m_buttonMenu ->getChildByID (" controls-button" _spr)) {
56- controlsButton->setPosition ({m_mainLayer->getContentSize () - 3 .f });
57- }
58-
59- this ->m_theTimeoutCorner ->setPosition ({280 .f , this ->m_title ->getPositionY () - 8 .5f });
53+ this ->m_theTimeoutCorner ->setPosition ({280 .f , this ->m_title ->getPositionY () - 2 .5f });
6054 this ->m_theTimeoutCorner ->ignoreAnchorPointForPosition (false );
61- this ->m_theTimeoutCorner ->setContentSize ({24 .f , 36 .f });
55+ this ->m_theTimeoutCorner ->setContentSize ({24 .f , 24 .f });
6256 this ->m_theTimeoutCorner ->setLayout (layoutTimeout);
6357
58+ this ->m_openSongListMenu ->setPosition ({280 .f , this ->m_title ->getPositionY () - 51 .5f });
59+ this ->m_openSongListMenu ->ignoreAnchorPointForPosition (false );
60+ this ->m_openSongListMenu ->setContentSize ({27 .f , 27 .f });
61+ this ->m_openSongListMenu ->setLayout (layoutSongList);
62+
6463 this ->m_otherLabel = cocos2d::CCLabelBMFont::create (" Hi! Menu Loop Randomizer will never resemble Spotify or its distant cousin EditorMusic. Please respect that. :)" , " chatFont.fnt" );
6564 this ->m_otherLabel ->setBlendFunc ({GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA});
6665 this ->m_otherLabel ->limitLabelWidth (idealWidth * .95f , 1 .0f , .0001f );
@@ -70,21 +69,22 @@ bool SongControlMenu::setup(const std::string&) {
7069 this ->m_headerLabl ->setBlendFunc ({GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA});
7170 this ->m_headerLabl ->setPosition ({centerStage, 107 .5f });
7271
73- SongControlMenu::updateCurrentLabel ();
74-
7572 this ->b = cocos2d::extension::CCScale9Sprite::create (" square02b_001.png" );
7673 this ->b ->ignoreAnchorPointForPosition (false );
77- this ->b ->setPosition ({centerStage, 80 .f });
78- this ->b ->setContentSize ({275 .f , 30 .f });
74+ this ->b ->setContentSize ({250 .f , 30 .f });
75+ this ->b ->setAnchorPoint ({0 .f , .5f });
76+ this ->b ->setPosition ({12 .5f , 80 .f });
7977 this ->b ->setColor ({0 , 0 , 0 });
8078 this ->b ->setOpacity (128 );
8179
80+ SongControlMenu::updateCurrentLabel ();
81+
8282 this ->setID (" SongControlMenu" _spr);
8383 mainLayer->addChild (this ->b );
8484 mainLayer->addChild (this ->m_otherLabel );
85- mainLayer->addChild (this ->m_smallLabel );
8685 mainLayer->addChild (this ->m_headerLabl );
8786 mainLayer->addChild (this ->m_songControlsMenu );
87+ mainLayer->addChild (this ->m_openSongListMenu );
8888 mainLayer->addChild (this ->m_theTimeoutCorner );
8989
9090 this ->b ->setID (" trans-bg" _spr);
@@ -95,6 +95,7 @@ bool SongControlMenu::setup(const std::string&) {
9595 this ->m_smallLabel ->setID (" current-song-label" _spr);
9696 this ->m_headerLabl ->setID (" current-song-header" _spr);
9797 this ->m_theTimeoutCorner ->setID (" timeout-corner" _spr);
98+ this ->m_openSongListMenu ->setID (" song-list-menu" _spr);
9899 this ->m_songControlsMenu ->setID (" song-controls-menu" _spr);
99100
100101 return true ;
@@ -157,13 +158,12 @@ void SongControlMenu::onSettingsButton(CCObject*) {
157158void SongControlMenu::updateCurrentLabel () {
158159 SongManager& songManager = SongManager::get ();
159160 const std::string& currentSong = songManager.getCurrentSongDisplayName ();
160- const cocos2d::CCSize layerSize = this ->m_mainLayer ->getContentSize ();
161- if (!this ->m_smallLabel || !this ->m_smallLabel ->getParent () || this ->m_smallLabel ->getParent () != this ->m_mainLayer ) {
161+ if (!this ->m_smallLabel || !this ->m_smallLabel ->getParent () || this ->m_smallLabel ->getParent () != this ->b ) {
162162 this ->m_smallLabel = cocos2d::CCLabelBMFont::create (currentSong.c_str (), " chatFont.fnt" );
163+ this ->b ->addChildAtPosition (this ->m_smallLabel , geode::Anchor::Center);
163164 } else this ->m_smallLabel ->setString (currentSong.c_str (), " chatFont.fnt" );
165+ this ->m_smallLabel ->limitLabelWidth (this ->b ->getContentWidth () - 20 .f , 1 .0f , .0001f );
164166 this ->m_smallLabel ->setBlendFunc ({GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA});
165- this ->m_smallLabel ->limitLabelWidth (layerSize.width * 0 .95f * .9f , 1 .0f , .0001f );
166- this ->m_smallLabel ->setPosition ({layerSize.width / 2 .f , 80 .f });
167167 if (!this ->m_headerLabl ) return ;
168168 if (songManager.isOverride ()) this ->m_headerLabl ->setString (" Current Song (Custom Override):" );
169169 else if (songManager.getConstantShuffleMode ()) this ->m_headerLabl ->setString (" Current Song (Constant Shuffle Mode):" );
0 commit comments