Skip to content

Commit f36bd23

Browse files
committed
.
1 parent 3d073b0 commit f36bd23

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/ui/SongListLayer.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,22 @@ bool SongListLayer::setup(const std::string&) {
108108
scrollLayer->ignoreAnchorPointForPosition(false);
109109
this->m_mainLayer->addChildAtPosition(scrollLayer, geode::Anchor::Center);
110110

111+
constexpr float labelWidth = 280.f * .45f;
112+
111113
const std::string& playlistFileName = songManager.getPlaylistIsEmpty() ? "None" : songManager.getPlaylistFileName();
112114
cocos2d::CCLabelBMFont* currentPlaylistLabel = cocos2d::CCLabelBMFont::create(fmt::format("Playlist: {}", playlistFileName).c_str(), "bigFont.fnt");
113-
currentPlaylistLabel->limitLabelWidth(279.f * .45f, 1.f, .0001f);
114-
currentPlaylistLabel->setZOrder(this->m_title->getZOrder());
115+
currentPlaylistLabel->limitLabelWidth(labelWidth, 1.f, .0001f);
115116

116117
const std::string& loadPlaylistFileInstead = Utils::getBool("loadPlaylistFile") ? "ON" : "OFF";
117118
cocos2d::CCLabelBMFont* loadPlaylistFileLabel = cocos2d::CCLabelBMFont::create(fmt::format("Load Playlist File: {}", loadPlaylistFileInstead).c_str(), "bigFont.fnt");
118-
loadPlaylistFileLabel->limitLabelWidth(279.f * .45f, 1.f, .0001f);
119-
loadPlaylistFileLabel->setZOrder(this->m_title->getZOrder());
119+
loadPlaylistFileLabel->limitLabelWidth(labelWidth, 1.f, .0001f);
120120

121121
const std::string& isConstantShuffleMode = songManager.getConstantShuffleMode() ? "ON" : "OFF";
122122
cocos2d::CCLabelBMFont* constantShuffleModeLabel = cocos2d::CCLabelBMFont::create(fmt::format("Constant Shuffle Mode: {}", isConstantShuffleMode).c_str(), "bigFont.fnt");
123-
constantShuffleModeLabel->limitLabelWidth(279.f * .45f, 1.f, .0001f);
124-
constantShuffleModeLabel->setZOrder(this->m_title->getZOrder());
123+
constantShuffleModeLabel->limitLabelWidth(labelWidth, 1.f, .0001f);
125124

126125
cocos2d::CCLabelBMFont* platformLabel = cocos2d::CCLabelBMFont::create(fmt::format("Platform: {}", Utils::getPlatform()).c_str(), "bigFont.fnt");
127-
platformLabel->limitLabelWidth(279.f * .45f, 1.f, .0001f);
128-
platformLabel->setZOrder(this->m_title->getZOrder());
126+
platformLabel->limitLabelWidth(labelWidth, 1.f, .0001f);
129127

130128
currentPlaylistLabel->setID("current-playlist-label"_spr);
131129
loadPlaylistFileLabel->setID("load-playlist-file-label"_spr);
@@ -137,10 +135,16 @@ bool SongListLayer::setup(const std::string&) {
137135
constantShuffleModeLabel->ignoreAnchorPointForPosition(false);
138136
platformLabel->ignoreAnchorPointForPosition(false);
139137

140-
this->m_mainLayer->addChildAtPosition(currentPlaylistLabel, geode::Anchor::BottomLeft, {100.5f, 15.f});
141-
this->m_mainLayer->addChildAtPosition(loadPlaylistFileLabel, geode::Anchor::BottomLeft, {100.5f, 26.f});
142-
this->m_mainLayer->addChildAtPosition(constantShuffleModeLabel, geode::Anchor::BottomLeft, {320.5f, 15.f});
143-
this->m_mainLayer->addChildAtPosition(platformLabel, geode::Anchor::BottomLeft, {320.5f, 26.f});
138+
const float sllWidth = scrollLayer->getContentWidth();
139+
constexpr float offset = 25.f;
140+
constexpr float topRowYPos = 28.5f;
141+
constexpr float bottomRowYPos = 17.5f;
142+
constexpr float arbitraryPaddingValue = 10.f;
143+
144+
this->m_mainLayer->addChildAtPosition(currentPlaylistLabel, geode::Anchor::BottomLeft, {(layerSize.width - sllWidth) + arbitraryPaddingValue + offset, bottomRowYPos});
145+
this->m_mainLayer->addChildAtPosition(loadPlaylistFileLabel, geode::Anchor::BottomLeft, {(layerSize.width - sllWidth) + arbitraryPaddingValue + offset, topRowYPos});
146+
this->m_mainLayer->addChildAtPosition(constantShuffleModeLabel, geode::Anchor::BottomLeft, {sllWidth - offset - arbitraryPaddingValue, bottomRowYPos});
147+
this->m_mainLayer->addChildAtPosition(platformLabel, geode::Anchor::BottomLeft, {sllWidth - offset - arbitraryPaddingValue, topRowYPos});
144148

145149
return true;
146150
}

0 commit comments

Comments
 (0)