mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
Revert "Fix some stuff related to menuitemspriteextra but gonna revert"
This reverts commit e8b98e48f5
.
This commit is contained in:
parent
e8b98e48f5
commit
dcc40f11e1
21 changed files with 103 additions and 115 deletions
|
@ -10,7 +10,6 @@
|
|||
#include "ui/ListView.hpp"
|
||||
#include "ui/MDPopup.hpp"
|
||||
#include "ui/MDTextArea.hpp"
|
||||
#include "ui/MenuItemSpriteExtra.hpp"
|
||||
#include "ui/Notification.hpp"
|
||||
#include "ui/Popup.hpp"
|
||||
#include "ui/SceneManager.hpp"
|
||||
|
|
|
@ -6,20 +6,19 @@
|
|||
#pragma warning(disable : 4275)
|
||||
|
||||
namespace geode {
|
||||
class GEODE_DLL MenuItemSpriteExtra : public cocos2d::CCMenuItemSprite {
|
||||
class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite {
|
||||
protected:
|
||||
bool m_scaleSprites;
|
||||
|
||||
MenuItemSpriteExtra();
|
||||
~MenuItemSpriteExtra() override;
|
||||
MenuItemSprite();
|
||||
~MenuItemSprite() override;
|
||||
|
||||
public:
|
||||
static MenuItemSpriteExtra* create(
|
||||
static MenuItemSprite* create(
|
||||
cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite,
|
||||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
);
|
||||
|
||||
static MenuItemSpriteExtra* create(
|
||||
static MenuItemSprite* create(
|
||||
cocos2d::CCNode* normalSprite,
|
||||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
);
|
||||
|
@ -40,8 +39,6 @@ namespace geode {
|
|||
void selected() override;
|
||||
void unselected() override;
|
||||
|
||||
void setScaleSprites(bool scale);
|
||||
|
||||
void setImage(cocos2d::CCNode* image);
|
||||
void setNormalImage(cocos2d::CCNode* image) override;
|
||||
void setDisabledImage(cocos2d::CCNode* image) override;
|
|
@ -1,15 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <cocos2d.h>
|
||||
#include "MenuItemSpriteExtra.hpp"
|
||||
#include "MenuItemSprite.hpp"
|
||||
|
||||
#pragma warning(disable : 4275)
|
||||
|
||||
namespace geode {
|
||||
class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem {
|
||||
protected:
|
||||
MenuItemSpriteExtra* m_offButton;
|
||||
MenuItemSpriteExtra* m_onButton;
|
||||
MenuItemSprite* m_offButton;
|
||||
MenuItemSprite* m_onButton;
|
||||
bool m_toggled;
|
||||
|
||||
MenuItemToggle();
|
||||
|
@ -26,10 +26,10 @@ namespace geode {
|
|||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
);
|
||||
|
||||
void setOffButton(MenuItemSpriteExtra* button);
|
||||
void setOnButton(MenuItemSpriteExtra* button);
|
||||
MenuItemSpriteExtra* getOffButton() const;
|
||||
MenuItemSpriteExtra* getOnButton() const;
|
||||
void setOffButton(MenuItemSprite* button);
|
||||
void setOnButton(MenuItemSprite* button);
|
||||
MenuItemSprite* getOffButton() const;
|
||||
MenuItemSprite* getOnButton() const;
|
||||
|
||||
bool isToggled() const;
|
||||
void toggle(bool enabled);
|
||||
|
|
|
@ -77,7 +77,7 @@ struct CustomMenuLayer : Modify<CustomMenuLayer, MenuLayer> {
|
|||
|
||||
auto bottomMenu = static_cast<CCMenu*>(this->getChildByID("bottom-menu"));
|
||||
|
||||
auto btn = MenuItemSpriteExtra::create(
|
||||
auto btn = CCMenuItemSpriteExtra::create(
|
||||
m_fields->m_geodeButton, this,
|
||||
static_cast<SEL_MenuHandler>(geodeBtnSelector)
|
||||
);
|
||||
|
|
|
@ -151,13 +151,13 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) {
|
|||
auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
|
||||
infoSpr->setScale(.85f);
|
||||
|
||||
m_infoBtn = MenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo));
|
||||
m_infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo));
|
||||
m_infoBtn->setPosition(LAYER_SIZE.width / 2 - 25.f, LAYER_SIZE.height / 2 - 25.f);
|
||||
m_buttonMenu->addChild(m_infoBtn);
|
||||
|
||||
// repo button
|
||||
if (metadata.getRepository()) {
|
||||
auto repoBtn = MenuItemSpriteExtra::create(
|
||||
auto repoBtn = CCMenuItemSpriteExtra::create(
|
||||
CCSprite::createWithSpriteFrameName("github.png"_spr),
|
||||
this,
|
||||
menu_selector(ModInfoPopup::onRepository)
|
||||
|
@ -168,7 +168,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) {
|
|||
|
||||
// support button
|
||||
if (metadata.getSupportInfo()) {
|
||||
auto supportBtn = MenuItemSpriteExtra::create(
|
||||
auto supportBtn = CCMenuItemSpriteExtra::create(
|
||||
CCSprite::createWithSpriteFrameName("gift.png"_spr),
|
||||
this,
|
||||
menu_selector(ModInfoPopup::onSupport)
|
||||
|
@ -181,7 +181,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) {
|
|||
closeSpr->setScale(.8f);
|
||||
|
||||
auto closeBtn =
|
||||
MenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose));
|
||||
CCMenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose));
|
||||
closeBtn->setPosition(-LAYER_SIZE.width / 2 + 3.f, LAYER_SIZE.height / 2 - 3.f);
|
||||
m_buttonMenu->addChild(closeBtn);
|
||||
|
||||
|
@ -399,7 +399,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
|
|||
settingsSpr->setScale(.65f);
|
||||
|
||||
auto settingsBtn =
|
||||
MenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings));
|
||||
CCMenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings));
|
||||
settingsBtn->setPosition(-LAYER_SIZE.width / 2 + 25.f, -LAYER_SIZE.height / 2 + 25.f);
|
||||
m_buttonMenu->addChild(settingsBtn);
|
||||
|
||||
|
@ -410,7 +410,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
|
|||
);
|
||||
configSpr->setScale(.65f);
|
||||
|
||||
auto configBtn = MenuItemSpriteExtra::create(
|
||||
auto configBtn = CCMenuItemSpriteExtra::create(
|
||||
configSpr, this, menu_selector(LocalModInfoPopup::onOpenConfigDir)
|
||||
);
|
||||
configBtn->setPosition(-LAYER_SIZE.width / 2 + 65.f, -LAYER_SIZE.height / 2 + 25.f);
|
||||
|
@ -451,7 +451,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
|
|||
ButtonSprite::create("Uninstall", "bigFont.fnt", "GJ_button_05.png", .6f);
|
||||
uninstallBtnSpr->setScale(.6f);
|
||||
|
||||
auto uninstallBtn = MenuItemSpriteExtra::create(
|
||||
auto uninstallBtn = CCMenuItemSpriteExtra::create(
|
||||
uninstallBtnSpr, this, menu_selector(LocalModInfoPopup::onUninstall)
|
||||
);
|
||||
uninstallBtn->setPosition(-85.f, 75.f);
|
||||
|
@ -467,7 +467,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
|
|||
);
|
||||
m_installBtnSpr->setScale(.6f);
|
||||
|
||||
m_installBtn = MenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate));
|
||||
m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate));
|
||||
m_installBtn->setPosition(-8.0f, 75.f);
|
||||
m_buttonMenu->addChild(m_installBtn);
|
||||
|
||||
|
@ -536,7 +536,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) {
|
|||
);
|
||||
issuesBtnSpr->setScale(.75f);
|
||||
|
||||
auto issuesBtn = MenuItemSpriteExtra::create(
|
||||
auto issuesBtn = CCMenuItemSpriteExtra::create(
|
||||
issuesBtnSpr, this, menu_selector(LocalModInfoPopup::onIssues)
|
||||
);
|
||||
issuesBtn->setPosition(0.f, -LAYER_SIZE.height / 2 + 25.f);
|
||||
|
@ -726,7 +726,7 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) {
|
|||
);
|
||||
m_installBtnSpr->setScale(.6f);
|
||||
|
||||
m_installBtn = MenuItemSpriteExtra::create(
|
||||
m_installBtn = CCMenuItemSpriteExtra::create(
|
||||
m_installBtnSpr, this, menu_selector(IndexItemInfoPopup::onInstall)
|
||||
);
|
||||
m_installBtn->setPosition(-143.0f, 75.f);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <Geode/ui/Scrollbar.hpp>
|
||||
#include <Geode/ui/IconButtonSprite.hpp>
|
||||
#include <Geode/loader/Index.hpp>
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -32,8 +31,8 @@ protected:
|
|||
ModListLayer* m_layer = nullptr;
|
||||
DownloadStatusNode* m_installStatus = nullptr;
|
||||
IconButtonSprite* m_installBtnSpr;
|
||||
MenuItemSpriteExtra* m_installBtn;
|
||||
MenuItemSpriteExtra* m_infoBtn;
|
||||
CCMenuItemSpriteExtra* m_installBtn;
|
||||
CCMenuItemSpriteExtra* m_infoBtn;
|
||||
CCLabelBMFont* m_latestVersionLabel = nullptr;
|
||||
CCLabelBMFont* m_minorVersionLabel = nullptr;
|
||||
MDTextArea* m_detailsArea;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "InstallListCell.hpp"
|
||||
#include "InstallListPopup.hpp"
|
||||
#include <Geode/binding/ButtonSprite.hpp>
|
||||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemToggler.hpp>
|
||||
#include <Geode/binding/FLAlertLayer.hpp>
|
||||
#include <Geode/binding/StatsCell.hpp>
|
||||
|
@ -212,7 +213,7 @@ bool IndexItemInstallListCell::init(
|
|||
versionSelectSpr->setScale(.7f);
|
||||
|
||||
auto versionSelectBtn =
|
||||
MenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion));
|
||||
CCMenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion));
|
||||
versionSelectBtn->setAnchorPoint({1.f, .5f});
|
||||
versionSelectBtn->setPosition({m_toggle->getPositionX() - m_toggle->getContentSize().width - 5, m_height / 2});
|
||||
m_menu->addChild(versionSelectBtn);
|
||||
|
@ -371,7 +372,7 @@ bool SelectVersionCell::init(IndexItemHandle item, SelectVersionPopup* versionPo
|
|||
);
|
||||
selectSpr->setScale(.6f);
|
||||
|
||||
auto selectBtn = MenuItemSpriteExtra::create(
|
||||
auto selectBtn = CCMenuItemSpriteExtra::create(
|
||||
selectSpr, this, menu_selector(SelectVersionCell::onSelected)
|
||||
);
|
||||
selectBtn->setAnchorPoint({1.f, .5f});
|
||||
|
|
|
@ -22,7 +22,7 @@ bool InstallListPopup::setup(IndexItemHandle item, MiniFunction<void(IndexInstal
|
|||
);
|
||||
installBtnSpr->setScale(.6f);
|
||||
|
||||
auto installBtn = MenuItemSpriteExtra::create(
|
||||
auto installBtn = CCMenuItemSpriteExtra::create(
|
||||
installBtnSpr,
|
||||
this,
|
||||
menu_selector(InstallListPopup::onInstall)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ModListLayer.hpp"
|
||||
#include "../info/ModInfoPopup.hpp"
|
||||
#include <Geode/binding/ButtonSprite.hpp>
|
||||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemToggler.hpp>
|
||||
#include <Geode/binding/FLAlertLayer.hpp>
|
||||
#include <Geode/binding/StatsCell.hpp>
|
||||
|
@ -143,7 +144,7 @@ void ModListCell::setupInfo(
|
|||
creatorLabel->setColor({ 163, 163, 163 });
|
||||
}
|
||||
|
||||
m_developerBtn = MenuItemSpriteExtra::create(
|
||||
m_developerBtn = CCMenuItemSpriteExtra::create(
|
||||
creatorLabel, this, menu_selector(ModListCell::onViewDev)
|
||||
);
|
||||
m_columnMenu->addChild(m_developerBtn);
|
||||
|
@ -291,7 +292,7 @@ bool ModCell::init(
|
|||
exMark->setScale(.5f);
|
||||
|
||||
m_unresolvedExMark =
|
||||
MenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo));
|
||||
CCMenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo));
|
||||
m_unresolvedExMark->setVisible(false);
|
||||
m_menu->addChild(m_unresolvedExMark);
|
||||
|
||||
|
@ -299,7 +300,7 @@ bool ModCell::init(
|
|||
auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f);
|
||||
restartSpr->setScale(.65f);
|
||||
|
||||
auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart));
|
||||
auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart));
|
||||
m_menu->addChild(restartBtn);
|
||||
}
|
||||
else {
|
||||
|
@ -334,7 +335,7 @@ bool ModCell::init(
|
|||
}
|
||||
}
|
||||
|
||||
auto viewBtn = MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo));
|
||||
auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo));
|
||||
m_menu->addChild(viewBtn);
|
||||
}
|
||||
|
||||
|
@ -394,7 +395,7 @@ bool IndexItemCell::init(
|
|||
auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f);
|
||||
restartSpr->setScale(.65f);
|
||||
|
||||
auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart));
|
||||
auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart));
|
||||
m_menu->addChild(restartBtn);
|
||||
}
|
||||
else {
|
||||
|
@ -402,7 +403,7 @@ bool IndexItemCell::init(
|
|||
viewSpr->setScale(.65f);
|
||||
|
||||
auto viewBtn =
|
||||
MenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo));
|
||||
CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo));
|
||||
m_menu->addChild(viewBtn);
|
||||
}
|
||||
|
||||
|
@ -516,7 +517,7 @@ bool InvalidGeodeFileCell::init(
|
|||
whySpr->setScale(.65f);
|
||||
|
||||
auto viewBtn =
|
||||
MenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo));
|
||||
CCMenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo));
|
||||
menu->addChild(viewBtn);
|
||||
|
||||
return true;
|
||||
|
@ -634,7 +635,7 @@ bool ProblemsCell::init(
|
|||
viewSpr->setScale(.65f);
|
||||
|
||||
auto viewBtn =
|
||||
MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo));
|
||||
CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo));
|
||||
m_menu->addChild(viewBtn);
|
||||
|
||||
m_menu->updateLayout();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <Geode/loader/Loader.hpp>
|
||||
#include <Geode/loader/ModMetadata.hpp>
|
||||
#include <Geode/loader/Index.hpp>
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -23,8 +22,8 @@ protected:
|
|||
CCMenu* m_menu;
|
||||
CCLabelBMFont* m_description;
|
||||
CCMenuItemToggler* m_enableToggle = nullptr;
|
||||
MenuItemSpriteExtra* m_unresolvedExMark;
|
||||
MenuItemSpriteExtra* m_developerBtn;
|
||||
CCMenuItemSpriteExtra* m_unresolvedExMark;
|
||||
CCMenuItemSpriteExtra* m_developerBtn;
|
||||
SpacerNode* m_spacer = nullptr;
|
||||
CCMenu* m_columnMenu = nullptr;
|
||||
CCMenu* m_labelMenu = nullptr;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include <Geode/utils/string.hpp>
|
||||
#include <Geode/utils/ranges.hpp>
|
||||
|
||||
#include <Geode/ui/MenuItemSprite.hpp>
|
||||
|
||||
#define FTS_FUZZY_MATCH_IMPLEMENTATION
|
||||
#include <Geode/external/fts/fts_fuzzy_match.h>
|
||||
|
||||
|
@ -259,7 +261,7 @@ bool ModListLayer::init() {
|
|||
m_topMenu = CCMenu::create();
|
||||
|
||||
// add back button
|
||||
auto backBtn = MenuItemSpriteExtra::create(
|
||||
auto backBtn = MenuItemSprite::create(
|
||||
CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this,
|
||||
menu_selector(ModListLayer::onExit)
|
||||
);
|
||||
|
@ -270,7 +272,7 @@ bool ModListLayer::init() {
|
|||
auto reloadSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
|
||||
reloadSpr->setScale(.8f);
|
||||
auto reloadBtn =
|
||||
MenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload));
|
||||
CCMenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload));
|
||||
reloadBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 30.0f);
|
||||
m_menu->addChild(reloadBtn);
|
||||
|
||||
|
@ -279,7 +281,7 @@ bool ModListLayer::init() {
|
|||
"gj_folderBtn_001.png", .7f, CircleBaseColor::Green, CircleBaseSize::Small
|
||||
);
|
||||
auto openBtn =
|
||||
MenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder));
|
||||
CCMenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder));
|
||||
openBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 80.0f);
|
||||
m_menu->addChild(openBtn);
|
||||
|
||||
|
@ -394,7 +396,7 @@ void ModListLayer::createSearchControl() {
|
|||
filterSpr->setScale(.7f);
|
||||
|
||||
m_filterBtn =
|
||||
MenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters));
|
||||
CCMenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters));
|
||||
m_filterBtn->setPosition(-10.f, 0.f);
|
||||
menu->addChild(m_filterBtn);
|
||||
|
||||
|
@ -402,14 +404,14 @@ void ModListLayer::createSearchControl() {
|
|||
auto searchSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png");
|
||||
searchSpr->setScale(.7f);
|
||||
|
||||
m_searchBtn = MenuItemSpriteExtra::create(searchSpr, this, nullptr);
|
||||
m_searchBtn = CCMenuItemSpriteExtra::create(searchSpr, this, nullptr);
|
||||
m_searchBtn->setPosition(-35.f, 0.f);
|
||||
menu->addChild(m_searchBtn);
|
||||
|
||||
auto searchClearSpr = CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png");
|
||||
searchClearSpr->setScale(.7f);
|
||||
|
||||
m_searchClearBtn = MenuItemSpriteExtra::create(
|
||||
m_searchClearBtn = CCMenuItemSpriteExtra::create(
|
||||
searchClearSpr, this, menu_selector(ModListLayer::onResetSearch)
|
||||
);
|
||||
m_searchClearBtn->setPosition(-35.f, 0.f);
|
||||
|
@ -561,7 +563,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional<ModListQuery> const
|
|||
if (!m_checkForUpdatesBtn) {
|
||||
auto checkSpr = ButtonSprite::create("Check for Updates");
|
||||
checkSpr->setScale(.7f);
|
||||
m_checkForUpdatesBtn = MenuItemSpriteExtra::create(
|
||||
m_checkForUpdatesBtn = CCMenuItemSpriteExtra::create(
|
||||
checkSpr, this, menu_selector(ModListLayer::onCheckForUpdates)
|
||||
);
|
||||
m_checkForUpdatesBtn->setPosition(0, -winSize.height / 2 + 40.f);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/binding/TextInputDelegate.hpp>
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
#include <Geode/loader/Index.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
@ -55,13 +54,13 @@ protected:
|
|||
CCMenuItemToggler* m_installedTabBtn;
|
||||
CCMenuItemToggler* m_downloadTabBtn;
|
||||
CCMenuItemToggler* m_featuredTabBtn;
|
||||
MenuItemSpriteExtra* m_searchBtn;
|
||||
MenuItemSpriteExtra* m_searchClearBtn;
|
||||
MenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr;
|
||||
CCMenuItemSpriteExtra* m_searchBtn;
|
||||
CCMenuItemSpriteExtra* m_searchClearBtn;
|
||||
CCMenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr;
|
||||
CCNode* m_searchBG = nullptr;
|
||||
CCTextInputNode* m_searchInput = nullptr;
|
||||
LoadingCircle* m_loadingCircle = nullptr;
|
||||
MenuItemSpriteExtra* m_filterBtn;
|
||||
CCMenuItemSpriteExtra* m_filterBtn;
|
||||
ModListQuery m_query;
|
||||
ModListDisplay m_display = ModListDisplay::Concise;
|
||||
EventListener<IndexUpdateFilter> m_indexListener;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "ProblemsListCell.hpp"
|
||||
#include "ProblemsListPopup.hpp"
|
||||
#include <Geode/binding/ButtonSprite.hpp>
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemToggler.hpp>
|
||||
#include <Geode/binding/FLAlertLayer.hpp>
|
||||
#include <Geode/binding/StatsCell.hpp>
|
||||
|
@ -115,7 +115,7 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize
|
|||
viewSpr->setScale(.65f);
|
||||
|
||||
auto viewBtn =
|
||||
MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore));
|
||||
CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore));
|
||||
m_menu->addChild(viewBtn);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ Slider* createSlider(C* node, GeodeSettingValue<T>* setting, float width) {
|
|||
|
||||
template<class C, class T>
|
||||
std::pair<
|
||||
MenuItemSpriteExtra*, MenuItemSpriteExtra*
|
||||
CCMenuItemSpriteExtra*, CCMenuItemSpriteExtra*
|
||||
> createArrows(C* node, GeodeSettingValue<T>* setting, float width, bool big) {
|
||||
auto yPos = setting->castDefinition().controls.slider ? 5.f : 0.f;
|
||||
auto decArrowSpr = CCSprite::createWithSpriteFrameName(
|
||||
|
@ -83,7 +83,7 @@ std::pair<
|
|||
decArrowSpr->setFlipX(true);
|
||||
decArrowSpr->setScale(.3f);
|
||||
|
||||
auto decArrow = MenuItemSpriteExtra::create(
|
||||
auto decArrow = CCMenuItemSpriteExtra::create(
|
||||
decArrowSpr, node, menu_selector(C::onArrow)
|
||||
);
|
||||
decArrow->setPosition(-width / 2 + (big ? 65.f : 80.f), yPos);
|
||||
|
@ -97,7 +97,7 @@ std::pair<
|
|||
);
|
||||
incArrowSpr->setScale(.3f);
|
||||
|
||||
auto incArrow = MenuItemSpriteExtra::create(
|
||||
auto incArrow = CCMenuItemSpriteExtra::create(
|
||||
incArrowSpr, node, menu_selector(C::onArrow)
|
||||
);
|
||||
incArrow->setTag(big ?
|
||||
|
@ -377,7 +377,7 @@ bool FileSettingNode::setup(FileSettingValue* setting, float width) {
|
|||
auto fileBtnSpr = CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png");
|
||||
fileBtnSpr->setScale(.5f);
|
||||
|
||||
auto fileBtn = MenuItemSpriteExtra::create(
|
||||
auto fileBtn = CCMenuItemSpriteExtra::create(
|
||||
fileBtnSpr, this, menu_selector(FileSettingNode::onPickFile)
|
||||
);
|
||||
fileBtn->setPosition(.0f, .0f);
|
||||
|
@ -410,7 +410,7 @@ bool ColorSettingNode::setup(ColorSettingValue* setting, float width) {
|
|||
m_colorSpr->setColor(m_uncommittedValue);
|
||||
m_colorSpr->setScale(.65f);
|
||||
|
||||
auto button = MenuItemSpriteExtra::create(
|
||||
auto button = CCMenuItemSpriteExtra::create(
|
||||
m_colorSpr, this, menu_selector(ColorSettingNode::onSelectColor)
|
||||
);
|
||||
button->setPositionX(-10.f);
|
||||
|
@ -445,7 +445,7 @@ bool ColorAlphaSettingNode::setup(ColorAlphaSettingValue* setting, float width)
|
|||
m_colorSpr->updateOpacity(m_uncommittedValue.a / 255.f);
|
||||
m_colorSpr->setScale(.65f);
|
||||
|
||||
auto button = MenuItemSpriteExtra::create(
|
||||
auto button = CCMenuItemSpriteExtra::create(
|
||||
m_colorSpr, this, menu_selector(ColorAlphaSettingNode::onSelectColor)
|
||||
);
|
||||
button->setPositionX(-10.f);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCTextInputNode.hpp>
|
||||
#include <Geode/binding/Slider.hpp>
|
||||
#include <Geode/binding/SliderThumb.hpp>
|
||||
|
@ -40,7 +40,7 @@ protected:
|
|||
CCMenu* m_menu;
|
||||
CCLabelBMFont* m_nameLabel;
|
||||
CCLabelBMFont* m_errorLabel;
|
||||
MenuItemSpriteExtra* m_resetBtn;
|
||||
CCMenuItemSpriteExtra* m_resetBtn;
|
||||
|
||||
bool init(GeodeSettingValue<T>* setting, float width) {
|
||||
if (!SettingNode::init(setting))
|
||||
|
@ -81,7 +81,7 @@ protected:
|
|||
auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
|
||||
infoSpr->setScale(.6f);
|
||||
|
||||
auto infoBtn = MenuItemSpriteExtra::create(
|
||||
auto infoBtn = CCMenuItemSpriteExtra::create(
|
||||
infoSpr, this, menu_selector(GeodeSettingNode::onDescription)
|
||||
);
|
||||
infoBtn->setPosition(
|
||||
|
@ -97,7 +97,7 @@ protected:
|
|||
auto resetBtnSpr = CCSprite::createWithSpriteFrameName("reset-gold.png"_spr);
|
||||
resetBtnSpr->setScale(.5f);
|
||||
|
||||
m_resetBtn = MenuItemSpriteExtra::create(
|
||||
m_resetBtn = CCMenuItemSpriteExtra::create(
|
||||
resetBtnSpr, this, menu_selector(GeodeSettingNode::onReset)
|
||||
);
|
||||
m_resetBtn->setPosition(
|
||||
|
@ -210,10 +210,10 @@ protected:
|
|||
InputNode* m_input = nullptr;
|
||||
CCLabelBMFont* m_label = nullptr;
|
||||
Slider* m_slider = nullptr;
|
||||
MenuItemSpriteExtra* m_decArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_incArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_bigDecArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_bigIncArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_decArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_incArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_bigDecArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_bigIncArrow = nullptr;
|
||||
|
||||
void valueChanged(bool updateText) override;
|
||||
void textChanged(CCTextInputNode* input) override;
|
||||
|
@ -239,10 +239,10 @@ protected:
|
|||
InputNode* m_input = nullptr;
|
||||
CCLabelBMFont* m_label = nullptr;
|
||||
Slider* m_slider = nullptr;
|
||||
MenuItemSpriteExtra* m_decArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_incArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_bigDecArrow = nullptr;
|
||||
MenuItemSpriteExtra* m_bigIncArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_decArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_incArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_bigDecArrow = nullptr;
|
||||
CCMenuItemSpriteExtra* m_bigIncArrow = nullptr;
|
||||
|
||||
void valueChanged(bool updateText) override;
|
||||
void textChanged(CCTextInputNode* input) override;
|
||||
|
|
|
@ -90,7 +90,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
|||
m_applyBtnSpr = ButtonSprite::create("Apply", "goldFont.fnt", "GJ_button_01.png", .7f);
|
||||
m_applyBtnSpr->setScale(.7f);
|
||||
|
||||
m_applyBtn = MenuItemSpriteExtra::create(
|
||||
m_applyBtn = CCMenuItemSpriteExtra::create(
|
||||
m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply)
|
||||
);
|
||||
m_applyBtn->setPosition(.0f, -m_size.height / 2 + 20.f);
|
||||
|
@ -99,7 +99,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
|||
auto resetBtnSpr = ButtonSprite::create("Reset All", "goldFont.fnt", "GJ_button_05.png", .7f);
|
||||
resetBtnSpr->setScale(.7f);
|
||||
|
||||
auto resetBtn = MenuItemSpriteExtra::create(
|
||||
auto resetBtn = CCMenuItemSpriteExtra::create(
|
||||
resetBtnSpr, this, menu_selector(ModSettingsPopup::onResetAll)
|
||||
);
|
||||
resetBtn->setPosition(-m_size.width / 2 + 45.f, -m_size.height / 2 + 20.f);
|
||||
|
@ -109,7 +109,7 @@ bool ModSettingsPopup::setup(Mod* mod) {
|
|||
ButtonSprite::create("Open Folder", "goldFont.fnt", "GJ_button_05.png", .7f);
|
||||
openDirBtnSpr->setScale(.7f);
|
||||
|
||||
auto openDirBtn = MenuItemSpriteExtra::create(
|
||||
auto openDirBtn = CCMenuItemSpriteExtra::create(
|
||||
openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory)
|
||||
);
|
||||
openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f);
|
||||
|
|
|
@ -10,7 +10,7 @@ class ModSettingsPopup : public Popup<Mod*>, public SettingNodeDelegate {
|
|||
protected:
|
||||
Mod* m_mod;
|
||||
std::vector<SettingNode*> m_settings;
|
||||
MenuItemSpriteExtra* m_applyBtn;
|
||||
CCMenuItemSpriteExtra* m_applyBtn;
|
||||
ButtonSprite* m_applyBtnSpr;
|
||||
|
||||
void settingValueChanged(SettingNode*) override;
|
||||
|
|
|
@ -157,7 +157,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) {
|
|||
okBtnSpr->setScale(.7f);
|
||||
|
||||
auto okBtn =
|
||||
MenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose));
|
||||
CCMenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose));
|
||||
okBtn->setPosition(.0f, -m_size.height / 2 + 20.f);
|
||||
m_buttonMenu->addChild(okBtn);
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ bool MDPopup::setup(
|
|||
|
||||
auto btnSpr = ButtonSprite::create(btn1Text);
|
||||
|
||||
auto btn = MenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn));
|
||||
auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn));
|
||||
btn->setTag(0);
|
||||
m_buttonMenu->addChild(btn);
|
||||
|
||||
if (btn2Text) {
|
||||
auto btn2Spr = ButtonSprite::create(btn2Text);
|
||||
|
||||
auto btn2 = MenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn));
|
||||
auto btn2 = CCMenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn));
|
||||
btn2->setTag(1);
|
||||
m_buttonMenu->addChild(btn2);
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
#include <Geode/ui/MenuItemSprite.hpp>
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
MenuItemSpriteExtra* MenuItemSpriteExtra::create(
|
||||
MenuItemSprite* MenuItemSprite::create(
|
||||
cocos2d::CCNode* normalSprite,
|
||||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
) {
|
||||
return MenuItemSpriteExtra::create(normalSprite, nullptr, target, callback);
|
||||
return MenuItemSprite::create(normalSprite, nullptr, target, callback);
|
||||
}
|
||||
|
||||
MenuItemSpriteExtra* MenuItemSpriteExtra::create(
|
||||
MenuItemSprite* MenuItemSprite::create(
|
||||
cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite,
|
||||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
) {
|
||||
auto ret = new MenuItemSpriteExtra();
|
||||
auto ret = new MenuItemSprite();
|
||||
if (ret && ret->init(normalSprite, disabledSprite, target, callback)) {
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
|
@ -22,12 +22,12 @@ MenuItemSpriteExtra* MenuItemSpriteExtra::create(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
MenuItemSpriteExtra::MenuItemSpriteExtra() : m_scaleSprites(false) {}
|
||||
MenuItemSprite::MenuItemSprite() {}
|
||||
|
||||
MenuItemSpriteExtra::~MenuItemSpriteExtra() {
|
||||
MenuItemSprite::~MenuItemSprite() {
|
||||
}
|
||||
|
||||
void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) {
|
||||
void MenuItemSprite::setImage(cocos2d::CCNode* image) {
|
||||
if (image) {
|
||||
image->setAnchorPoint({ 0.5f, 0.5f });
|
||||
image->setPosition(image->getContentSize() / 2);
|
||||
|
@ -35,20 +35,20 @@ void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) {
|
|||
}
|
||||
|
||||
// why are the members private like what
|
||||
void MenuItemSpriteExtra::setNormalImage(cocos2d::CCNode* image) {
|
||||
void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) {
|
||||
CCMenuItemSprite::setNormalImage(image);
|
||||
this->setImage(image);
|
||||
}
|
||||
void MenuItemSpriteExtra::setDisabledImage(cocos2d::CCNode* image) {
|
||||
void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) {
|
||||
CCMenuItemSprite::setDisabledImage(image);
|
||||
this->setImage(image);
|
||||
}
|
||||
void MenuItemSpriteExtra::setSelectedImage(cocos2d::CCNode* image) {
|
||||
void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) {
|
||||
CCMenuItemSprite::setSelectedImage(image);
|
||||
this->setImage(image);
|
||||
}
|
||||
|
||||
bool MenuItemSpriteExtra::init(
|
||||
bool MenuItemSprite::init(
|
||||
cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite,
|
||||
cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback
|
||||
) {
|
||||
|
@ -67,41 +67,32 @@ bool MenuItemSpriteExtra::init(
|
|||
return true;
|
||||
}
|
||||
|
||||
void MenuItemSpriteExtra::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) {
|
||||
void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) {
|
||||
if (sprite) {
|
||||
sprite->stopAllActions();
|
||||
if (generator) sprite->runAction(generator);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuItemSpriteExtra::runActionOnSprites(MiniFunction<cocos2d::CCAction*()> generator) {
|
||||
if (m_scaleSprites) {
|
||||
this->runActionOnSprite(this->getNormalImage(), generator());
|
||||
this->runActionOnSprite(this->getDisabledImage(), generator());
|
||||
this->runActionOnSprite(this->getSelectedImage(), generator());
|
||||
}
|
||||
else {
|
||||
if (auto action = generator()) this->runAction(action);
|
||||
}
|
||||
void MenuItemSprite::runActionOnSprites(MiniFunction<cocos2d::CCAction*()> generator) {
|
||||
this->runActionOnSprite(this->getNormalImage(), generator());
|
||||
this->runActionOnSprite(this->getDisabledImage(), generator());
|
||||
this->runActionOnSprite(this->getSelectedImage(), generator());
|
||||
}
|
||||
|
||||
void MenuItemSpriteExtra::activate() {
|
||||
void MenuItemSprite::activate() {
|
||||
this->runActionOnSprites(m_activateAction);
|
||||
CCMenuItem::activate();
|
||||
}
|
||||
void MenuItemSpriteExtra::selected() {
|
||||
void MenuItemSprite::selected() {
|
||||
if (!m_bEnabled) return;
|
||||
CCMenuItem::selected();
|
||||
|
||||
this->runActionOnSprites(m_selectedAction);
|
||||
}
|
||||
void MenuItemSpriteExtra::unselected() {
|
||||
void MenuItemSprite::unselected() {
|
||||
if (!m_bEnabled) return;
|
||||
CCMenuItem::unselected();
|
||||
|
||||
this->runActionOnSprites(m_unselectedAction);
|
||||
}
|
||||
|
||||
void MenuItemSpriteExtra::setScaleSprites(bool scale) {
|
||||
m_scaleSprites = scale;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
#include <Geode/modify/MenuLayer.hpp>
|
||||
#include <Geode/loader/SettingNode.hpp>
|
||||
#include <Geode/loader/ModJsonTest.hpp>
|
||||
#include <Geode/ui/MenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/CCMenuItemSpriteExtra.hpp>
|
||||
#include <Geode/binding/FLAlertLayer.hpp>
|
||||
#include "main.hpp"
|
||||
|
||||
|
@ -92,7 +92,7 @@ protected:
|
|||
} else {
|
||||
btnSpr->setColor({ 200, 200, 200 });
|
||||
}
|
||||
auto btn = MenuItemSpriteExtra::create(
|
||||
auto btn = CCMenuItemSpriteExtra::create(
|
||||
btnSpr, this, menu_selector(MySettingNode::onSelect)
|
||||
);
|
||||
btn->setTag(static_cast<int>(icon));
|
||||
|
@ -113,7 +113,7 @@ protected:
|
|||
}
|
||||
m_currentIcon = static_cast<Icon>(sender->getTag());
|
||||
static_cast<CCSprite*>(
|
||||
static_cast<MenuItemSpriteExtra*>(sender)->getNormalImage()
|
||||
static_cast<CCMenuItemSpriteExtra*>(sender)->getNormalImage()
|
||||
)->setColor({ 0, 255, 0 });
|
||||
this->dispatchChanged();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue