new cool tabs 😎

This commit is contained in:
ConfiG 2023-08-03 20:33:42 +03:00
parent 755075ae04
commit 8ce12278aa
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
5 changed files with 26 additions and 0 deletions

Binary file not shown.

Before

(image error) Size: 32 KiB

After

(image error) Size: 8.5 KiB

Binary file not shown.

After

(image error) Size: 6.3 KiB

Binary file not shown.

After

(image error) Size: 7.3 KiB

View file

@ -322,11 +322,28 @@ bool ModListLayer::init() {
m_featuredTabBtn->setTag(static_cast<int>(ModListType::Featured));
m_menu->addChild(m_featuredTabBtn);
// tabs gradient
m_tabsGradientNode = CCClippingNode::create();
m_tabsGradientNode->setContentSize(this->getContentSize());
m_tabsGradientNode->setAnchorPoint({0.5f, 0.5f});
m_tabsGradientNode->ignoreAnchorPointForPosition(true);
m_tabsGradientNode->setZOrder(9);
m_tabsGradientNode->setInverted(false);
m_tabsGradientNode->setAlphaThreshold(0.f);
m_tabsGradientSprite = CCSprite::create("tab-gradient.png"_spr);
m_tabsGradientNode->addChild(m_tabsGradientSprite);
m_tabsGradientStencil = CCSprite::create("tab-gradient-mask.png"_spr);
m_tabsGradientNode->setStencil(m_tabsGradientStencil);
// add menus
m_menu->setZOrder(0);
m_topMenu->setZOrder(10);
this->addChild(m_menu);
this->addChild(m_tabsGradientNode);
this->addChild(m_tabsGradientStencil);
this->addChild(m_topMenu);
// select first tab
@ -470,6 +487,10 @@ void ModListLayer::reloadList(std::optional<ModListQuery> const& query) {
m_list->setPosition(winSize / 2 - m_list->getScaledContentSize() / 2);
this->addChild(m_list);
// position gradient sprite
if (m_tabsGradientSprite)
m_tabsGradientSprite->setPosition(m_list->getPosition() + CCPoint{179.f, 235.f});
// add search input to list
if (!m_searchInput) {
this->createSearchControl();
@ -625,6 +646,8 @@ void ModListLayer::onTab(CCObject* pSender) {
targetMenu->addChild(member);
member->release();
}
if (isSelected)
m_tabsGradientStencil->setPosition(member->m_onButton->convertToWorldSpaceAR({0.f, -1.f}));
};
toggleTab(m_downloadTabBtn);

View file

@ -39,6 +39,9 @@ struct ModListQuery {
class ModListLayer : public CCLayer, public TextInputDelegate {
protected:
GJListLayer* m_list = nullptr;
CCClippingNode* m_tabsGradientNode = nullptr;
CCSprite* m_tabsGradientSprite = nullptr;
CCSprite* m_tabsGradientStencil = nullptr;
CCLabelBMFont* m_listLabel;
CCLabelBMFont* m_indexUpdateLabel;
CCMenu* m_menu;