mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-26 04:39:51 -04:00
new cool tabs 😎
This commit is contained in:
parent
755075ae04
commit
8ce12278aa
5 changed files with 26 additions and 0 deletions
loader
resources
src/ui/internal/list
Binary file not shown.
Before ![]() (image error) Size: 32 KiB After ![]() (image error) Size: 8.5 KiB ![]() ![]() |
BIN
loader/resources/images/tab-gradient-mask.png
Normal file
BIN
loader/resources/images/tab-gradient-mask.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 6.3 KiB |
BIN
loader/resources/images/tab-gradient.png
Normal file
BIN
loader/resources/images/tab-gradient.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 7.3 KiB |
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue